WORD LFNFindFirst(lpFileSpec, wAttr, lpnEntries, lphDir, cbBuffer, lpFindBuf) | |||
LPSTR lpFileSpec; | |||
WORD wAttr; | |||
LPINT lpnEntries; | |||
LPINT lphDir; | |||
WORD cbBuffer; | |||
PFINDFILEBUF2 lpFindBuf; |
The LFNFindFirst function searches for the first occurrence of a file matching the specification in the lpFileSpec parameter.
lpFileSpec
Points to a null-terminated string specifying the name of a file or files to search for.
wAttr
Specifies what types of files (directories, hidden files, and so on) should be included in the file enumeration. It is defined the same way as the corresponding parameter to the MS-DOS Find First File (Interrupt 21h, Function 4Eh) function.
lpnEntries
Points to a 16-bit variable containing the maximum number of files to return. Upon successful return, this 16-bit variable is updated with the number of files actually returned in the buffer.
lphDir
Points to a 16-bit variable that receives a handle. The handle is used on subsequent calls to the LFNFindNext function. This handle can be freed using the LFNFindClose function.
cbBuffer
Specifies the size (in bytes) of the structure pointed to by the lpFindBuf parameter.
lpFindBuf
Points to a FILEFINDBUF2 structure that receives information about files. The FILEFINDBUF2 structure has the following form:
typedef struct _FILEFINDBUF2 { /* findbuf2 */
FDATE fdateCreation;
FTIME ftimeCreation;
FDATE fdateLastAccess;
FTIME ftimeLastAccess;
FDATE fdateLastWrite;
FTIME ftimeLastWrite;
ULONG cbFile;
ULONG cbFileAlloc;
USHORT attrFile;
ULONG cbList;
UCHAR cchName;
CHAR achName[CCHMAXPATHCOMP];
} FILEFINDBUF2;
The return value is one of the following values.
Value | Meaning |
0 | Success. |
2 | File not found. |
3 | Path not found. |
18 | No more files to be found. |
The export ordinal for this function is 100.