views:

75

answers:

1

Hello,

Is there a way to get a file hardlinks count on Windows without using GetFileInformationByHandle()?

MSDN says:

Depending on the underlying network features of the operating system and the type of server connected to, the GetFileInformationByHandle function may fail, return partial information, or full information for the given file.

In practice, retrieving the link count on a network share, whatever the Windows version at both ends, always return 1. The only case where it works is when accessing a samba share. Looks like they forgot to duplicate Windows bug/limitation. Also, the "partial results" without telling you they are partial is pretty nice for an API call.

+1  A: 

It seems a little strange but what about GetFileInformationByHandleEx. It doesn't contain the waiver that you quoted above, so perhaps has the smarts built into it to handle some of the problems that GetFileInformationByHandle can have.

torak
Unfortunately I don't have any Vista/2008 underhand and I need support for everything >= Win2000 (should have said it in the question, sorry).
pmezard