-
Notifications
You must be signed in to change notification settings - Fork 0
/
SFmpqapi.odl
288 lines (264 loc) · 11.7 KB
/
SFmpqapi.odl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
// License information for this code is in license.txt
[ uuid(CF183E40-8316-11d6-9E07-00A0C9199875), version(1.08),
helpstring("ShadowFlare MPQ API Library v1.08")]
library SFMPQAPI
{
#define WINAPI __stdcall
#define HANDLE long
#define MPQHANDLE HANDLE
#define DWORD long
#define LPDWORD DWORD *
#define LCID DWORD
#define PLONG LONG *
#define LPVOID LPSTR
#define BOOL boolean
typedef struct _OVERLAPPED {
DWORD Internal;
DWORD InternalHigh;
DWORD Offset;
DWORD OffsetHigh;
HANDLE hEvent;
} OVERLAPPED;
//#define LPOVERLAPPED OVERLAPPED *
#define LPOVERLAPPED long
typedef struct _SFMPQVERSION {
WORD Major;
WORD Minor;
WORD Revision;
WORD Subrevision;
} SFMPQVERSION;
typedef struct _FILELISTENTRY {
DWORD dwFileExists; // Nonzero if this entry is used
LCID lcLocale; // Locale ID of file
DWORD dwCompressedSize; // Compressed size of file
DWORD dwFullSize; // Uncompressed size of file
DWORD dwFlags; // Flags for file
char szFileName[260];
} FILELISTENTRY;
//[uuid(CF183E43-8316-11d6-9E07-00A0C9199875)]
[helpstring("General error codes")]
typedef enum {
MPQ_ERROR_MPQ_INVALID = 0x85200065,
MPQ_ERROR_FILE_NOT_FOUND = 0x85200066,
MPQ_ERROR_DISK_FULL = 0x85200068,
MPQ_ERROR_HASH_TABLE_FULL = 0x85200069,
MPQ_ERROR_ALREADY_EXISTS = 0x8520006A,
MPQ_ERROR_BAD_OPEN_MODE = 0x8520006C,
MPQ_ERROR_COMPACT_ERROR = 0x85300001,
} Error_Constants;
[helpstring("MpqOpenArchiveForUpdate flags")]
typedef enum {
MOAU_CREATE_NEW = 0x00,
MOAU_CREATE_ALWAYS = 0x08,
MOAU_OPEN_EXISTING = 0x04,
MOAU_OPEN_ALWAYS = 0x20,
MOAU_READ_ONLY = 0x10,
MOAU_MAINTAIN_ATTRIBUTES=0x02,
MOAU_MAINTAIN_LISTFILE =0x01,
} MpqOpenArchiveForUpdate_Flags;
[helpstring("MpqAddFileToArchive flags")]
typedef enum {
MAFA_EXISTS = 0x80000000,
MAFA_UNKNOWN40000000 = 0x40000000,
MAFA_MODCRYPTKEY = 0x00020000,
MAFA_ENCRYPT = 0x00010000,
MAFA_COMPRESS = 0x00000200,
MAFA_COMPRESS2 = 0x00000100,
MAFA_REPLACE_EXISTING =0x00000001,
} MpqAddFileToArchive_Flags;
[helpstring("MpqAddFileToArchiveEx compression flags")]
typedef enum {
MAFA_COMPRESS_STANDARD = 0x08,
MAFA_COMPRESS_DEFLATE = 0x02,
MAFA_COMPRESS_WAVE = 0x81,
MAFA_COMPRESS_WAVE2 = 0x41,
MAFA_COMPRESS_WAVECOMP1 = 0x80,
MAFA_COMPRESS_WAVECOMP2 = 0x40,
MAFA_COMPRESS_WAVECOMP3 = 0x01,
} MpqAddFileToArchiveEx_Compression_Types;
[helpstring("Deflate compression level constants")]
typedef enum {
Z_NO_COMPRESSION = 0,
Z_BEST_SPEED = 1,
Z_BEST_COMPRESSION = 9,
Z_DEFAULT_COMPRESSION = (-1),
} Deflate_Compress_Level;
[helpstring("MpqAddWaveToArchive quality flags")]
typedef enum {
MAWA_QUALITY_HIGH = 1,
MAWA_QUALITY_MEDIUM = 0,
MAWA_QUALITY_LOW = 2,
} MpqAddWaveToArchive_Quality;
[helpstring("SFileGetFileInfo flags")]
typedef enum {
SFILE_INFO_BLOCK_SIZE = 0x01,
SFILE_INFO_HASH_TABLE_SIZE =0x02,
SFILE_INFO_NUM_FILES = 0x03,
SFILE_INFO_TYPE = 0x04,
SFILE_INFO_SIZE = 0x05,
SFILE_INFO_COMPRESSED_SIZE =0x06,
SFILE_INFO_FLAGS = 0x07,
SFILE_INFO_PARENT = 0x08,
SFILE_INFO_POSITION = 0x09,
SFILE_INFO_LOCALEID = 0x0A,
SFILE_INFO_PRIORITY = 0x0B,
SFILE_INFO_HASH_INDEX = 0x0C,
} SFileGetFileInfo_Flags;
[helpstring("SFileListFiles flags")]
typedef enum {
SFILE_LIST_MEMORY_LIST =0x01,
SFILE_LIST_ONLY_KNOWN =0x02,
SFILE_LIST_ONLY_UNKNOWN =0x04,
} SFileListFiles_Flags;
[helpstring("Handle type constants")]
typedef enum {
SFILE_TYPE_MPQ = 0x01,
SFILE_TYPE_FILE =0x02,
} Handle_Type_Constants;
[helpstring("SFileOpenArchive flags")]
typedef enum {
SFILE_OPEN_HARD_DISK_FILE =0x0000,
SFILE_OPEN_CD_ROM_FILE = 0x0001,
SFILE_OPEN_ALLOW_WRITE = 0x8000,
} SFileOpenArchive_Flags;
[helpstring("SFileOpenFileEx flags")]
typedef enum {
SFILE_SEARCH_CURRENT_ONLY =0x00,
SFILE_SEARCH_ALL_OPEN = 0x01
} SFileOpenFileEx_Flags;
[helpstring("Other misc. flags and constants")]
typedef enum {
INVALID_HANDLE_VALUE = 0xFFFFFFFF,
} Other;
[helpstring("SFileSetFilePointer move methods")]
typedef enum {
FILE_BEGIN = 0,
FILE_CURRENT = 1,
FILE_END = 2
} SFileSetFilePointer_Move_Methods;
[helpstring("Windows defined error codes")]
typedef enum {
ERROR_SUCCESS = 0,
NO_ERROR = 0,
ERROR_FILE_NOT_FOUND = 2,
ERROR_OUTOFMEMORY = 14,
ERROR_INVALID_PARAMETER = 87,
ERROR_DISK_FULL = 112,
ERROR_ALREADY_EXISTS = 183,
ERROR_FILE_INVALID = 1006,
ERROR_UNKNOWN_PROPERTY = 1608
} WinErrors;
[dllname("sfmpq.dll")]
[helpstring("Version and other misc. functions")]
module SFMpq
{
[entry("MpqInitialize"),helpstring("MpqInitialize does nothing; it is only provided for compatibility with MPQ archivers that use lmpqapi.")]
BOOL WINAPI MpqInitialize();
[entry("MpqGetVersionString"),helpstring("")]
LPCSTR WINAPI MpqGetVersionString();
[entry("MpqGetVersion"),helpstring("")]
float WINAPI MpqGetVersion();
[entry("SFMpqDestroy"),helpstring("This no longer needs to be called; it is only provided for compatibility with older versions")]
void WINAPI SFMpqDestroy();
[entry("SFMpqGetVersionString"),helpstring("")]
LPCSTR WINAPI SFMpqGetVersionString();
[entry("SFMpqGetVersionString2"),helpstring("SFMpqGetVersionString2's return value is the required length of the buffer plus the terminating null, so use SFMpqGetVersionString2(0, 0) to get the length.")]
DWORD WINAPI SFMpqGetVersionString2(LPCSTR lpBuffer, DWORD dwBufferLength);
[entry("SFMpqGetVersion"),helpstring("")]
SFMPQVERSION WINAPI SFMpqGetVersion();
[entry("SFMpqCompareVersion"),helpstring("Returns 0 if the dll version is equal to the version your program was compiled with, 1 if the dll is newer, -1 if the dll is older.")]
long SFMpqCompareVersion();
};
[helpstring("Storm SFile emulated functions")]
module SFile
{
[entry("SFileOpenArchive"),helpstring("")]
BOOL WINAPI SFileOpenArchive(LPCSTR lpFileName, DWORD dwPriority, DWORD dwFlags, MPQHANDLE *hMPQ);
[entry("SFileCloseArchive"),helpstring("")]
BOOL WINAPI SFileCloseArchive(MPQHANDLE hMPQ);
[entry("SFileOpenFileAsArchive"),helpstring("")]
BOOL WINAPI SFileOpenFileAsArchive(MPQHANDLE hSourceMPQ, LPCSTR lpFileName, DWORD dwPriority, DWORD dwFlags, MPQHANDLE *hMPQ);
[entry("SFileGetArchiveName"),helpstring("")]
BOOL WINAPI SFileGetArchiveName(MPQHANDLE hMPQ, LPCSTR lpBuffer, DWORD dwBufferLength);
[entry("SFileOpenFile"),helpstring("")]
BOOL WINAPI SFileOpenFile(LPCSTR lpFileName, MPQHANDLE *hFile);
[entry("SFileOpenFileEx"),helpstring("")]
BOOL WINAPI SFileOpenFileEx(MPQHANDLE hMPQ, LPCSTR lpFileName, DWORD dwSearchScope, MPQHANDLE *hFile);
[entry("SFileCloseFile"),helpstring("")]
BOOL WINAPI SFileCloseFile(MPQHANDLE hFile);
[entry("SFileGetFileSize"),helpstring("")]
DWORD WINAPI SFileGetFileSize(MPQHANDLE hFile, LPDWORD lpFileSizeHigh);
[entry("SFileGetFileArchive"),helpstring("")]
BOOL WINAPI SFileGetFileArchive(MPQHANDLE hFile, MPQHANDLE *hMPQ);
[entry("SFileGetFileName"),helpstring("")]
BOOL WINAPI SFileGetFileName(MPQHANDLE hFile, LPCSTR lpBuffer, DWORD dwBufferLength);
[entry("SFileSetFilePointer"),helpstring("")]
DWORD WINAPI SFileSetFilePointer(MPQHANDLE hFile, long lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod);
[entry("SFileReadFile"),helpstring("")]
BOOL WINAPI SFileReadFile(MPQHANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,LPOVERLAPPED lpOverlapped);
[entry("SFileReadFile"),helpstring("")]
BOOL WINAPI SFileReadFileB(MPQHANDLE hFile,byte *lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,LPOVERLAPPED lpOverlapped);
[entry("SFileSetLocale"),helpstring("")]
LCID WINAPI SFileSetLocale(LCID nNewLocale);
[entry("SFileGetBasePath"),helpstring("")]
BOOL WINAPI SFileGetBasePath(LPCSTR lpBuffer, DWORD dwBufferLength);
[entry("SFileSetBasePath"),helpstring("")]
BOOL WINAPI SFileSetBasePath(LPCSTR lpNewBasePath);
[entry("SFileGetFileInfo"),helpstring("")]
DWORD WINAPI SFileGetFileInfo(MPQHANDLE hFile, DWORD dwInfoType);
[entry("SFileSetArchivePriority"),helpstring("")]
BOOL WINAPI SFileSetArchivePriority(MPQHANDLE hMPQ, DWORD dwPriority);
[entry("SFileFindMpqHeader"),helpstring("")]
DWORD WINAPI SFileFindMpqHeader(HANDLE hFile);
[entry("SFileListFiles"),helpstring("")]
BOOL WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELISTENTRY *lpListBuffer, DWORD dwFlags);
[entry("SFileDestroy"),helpstring("")]
BOOL WINAPI SFileDestroy();
[entry("StormDestroy"),helpstring("")]
void WINAPI StormDestroy();
};
[helpstring("MPQ archive creation and editing functions")]
module MPQ
{
[entry("MpqOpenArchiveForUpdate"),helpstring("")]
MPQHANDLE WINAPI MpqOpenArchiveForUpdate(LPCSTR lpFileName, DWORD dwFlags, DWORD dwMaximumFilesInArchive);
[entry("MpqCloseUpdatedArchive"),helpstring("")]
DWORD WINAPI MpqCloseUpdatedArchive(MPQHANDLE hMPQ, DWORD dwUnknown2);
[entry("MpqAddFileToArchive"),helpstring("")]
BOOL WINAPI MpqAddFileToArchive(MPQHANDLE hMPQ, LPCSTR lpSourceFileName, LPCSTR lpDestFileName, DWORD dwFlags);
[entry("MpqAddWaveToArchive"),helpstring("")]
BOOL WINAPI MpqAddWaveToArchive(MPQHANDLE hMPQ, LPCSTR lpSourceFileName, LPCSTR lpDestFileName, DWORD dwFlags, DWORD dwQuality);
[entry("MpqRenameFile"),helpstring("")]
BOOL WINAPI MpqRenameFile(MPQHANDLE hMPQ, LPCSTR lpcOldFileName, LPCSTR lpcNewFileName);
[entry("MpqDeleteFile"),helpstring("")]
BOOL WINAPI MpqDeleteFile(MPQHANDLE hMPQ, LPCSTR lpFileName);
[entry("MpqCompactArchive"),helpstring("")]
BOOL WINAPI MpqCompactArchive(MPQHANDLE hMPQ);
[entry("MpqAddFileToArchiveEx"),helpstring("")]
BOOL WINAPI MpqAddFileToArchiveEx(MPQHANDLE hMPQ, LPCSTR lpSourceFileName, LPCSTR lpDestFileName, DWORD dwFlags, DWORD dwCompressionType, DWORD dwCompressLevel);
[entry("MpqAddFileFromBufferEx"),helpstring("")]
BOOL WINAPI MpqAddFileFromBufferEx(MPQHANDLE hMPQ, LPVOID lpBuffer, DWORD dwLength, LPCSTR lpFileName, DWORD dwFlags, DWORD dwCompressionType, DWORD dwCompressLevel);
[entry("MpqAddFileFromBufferEx"),helpstring("")]
BOOL WINAPI MpqAddFileFromBufferExB(MPQHANDLE hMPQ, byte *lpBuffer, DWORD dwLength, LPCSTR lpFileName, DWORD dwFlags, DWORD dwCompressionType, DWORD dwCompressLevel);
[entry("MpqAddFileFromBuffer"),helpstring("")]
BOOL WINAPI MpqAddFileFromBuffer(MPQHANDLE hMPQ, LPVOID lpBuffer, DWORD dwLength, LPCSTR lpFileName, DWORD dwFlags);
[entry("MpqAddFileFromBuffer"),helpstring("")]
BOOL WINAPI MpqAddFileFromBufferB(MPQHANDLE hMPQ, byte *lpBuffer, DWORD dwLength, LPCSTR lpFileName, DWORD dwFlags);
[entry("MpqAddWaveFromBuffer"),helpstring("")]
BOOL WINAPI MpqAddWaveFromBuffer(MPQHANDLE hMPQ, LPVOID lpBuffer, DWORD dwLength, LPCSTR lpFileName, DWORD dwFlags, DWORD dwQuality);
[entry("MpqAddWaveFromBuffer"),helpstring("")]
BOOL WINAPI MpqAddWaveFromBufferB(MPQHANDLE hMPQ, byte *lpBuffer, DWORD dwLength, LPCSTR lpFileName, DWORD dwFlags, DWORD dwQuality);
[entry("MpqRenameAndSetFileLocale"),helpstring("")]
BOOL WINAPI MpqRenameAndSetFileLocale(MPQHANDLE hMPQ, LPCSTR lpcOldFileName, LPCSTR lpcNewFileName, LCID nOldLocale, LCID nNewLocale);
[entry("MpqDeleteFileWithLocale"),helpstring("")]
BOOL WINAPI MpqDeleteFileWithLocale(MPQHANDLE hMPQ, LPCSTR lpFileName, LCID nLocale);
[entry("MpqSetFileLocale"),helpstring("")]
BOOL WINAPI MpqSetFileLocale(MPQHANDLE hMPQ, LPCSTR lpFileName, LCID nOldLocale, LCID nNewLocale);
};
[dllname("kernel32.dll")]
module LastError
{
[entry("GetLastError"),helpstring("")]
DWORD WINAPI GetLastError();
};
};