Prev Next

FindFirstFileEx info  Overview  Group

The FindFirstFileEx function searches a directory for a file whose name and attributes match those specified in the function call.

HANDLE FindFirstFileEx(

    LPCTSTR lpFileName,

// pointer to the name of the file to search for

    FINDEX_INFO_LEVELS fInfoLevelId,

// information level of the returned data

    LPVOID lpFindFileData,

// pointer to the returned information

    FINDEX_SEARCH_OPS fSearchOp,

// type of filtering to perform

    LPVOID lpSearchFilter,

// pointer to search criteria

    DWORD dwAdditionalFlags

// additional search control flags

   );

Parameters

lpFileName
Points to a null-terminated string that specifies a valid directory or path and filename, which can contain wildcard characters (* and ?).
fInfoLevelId
Specifies a FINDEX_INFO_LEVELS enumeration type that gives the information level of the returned data.
lpFindFileData
Pointer to the file data. The pointer type is determined by the level of information specified in the fInfoLevelId parameter.
fSearchOp
Specifies a FINDEX_SEARCH_OPS enumeration type that gives the type of filtering to perform beyond wildcard matching.
lpSearchFilter
If the specified fSearchOp needs structured search information, lpSearchFilter points to the search criteria. At this time, none of the supported fSearchOp values require extended search information. Therefore, this pointer must be NULL.
dwAdditionalFlags
Specifies additional flags for controlling the search. You can use the FIND_FIRST_EX_CASE_SENSITIVE flag for case-sensitive searches. The default search is case insensitive. At this time, no other flags are defined.

Return Value

If the function succeeds, the return value is a search handle that can be used in a subsequent call to the FindNextFile or FindClose functions.

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

Remarks

The FindFirstFileEx function is provided to open a search handle and return information about the first file whose name matches the specified pattern and attributes.

If the underlying file system does not support the specified type of filtering, other than directory filtering, FindFirstFileEx fails with the error ERROR_NOT_SUPPORTED. The application has to use FINDEX_SEARCH_OPS type FileExSearchNameMatch and perform its own filtering.

Once established, the search handle can be used in the FindNextFile function to search for other files that match the same pattern with the same filtering being performed. When the search handle is no longer needed, it should be closed using the FindClose function.

The call

FindFirstFileEx( lpFileName, 

                 FindExInfoStandard, 

                 lpFindData, 

                 FindExSearchNameMatch, 

                 NULL, 

                 0 );

 

is equivalent to the call

FindFirstFile( lpFileName, lpFindData);

 

See Also

FINDEX_INFO_LEVELS, FINDEX_SEARCH_OPS, FindFirstFile, FindNextFile, FindClose