summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.BuildTasks/NativeMethods.cs
blob: 26de3a427d81e2bfb71f9976a38b77565122799c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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());
			}
		}
	}
}