StormLib API Reference

SFileGetFileInfo

Description

bool WINAPI SFileGetFileInfo(
  HANDLE hMpqOrFile,                // Handle to a file or archive
  DWORD dwInfoType,                 // Type of information to retrieve
  void * pvFileInfo,                // Pointer to the buffer where to store the result information
  DWORD cbFileInfo,                 // Size of the buffer pointed by pvFileInfo
  LPDWORD pcbLengthNeeded           // Size, in bytes, required to store information to pvFileInfo
);

Function SFileGetFileInfo retrieves an information about an open MPQ archive or a file.

Parameters

hMpqOrFile
[in] Handle to an open file or to an open MPQ archive, depending on the value of dwInfoType.
dwInfoType
[in] Type of information to retrieve. See Return Value for more information.
pvFileInfo
[in, out] Pointer to buffer where to store the required information.
cbFileInfo
[in] Size of the buffer pointed by pvFileInfo.
pcbLengthNeeded
[in] Size, in bytes, needed to store the information into pvFileInfo.

Return Value

When the function succeeds, it returns true. On an error, the function returns false and GetLastError returns error code. Possible error codes may be ERROR_INVALID_PARAMETER (unknown file info type) or ERROR_INSUFFICIENT_BUFFER (not enough space in the supplied buffer). The following table shows the possible type of information that are obtainable by SFileGetFileInfo:

Value of dwInfoType Value of hMpqOrFile pvFileInfo points to Returned information
SFILE_INFO_ARCHIVE_NAME MPQ archive handle Array of ANSI characters Full path name of the MPQ archive
SFILE_INFO_ARCHIVE_SIZE MPQ archive handle 32-bit integer Size of the archive, as written in the archive header.
SFILE_INFO_HASH_TABLE_SIZE MPQ archive handle 32-bit integer Size of the hash table, in entries.
SFILE_INFO_BLOCK_TABLE_SIZE MPQ archive handle 32-bit integer Size of the block table, in entries.
SFILE_INFO_SECTOR_SIZE MPQ archive handle 32-bit integer Size of one file sector, in bytes.
SFILE_INFO_HASH_TABLE MPQ archive handle Array of TMPQHash Copy of the hash table.
SFILE_INFO_BLOCK_TABLE MPQ archive handle Array of TMPQBlock Copy of the block table.
SFILE_INFO_NUM_FILES MPQ archive handle 32-bit integer Number of file in the MPQ archive.
SFILE_INFO_STREAM_FLAGS MPQ archive handle 32-bit integer Combination of STREAM_FLAG_XXX values for the archive.
SFILE_INFO_HASH_INDEX MPQ file handle 32-bit integer Hash index of the open file.
SFILE_INFO_CODENAME1 MPQ file handle 32-bit integer The first part of 64-bit code name from the hash table entry.
SFILE_INFO_CODENAME2 MPQ file handle 32-bit integer The second part of 64-bit code name from the hash table entry.
SFILE_INFO_LOCALEID MPQ file handle 32-bit integer Locale ID of the file. For list of locale IDs, see SFileSetLocale.
SFILE_INFO_BLOCKINDEX MPQ file handle 32-bit integer Block index of the file in the block table.
SFILE_INFO_FILE_SIZE MPQ file handle 32-bit integer Size of uncompressed file, as saved in the block table.
SFILE_INFO_COMPRESSED_SIZE MPQ file handle 32-bit integer Size of compressed file, as saved in the block table.
SFILE_INFO_FLAGS MPQ file handle 32-bit integer Flags of the file from the block table.
SFILE_INFO_POSITION MPQ file handle 32-bit integer Position of the file data in the MPQ archive, relative to the begin of the MPQ file.
SFILE_INFO_KEY MPQ file handle 32-bit integer Encryption key of the file. If MPQ_FILE_FIX_KEY is set in the file flags, this is the key value after adjustment.
SFILE_INFO_KEY_UNFIXED MPQ file handle 32-bit integer Encryption key of the file. If MPQ_FILE_FIX_KEY is set in the file flags, this is the key value before adjustment.
SFILE_INFO_FILETIME MPQ file handle 64-bit integer File time of the file in the MPQ.

Remarks

This function doesn't support local files open by SFileOpenFileEx.

Availability in Storm.dll

Available in Storm.dll No
Ordinal number in Storm.dll 1.00 N/A
Ordinal number in Storm.dll 1.09 N/A