StormLib API Reference

SFileSetCompactCallback

Description

bool WINAPI SFileSetCompactCallback(
  HANDLE hMpq                         // Handle to an open MPQ.
  SFILE_COMPACT_CALLBACK pfnCompactCB // Pointer to callback function
  void * pvUserData                   // Pointer to custom data
);

Function SFileSetCompactCallback sets a callback that will be called during operations performed by SFileCompactArchive. Registering a callback will help the calling application to show a progress about the operation, which will enhance user experience with the application.

Parameters

hMpq
[in] Handle to the MPQ that will be compacted. Current version of StormLib ignores the parameter, but it is recommended to set it to the handle of the archive.
pfnCompactCB
[in] Pointer to the callback function. For the prototype and parameters, see below.
lpData
[in] User defined data that will be passed to the callback function.

Callback Parameters

void WINAPI CompactCallback(
  void * pvUserData,                  // Custom pointer passed to SFileSetCompactCallback
  DWORD dwWorkType,                   // Work currently being done
  LARGE_INTEGER * pBytesProcessed,    // Number of bytes already processed
  LARGE_INTEGER * pTotalBytes         // Total number of bytes to process
);
pvUserData
[in] User data pointer that has been passed to SFileSetCompactCallback.
dwWorkType
[in] Contains identifier of the work that is currently being done. It can be any of the following values:
Value Meaning
CCB_CHECKING_FILES
(1)
Checking if all files in the archive are known.
CCB_CHECKING_HASH_TABLE
(2)
Checking hash table of the archive.
CCB_COPYING_NON_MPQ_DATA
(3)
SFileCompactArchive is copying non-MPQ that precede the archive itself.
CCB_COMPACTING_FILES
(4)
SFileCompactArchive is writing the files to the new MPQ.
CCB_CLOSING_ARCHIVE
(5)
SFileCompactArchive is closing the MPQ.
pBytesProcessed
[in] Pointer to LARGE_INTEGER, indicating what part of the archive has already been compacted.
pTotalBytes
[in] Pointer to LARGE_INTEGER, containing total number of bytes that has to be compacted.

Return Value

The function never fails and always sets the callback.

Remarks

After SFileCompactArchive finishes, the compact callback is invalidated. For eventual next call to SFileCompactArchive, the calling application must set the compact callback again.

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