FindFirstStreamW function (fileapi.h)

Enumerates the first stream with a ::$DATA stream type in the specified file or directory.

To perform this operation as a transacted operation, use the FindFirstStreamTransactedW function.


HANDLE FindFirstStreamW(
  [in]  LPCWSTR            lpFileName,
  [in]  STREAM_INFO_LEVELS InfoLevel,
  [out] LPVOID             lpFindStreamData,
        DWORD              dwFlags


[in] lpFileName

The fully qualified file name.

[in] InfoLevel

The information level of the returned data. This parameter is one of the values in the STREAM_INFO_LEVELS enumeration type.

Value Meaning
The data is returned in a WIN32_FIND_STREAM_DATA structure.

[out] lpFindStreamData

A pointer to a buffer that receives the file stream data. The format of this data depends on the value of the InfoLevel parameter.


Reserved for future use. This parameter must be zero.

Return value

If the function succeeds, the return value is a search handle that can be used in subsequent calls to the FindNextStreamW function.

If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

If no streams can be found, the function fails and GetLastError returns ERROR_HANDLE_EOF (38).

If the filesystem does not support streams, the function fails and GetLastError returns ERROR_INVALID_PARAMETER (87).


The FindFirstStreamW function opens a search handle and returns information about the first $DATA stream in the specified file or directory. For files, this is always the default, unnamed data stream, "::$DATA". Directories do not have $DATA streams by default and cannot have an unnamed data stream, but may have named data streams set after they have been created. After the search handle has been established, use it in calls to the FindNextStreamW function to search for other streams in the specified file or directory. When the search handle is no longer needed, it should be closed using the FindClose function.

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) Yes
SMB 3.0 with Scale-out File Shares (SO) Yes
Cluster Shared Volume File System (CsvFS) Yes
Resilient File System (ReFS) Yes

SMB 3.0 supports list of streams less than or equal to 64K.


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [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