2

Using

[DllImport("kernel32.dll")]
static extern bool CreateHardLink(string lpSymlinkFileName, 
string lpTargetFileName, IntPtr lpSecurityAttributes);

should I be able to use a relative path for the lpTargetFileName?

It doesn't seem to work for me. Should it? It works with full paths.

Edit:

This is Windows 7 and/or 2008

Matt
  • 25,943
  • 66
  • 198
  • 303
  • Surprisingly enough, MSDN is silent on the topic. Which Windows version? – MSalters Nov 02 '10 at 09:40
  • 1
    Usually most APIs work with a relative file path; what is the GetLastError() value? I would use absolute paths with APIs like this just to be safe, though. – Luke Nov 02 '10 at 12:01
  • I am not sure, but the lpTargetFileName might be interpreted relative to the lpSymlinkFilename, i.e. it works much like a symlink, not a hardlink. – Remember Monica Apr 14 '13 at 09:39

0 Answers0