Beispiel #1
0
 public static void CreateFileLink(string linkPath, string targetPath)
 {
     if (!Win32SafeNativeMethods.CreateSymbolicLink(linkPath, targetPath, TargetIsAFile))
     {
         Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
     }
 }
Beispiel #2
0
 public static void CreateDirectoryLink(string linkPath, string targetPath)
 {
     if (Win32SafeNativeMethods.CreateSymbolicLink(linkPath, targetPath, TargetIsADirectory) && Marshal.GetLastWin32Error() == 0)
     {
         return;
     }
     try
     {
         Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
     }
     catch (COMException exception)
     {
         throw new IOException(exception.Message, exception);
     }
 }