# Function Reference

# _WinAPI_FindNextFileName

Continues enumerating the hard links

#include <WinAPIFiles.au3>
_WinAPI_FindNextFileName ( $hSearch, ByRef $sLink )

## Parameters

$hSearch | A handle to the enumeration that is returned by a successful call to _WinAPI_FindFirstFileName() function.
$sLink | Returns the next link name that was found.

## Return Value

Success: | True.
Failure: | False and sets the @error flag to non-zero, @extended flag may contain the system error code.

## Remarks

If the function fails because no matching files can be found,, the @extended flag will contain ERROR_HANDLE_EOF (38) system error code.
This function requires Windows Vista or later.

## Related

_WinAPI_FindFirstFileName

## See Also

Search FindNextFileNameW in MSDN Library.

## Example

    #include <MsgBoxConstants.au3>
    #include <WinAPIError.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 $sLink
    Local $hSearch = _WinAPI_FindFirstFileName($sFile, $sLink)
    While Not @error
        ConsoleWrite(_WinAPI_PathAppend(_WinAPI_PathStripToRoot($sFile), $sLink) & @CRLF)
        _WinAPI_FindNextFileName($hSearch, $sLink)
    WEnd

    Switch @extended
        Case 38 ; ERROR_HANDLE_EOF

        Case Else
            MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), @extended, _WinAPI_GetErrorMessage(@extended))
    EndSwitch

    FileDelete($sFile)