FindNextFileNameW function (fileapi.h)

Continues enumerating the hard links to a file using the handle returned by a successful call to the FindFirstFileNameW function.


BOOL FindNextFileNameW(
  [in]      HANDLE  hFindStream,
  [in, out] LPDWORD StringLength,
  [in, out] PWSTR   LinkName


[in] hFindStream

A handle to the enumeration that is returned by a successful call to FindFirstFileNameW.

[in, out] StringLength

The size of the LinkName parameter, in characters. If this call fails and the error is ERROR_MORE_DATA, the value that is returned by this parameter is the size that LinkName must be to contain all the data.

[in, out] LinkName

A pointer to a buffer to store the first link name found for lpFileName.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero (0). To get extended error information, call GetLastError.

If no matching files can be found, the GetLastError function returns ERROR_HANDLE_EOF.


If the function returns TRUE, there are more hard links to enumerate.

In Windows 8 and Windows Server 2012, this function is supported by the following technologies.

Technology Supported
Server Message Block (SMB) 3.0 protocol Yes
SMB 3.0 Transparent Failover (TFO) No
SMB 3.0 with Scale-out File Shares (SO) No
Cluster Shared Volume File System (CsvFS) Yes
Resilient File System (ReFS) Yes


Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header fileapi.h (include Windows.h, WinBase.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

File Management Functions