diff options
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks/NativeMethods.cs')
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/NativeMethods.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/NativeMethods.cs b/src/DotNetOpenAuth.BuildTasks/NativeMethods.cs new file mode 100644 index 0000000..26de3a4 --- /dev/null +++ b/src/DotNetOpenAuth.BuildTasks/NativeMethods.cs @@ -0,0 +1,18 @@ +namespace DotNetOpenAuth.BuildTasks { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Runtime.InteropServices; + + internal static class NativeMethods { + [DllImport("kernel32", SetLastError = true)] + private static extern bool CreateHardLink(string newFileName, string existingFileName, IntPtr securityAttributes); + + internal static void CreateHardLink(string existingFileName, string newFileName) { + if (!CreateHardLink(newFileName, existingFileName, IntPtr.Zero)) { + Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); + } + } + } +} |