StormLib API Reference

SFileCreateArchive

Description

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.

Parameters

szMpqName
[in] Archive file name to be created.
dwCreateFlags
[in] Specifies additional flags for MPQ creation process. This parameter can be combination of the following flags:
Value Meaning
MPQ_CREATE_LISTFILE
(0x00100000)
The newly created archive will have (listfile) present.
Note that all archives created by SFileCreateArchive have listfile present due to compatibility reasons.
MPQ_CREATE_ATTRIBUTES
(0x00200000)
The newly created archive will have additional attributes in (attributes) file.
MPQ_CREATE_SIGNATURE
(0x00400000)
The newly created archive will be signed with weak digital signature (the "(signature) file).
MPQ_CREATE_ARCHIVE_V1
(0x00000000)
The function creates a MPQ version 1.0 (up to 4 GB). This is the default value
MPQ_CREATE_ARCHIVE_V2
(0x01000000)
The function creates a MPQ version 2.0 (supports MPQ of size greater than 4 GB).
MPQ_CREATE_ARCHIVE_V3
(0x02000000)
The function creates a MPQ version 3.0 (introduced in WoW-Cataclysm Beta).
MPQ_CREATE_ARCHIVE_V4
(0x03000000)
The function creates a MPQ version 4.0 (used in WoW-Cataclysm).
dwMaxFileCount
[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.
phMPQ
[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