FindFirstFileEx  3OZI.VX 

[New - Windows NT]

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 the information level of the returned data. If the FindExInfoStandard constant is used, the lpFindFileData pointer is the standard WIN32_FIND_DATA4TJ_4N structure used with FindFirstFile2A0Z0Q6. At this time, no other information levels are supported.

lpFindFileData

Pointer to the file data. The pointer type is determined by the level of information specified in the fInfoLevelId parameter.

fSearchOp

Specifies the type of filtering to perform beyond wildcard matching. For more details, see the Remarks section later in this topic.

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 FindNextFileJKCUCC or FindCloseDK5RPX functions.

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

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.

The way additional filtering is done depends on the value of fSearchOp. The fSearchOp parameter can be one of the following values:

Value

Meaning

FindExSearchNameMatch

Search for a file that matches the specified filename. Note that lpSearchFilter must be NULL when this search operation is used.

FindExSearchLimitToDevices

Only device names are returned. Device names are generally accessible through the \\.\<name> convention. The dwAdditionalFlags parameter cannot be FIND_FIRST_EX_CASE_SENSITIVE when this search operation is used.

FindExSearchLimitToDirectories

This is an advisory flag.

If the file system supports directory filtering, the function searches for a  file  that matches the specified filename and that is a directory.

If the file system does not support directory filtering, this flag is silently ignored.

The lpSearchFilter parameter must be NULL when this search operation is used.

If you want directory filtering, use this flag on all file systems, but be sure to examine the file attribute data stored into *lpFindFileData to determine whether the function has indeed returned a handle to a directory.

 

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

Once established, the search handle can be used in the FindNextFileJKCUCC 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 FindCloseDK5RPX function.

The call

FindFirstFileEx( lpFileName,

                 FindExInfoStandard,

                 lpFindData,

                 FindExSearchNameMatch,

                 NULL,

                 0 );

 

is equivalent to the call

FindFirstFile( lpFileName, lpFindData);

 

See Also

FindFirstFile, FindNextFile, FindClose, WIN32_FIND_DATA