StormLib API Reference

SFileSetAddFileCallback

Description

bool WINAPI SFileSetAddFileCallback(
  HANDLE hMpq                         // Handle to an open MPQ.
  SFILE_ADDFILE_CALLBACK pfnAddFileCB // Pointer to callback function
  void * pvUserData                   // Pointer to custom data
);

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

Parameters

hMpq
[in] Handle to the MPQ where the file will be added.
pfnAddFileCB
[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 AddFileCallback(
  void * pvUserData,                  // Custom pointer passed to SFileSetAddFileCallback
  DWORD dwBytesWritten,               // Number of bytes already written
  DWORD dwTotalBytes,                 // Total number of bytes to be written
  bool bFinalCall                     // If true, this is the last call to the callback function
);
pvUserData
[in] User data pointer that has been passed to SFileSetAddFileCallback.
dwBytesWritten
[in] Contains number of bytes that has already been written to the MPQ
dwTotalBytes
[in] Contains total number of bytes to be written to the MPQ. It is the size of the file being added.
bFinalCall
[in] If this parameter is true, it means that the operation is complete and succeeded. It also means that this is the last call to the callback function.

Return Value

The function never fails and always sets the callback.

Remarks

After SFileAddFileEx finishes, the compact callback is invalidated. For eventual next call to SFileAddFileEx, 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