StormLib API Reference



bool WINAPI SFileFinishFile(
  HANDLE hFile                      // Handle to the file

Function SFileFinishFile finalized creation of the archived file. The file must have been created by SFileCreateFile.


[in] Handle to a new file within MPQ. This handle must have been obtained by calling SFileCreateFile.

Return Value

When the function succeeds, it returns nonzero. On an error, the function returns false and GetLastError gives the error code.


This function flushes any file data that are remaining after previous calls of SFileWriteFile.

The amount of data previously written by SFileWriteFile must match the total file size initiated by SFileCreateFile. If the amount of data doesn't match, the function returns false and GetLastError() returns ERROR_CAN_NOT_COMPLETE.

This function must always be called when the handle returned by SFileCreateFile is nonzero, regardless of the result of SFileCreateFile or SFileWriteFile. If any of these two functions failed, StormLib cleans up the file and reverts changes caused by the file writes.

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