StormLib API Reference



bool WINAPI SFileCreateArchive(
  const TCHAR * szMpqName,          // Archive file name
  DWORD dwCreateFlags,              // Additional flags to specify creation details
  DWORD dwMaxFileCount,             // Limit for file count
  HANDLE * phMPQ                    // Pointer to result HANDLE

Function SFileCreateArchive opens or creates the MPQ archive. The function can also convert an existing file to MPQ archive. The MPQ archive is always open for write operations.

The function internally verifies the file using SFileOpenArchive. If the file already exists and it is an MPQ archive, the function fails and GetLastError() returns ERROR_ALREADY_EXISTS.


[in] Archive file name to be created.
[in] Specifies additional flags for MPQ creation process. This parameter can be combination of the following flags:
Value Meaning
The newly created archive will have (listfile) present.
Note that all archives created by SFileCreateArchive have listfile present due to compatibility reasons.
The newly created archive will have additional attributes in (attributes) file.
The newly created archive will be signed with weak digital signature (the "(signature) file).
The function creates a MPQ version 1.0 (up to 4 GB). This is the default value
The function creates a MPQ version 2.0 (supports MPQ of size greater than 4 GB).
The function creates a MPQ version 3.0 (introduced in WoW-Cataclysm Beta).
The function creates a MPQ version 4.0 (used in WoW-Cataclysm).
[in] File count limit. The value must be in range of HASH_TABLE_SIZE_MIN (0x04) and HASH_TABLE_SIZE_MAX (0x80000). StormLib will automatically calculate size of hash tables and block tables from this value.
[out] Pointer to a variable of HANDLE type, where the opened archive handle will be stored.

Return Value

When the function succeeds, it returns nonzero and phMPQ contains the handle of the new archive. On an error, the function returns false and GetLastError gives the error code.

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