Enumerates all the hard links to the specified file
#include <WinAPIFiles.au3>
_WinAPI_EnumHardLinks ( $sFilePath )
$sFilePath | The path to the file whose links are to be enumerated. |
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. |
The _WinAPI_CreateHardLink() function is only supported on the NTFS file system.
This function requires Windows Vista or later.
Search ZwQueryInformationFile in MSDN Library.
#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)