StormLib API Reference
SFileOpenFileEx
bool WINAPI SFileOpenFileEx( HANDLE hMpq, // Archive handle const char * szFileName, // Name of the file to open DWORD dwSearchScope, // Specifies the scope for the file. HANDLE * phFile // Pointer to file handle );
Function SFileOpenFileEx opens a file from MPQ archive. The file is only open for read. The file must be closed by calling SFileCloseFile. All files must be closed before the MPQ archive is closed.
Value | Meaning |
---|---|
SFILE_OPEN_FROM_MPQ (0x00000000) |
The file is open from the MPQ. This is the default value. hMpq must be valid if SFILE_OPEN_FROM_MPQ is specified. |
SFILE_OPEN_LOCAL_FILE (0xFFFFFFFF) |
Opens a local file instead. The file is open using CreateFileEx with GENERIC_READ access and FILE_SHARE_READ mode. |
When the function succeeds, it returns nonzero and phFile contains the handle of the opened file. When the file cannot be open, function returns false and GetLastError gives the error code.
The function always tries to open file with the specified locale first. If such file doesn't exist in the MPQ, the function tries to open file with neutral language ID.
When the archive is a patched archive, then the following StormLib functions behave dfferently:
When the caller doesn't know the proper file name, a pseudo name can be used. The pseudo name is in the form of File%08u.xxx (case sensitive). The numeric part of the file is the index in the file table. The open operation succeeds only if any of the following conditions is true:
Available in Storm.dll | Yes |
Ordinal number in Storm.dll 1.00 | 79 (0x04F) |
Ordinal number in Storm.dll 1.09 | 268 (0x10C) |
Copyright (c) Ladislav Zezula 2003 - 2010