We have a desktop application that makes use of NTFS hard links. The application is distributed and used successfully on over 400K user PCs worldwide.
There is one customer however who has CreateHardLink() function fail consistently with error code 1 (Incorrect function). This happens on multiple machines within the same firm. All these machines run Windows XP and the problem occurs on a NTFS partition.
We have asked the user to run fsutil.exe to confirm that volume file system is in fact NTFS, and also that "fsutil.exe hardlink create newname.txt existing.txt" fails that exact error message.
Any idea what could be causing it?
Incorrect function would indicate that file system is not NTFS - I'd REALLY make sure that client's FS is NTFS. If you're sure that it's NTFS, I'd suggest calling NTFS kernel driver directly to figure out what's wrong. Open file via CreateFile() and call NtSetInformationFile() with parameter FileLinkInformation; the error code should tell you exactly what's wrong.
Pointers you'd need are FILE_LINK_INFORMATION structure (http://msdn.microsoft.com/en-us/library/windows/hardware/ff540324%28v=vs.85%29.aspx) and ZwSetInformationFile (http://msdn.microsoft.com/en-us/library/windows/hardware/ff567096%28v=vs.85%29.aspx), but you can't use Zw* outside kernel, so use Nt* version. It's a bit tricky to use even Nt* functions, though.
Anyway, correct syntax for fsutil would be "fsutil hardlink create ".
Robert