StormLib API Reference
bool WINAPI SFileOpenArchive( const char * szMpqName, // Archive file name DWORD dwPriority, // Archive priority DWORD dwFlags, // Open flags HANDLE * phMPQ // Pointer to result HANDLE );
Function SFileOpenArchive opens a MPQ archive. During the open operation, the archive is checked for corruptions, internal (listfile) and (attributes) are loaded, unless specified otherwise. The archive is open for read and write operations, unless MPQ_OPEN_READ_ONLY is specified.
Note that StormLib maintains list of all files within the MPQ, as long as the MPQ is open. At the moment of MPQ opening, when the MPQ contains an internal list file, that listfile is parsed and all files in the listfile are checked against the hash table. Every file name that exists within the MPQ is added to the internal name list. The name list can be fuhrter extended by calling SFileAddListFile.
|Stream provider value||Name prefix||Meaning|
|flat-||The MPQ is plain linear file. The file can have a block bitmap at the end, indicating that some file blocks may be missing. This is the default value.|
|part-||The MPQ is stored in partial file. Partial files were used by trial version of World of Warcraft (build 10958 - 11685).|
|mpqe-||The MPQ is encrypted (.MPQE). Encrypted MPQs are used by Starcraft II and Diablo III installers. StormLib attempts to use all known keys. If no key can be used for decrypting the MPQ, the open operation fails.|
|blk4-||The MPQ divided to multiple blocks and multiple files. Size of one block is 0x4000 bytes, maximum number of blocks per file is 0x2000. Each block is followed by MD5 hash in plain ANSI text form. If the total number of blocks in the archive is greater than 0x2000, then the archive is split into multiple files. These files have decimal numeric extensions in ascending order (.MPQ.0, .MPQ.1, .MPQ.2 and so on).|
|Base provider value||Name prefix||Meaning|
|file:||The MPQ is in local file. This is the default value.|
|map:||The MPQ is in local file. Stormlib will attempt to map the file into memory. This speeds up the MPQ operations (reading, verifying), but has size and operating system limitations.|
|http:||The MPQ is on a web server available via HTTP protocol. The server must support random access. Only supported in Windows.|
|Stream flag value||Meaning|
|This flag causes the file to be open read-only. This flag is automatically set for partial and encrypted MPQs, and also for all MPQs that are not open from BASE_PROVIDER_FILE.|
|This flag causes the writable MPQ being open for write share. Use with caution. If two applications write to an open MPQ simultaneously, the MPQ data get corrupted.|
|This flag tells the file stream handler to respect a file bitmap. File bitmap is used by MPQs whose file blocks are downloaded on demand by the game.|
|Don't read the internal listfile.|
|Don't open the "(attributes)" file.|
|Do not search the header at 0x200 byte offsets.|
|Forces the MPQ to be open as MPQ format 1.0, ignoring "wFormatVersion" variable in the header.|
|SFileReadFile will check CRC of each file sector on any file in the archive until the archive is closed.|
|This flag is deprecated. Use STREAM_FLAG_READ_ONLY instead.|
|This flag is deprecated. Use STREAM_PROVIDER_MPQE instead.|
Since StormLib version 9.00, an archive name can have a prefix specifying the type of the archive. If a prefix is specified, it has greater priority than the appropriate stream flag. The list of possible prefixes is described in the table in the Parameters section above. A short list of examples how to use name prefix is below. Note that the "//" after the name prefix is optional. Both "map:C:\file.ext" and "map://C:\file.ext" are allowed and are equal. The http: prefix only works in Windows.
"part-file://C:\Data\Installer UI 2 deDE.MPQE"
The name string can also specify a master-mirror pair. The data are primarily taken from the mirror (e.g. local file), but if they are not available, they are loaded from the master (e.g. a web file). The name of the master archive must follow the name of the mirror archive, separated by an asterisk ('*'). An example how to use a master-mirror pair is below.
When the function succeeds, it returns nonzero and phMPQ contains the handle of the opened archive. When the archive cannot be open, function returns false and GetLastError gives the error code.
|Available in Storm.dll||Yes|
|Ordinal number in Storm.dll 1.00||63 (0x03F)|
|Ordinal number in Storm.dll 1.09||266 (0x10A)|
Copyright (c) Ladislav Zezula 2003 - 2014