CascLib API Reference
CascFindFirstFile
bool WINAPI CascFindFirstFile( HANDLE hStorage, // Handle to an open storage LPCSTR szMask, // Wildcard mask to specify files PCASC_FIND_DATA pFindData, // Pointer to a CASC_FIND_DATA structure LPCTSTR szListFile // Optional name of a listfile );
Function CascFindFirstFile begins an iteration over all files in the storage and returns the information about the first one.
On success, the function returns a search handle that can be used for subsequent calls to CascFindNextFile.
On failure, the function returns INVALID_HANDLE_VALUE and GetLastError() returns the error code.
On success, the function fills the CASC_FIND_DATA structure:
Field | Description |
---|---|
szFileName | Full name of the file. This field can contain either real file name or a pseudo-name derived from file data id or from CKey/EKey. It is guaranteed that CascOpenFile can open the file using name returned in this field. |
CKey | 16-byte value of file content key. A content key is a MD5 hash of the plain (decoded) file data. Note: Content key need not be present for all files in the storage. An example is Warcraft III storages, where most of the files are referenced by Encoded key. |
EKey | 16-byte value of file encoded key. Am encoded key is MD5 hash of the encoded file headers. Note: Encoded key need not have full 16 byte length. In such case, the data returned is padded by zeros. |
TagBitMask | A bit mask of tags which are present for the file. For the list of tags, see CascGetStorageInfo. |
FileSize | A 64-bit (content) size of the file. |
szPlainName | A pointer to the plain file name. Points into the szFileName array. |
dwFileDataId | A 32-bit integer containing file data ID. File data IDs are typically supported by World of Warcraft storages. If the file data ID is not supported, this field gets the value of CASC_INVALID_ID. |
dwLocaleFlags | Locale flags. Only valid if the storage supports locale flags, otherwise CASC_INVALID_ID. |
dwContentFlags | Content flags. Only valid if the storage supports content flags, otherwise CASC_INVALID_ID. |
dwSpanCount | Number of file spans. A file within CASC storage can be composed of multiple file spans. |
bFileAvailable | If hStorage specifies a handle to a local storage, this value is true if the file is locally available. For online storages, this value has no meaning and it's always false. |
NameType | One of CASC_NAME_TYPE enum values. This variable indicates the type of name in the szFileName member. It can be one of the following values:
|
Copyright (c) Ladislav Zezula 2019