StormLib API Reference

SFileVerifyFile

Description

DWORD WINAPI SFileVerifyFile(
  HANDLE hMpq,                      // Handle to a file or archive
  const char * szFileName,          // Name of the file to verify
  DWORD dwFlags                     // What to verify
);

Function SFileVerifyFile verifies the file by its CRC and MD5. The (attributes) file must exist in the MPQ and must have been open by SFileOpenArchive or created by SFileCreateArchive. The entire file is always checked for readability. Additional flags in dwFlags turn on extra checks on the file.

Parameters

hMpq
[in] Handle to an open MPQ archive.
szFileName
[in] Name of a file to verify.
dwFlags
[in] Specifies what to verify. This parameter can be a combination of the following values:
Value Meaning
SFILE_VERIFY_SECTOR_CRC
(0x0001)
Also verify CRC of each file sector.
SFILE_VERIFY_FILE_CRC
(0x0002)
Also verify the file by its CRC32.
SFILE_VERIFY_FILE_MD5
(0x0004)
Also verify the file by its MD5.
SFILE_VERIFY_RAW_MD5
(0x0008)
Also verify the file by the raw data MD5.

Return Value

Return value is zero when no problerms were found. Otherwise, return value is a bit mask consisting of the following possible found problems:

Value Meaning
VERIFY_OPEN_ERROR
(0x00000001)
Failed to open the file. GetLastError() returns more information.
VERIFY_READ_ERROR
(0x00000002)
Could not read all the data from the file.
VERIFY_FILE_HAS_SECTOR_CRC
(0x00000004)
The checked file has been tested for sector checksum integrity.
VERIFY_FILE_SECTOR_CRC_ERROR
(0x00000008)
Sector checksum verification failed during reading the file. This flag may only be set on files with MPQ_FILE_SECTOR_CRC flag set and with sector checksum available.
VERIFY_FILE_HAS_CHECKSUM
(0x00000010)
The file has valid file CRC32 and was tested using it.
VERIFY_FILE_CHECKSUM_ERROR
(0x00000020)
CRC32 checksum for the entire file doesn't match. This flag may only be set when the MPQ has the "(attributes)" file, and the verified file has a valid CRC32 value there. Note that this check may fail on WAVE files stored using a lossy compression.
VERIFY_FILE_HAS_MD5
(0x00000040)
The file has valid file MD5 and was tested using it.
VERIFY_FILE_MD5_ERROR
(0x00000080)
MD5 for the entire file doesn't match. This flag may only be set when the MPQ has the "(attributes)" file, and the verified file has a valid MD5 hash there.
VERIFY_FILE_HAS_RAW_MD5
(0x00000040)
The file has valid raw MD5 hash was tested using it.
VERIFY_FILE_RAW_MD5_ERROR
(0x00000040)
MD5 for the raw file data doesn't match.

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