Function Reference


_WinAPI_EnumHardLinks

Enumerates all the hard links to the specified file

#include <WinAPIFiles.au3>
_WinAPI_EnumHardLinks ( $sFilePath )

Parameters

$sFilePath The path to the file whose links are to be enumerated.

Return Value

Success: The array of the full paths to the links. The zeroth array element contains the number of links.
Failure: Sets the @error flag to non-zero, @extended flag may contain the NTSTATUS error code.

Remarks

The _WinAPI_CreateHardLink() function is only supported on the NTFS file system.

This function requires Windows Vista or later.

See Also

Search ZwQueryInformationFile in MSDN Library.

Example

#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <WinAPIShPath.au3>

Local $sFile = @DesktopDir & '\' & StringRegExpReplace(_WinAPI_PathFindFileName(@ScriptName), '\A_+', '@')

; Create hard link to the current file with prefix "@" on your Desktop
If Not _WinAPI_CreateHardLink($sFile, @ScriptFullPath) Then
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', 'Unable to create hard link.')
        Exit
EndIf

; Enumerate all hard links to the file
Local $aData = _WinAPI_EnumHardLinks($sFile)

_ArrayDisplay($aData, '_WinAPI_EnumHardLinks')

FileDelete($sFile)