CascLib API Reference
CascGetFileInfo
bool WINAPI CascGetFileInfo(
HANDLE hFile // Handle to an open file
CASC_FILE_INFO_CLASS InfoClass // Specifies which type of file info to get
void * pvFileInfo, // Pointer to buffer that receives the file info
size_t cbFileInfo, // Length of buffer pointed by pvFileInfo
size_t * pcbLengthNeeded // Pointer to a variable that receives the length of the file info
);
Function CascGetFileInfo retrieves various information about an open file. The file must have been open open by a previous call to CascOpenFile.
| CASC_FILE_INFO_CLASS value | Type of information returned |
|---|---|
| CascFileContentKey | 16-byte value of file content key. A content key is a MD5 hash of the plain (decoded) file data. Note: Content key must 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. |
| CascFileEncodedKey | 16-byte value of file encoded key. Am encoded key is MD5 hash of the encoded file headers. Note: Encoded key must not have full 16 byte length. In such case, the data returned is padded by zeros. |
| CascFileFullInfo | A CASC_FILE_FULL_INFO structure. |
| CascFileSpanInfo | A CASC_FILE_SPAN_INFO structure. |
On success, the function returns true.
On failure, the function returns false and GetLastError() returns the error code.
This example demonstrates usage of GascGetFileInfo for retrieving a variable-sized information
PCASC_FILE_SPAN_INFO GetFileSpanInfo(HANDLE hFile)
{
PCASC_FILE_SPAN_INFO pSpans = NULL;
size_t cbLength = 0;
// Retrieve the full file info
CascGetFileInfo(hFile, CascFileSpanInfo, pSpans, cbLength, &cbLength);
if(cbLength != 0)
{
if((pSpans = (PCASC_FILE_SPAN_INFO)(new BYTE[cbLength])) != NULL)
{
if(CascGetFileInfo(hFile, CascFileSpanInfo, pSpans, cbLength, NULL))
return pSpans;
CASC_FREE(pSpans);
pSpans = NULL;
}
}
return pSpans;
}
Copyright (c) Ladislav Zezula 2019