1 module stormlibd.Types; 2 3 // Typedefs for ANSI C 4 alias BYTE = char; 5 alias USHORT = ushort; 6 alias LONG = int; 7 alias DWORD = uint; 8 alias DWORD_PTR = ulong; 9 alias LONG_PTR = long; // min 32-bits, maybe change to int 10 alias INT_PTR = long; // min 32-bits, maybe change to int 11 alias LONGLONG = long; // 64-bits 12 alias ULONGLONG = ulong; // 64-bits 13 alias HANDLE = void*; // maybe change to Object 14 alias LPOVERLAPPED = void*; // Unsupported on Linux and Mac 15 alias TCHAR = char; // maybe change to dchar (also known as wchar_t) for support utf-16 16 alias LCID = uint; 17 alias PLONG = LONG*; 18 alias LPDWORD = DWORD*; 19 alias LPBYTE = BYTE*; 20 alias LPCTSTR = const(char)*; // or immutable char* 21 alias LPCSTR = const(char)*; // or immutable char* 22 alias LPTSTR = char*; 23 alias LPSTR = char*; 24 25 struct PSFILE_CREATE_MPQ 26 { 27 DWORD cbSize; // Size of this structure, in bytes 28 DWORD dwMpqVersion; // Version of the MPQ to be created 29 void* pvUserData; // Reserved, must be NULL 30 DWORD cbUserData; // Reserved, must be 0 31 DWORD dwStreamFlags; // Stream flags for creating the MPQ 32 DWORD dwFileFlags1; // File flags for (listfile). Use MPQ_FILE_DEFAULT_INTERNAL to set default flags 33 DWORD dwFileFlags2; // File flags for (attributes). Use MPQ_FILE_DEFAULT_INTERNAL to set default flags 34 DWORD dwFileFlags3; // File flags for (signature). Use MPQ_FILE_DEFAULT_INTERNAL to set default flags 35 DWORD dwAttrFlags; // Flags for the (attributes) file. If 0, no attributes will be created 36 DWORD dwSectorSize; // Sector size for compressed files 37 DWORD dwRawChunkSize; // Size of raw data chunk 38 DWORD dwMaxFileCount; // File limit for the MPQ 39 } 40 41 // File information classes for SFileGetFileInfo and SFileFreeFileInfo 42 43 enum SFileInfoClass { 44 // Info classes for archives 45 SFileMpqFileName, // Name of the archive file (TCHAR []) 46 SFileMpqStreamBitmap, // Array of bits, each bit means availability of one block (BYTE []) 47 SFileMpqUserDataOffset, // Offset of the user data header (ULONGLONG) 48 SFileMpqUserDataHeader, // Raw (unfixed) user data header (TMPQUserData) 49 SFileMpqUserData, // MPQ USer data, without the header (BYTE []) 50 SFileMpqHeaderOffset, // Offset of the MPQ header (ULONGLONG) 51 SFileMpqHeaderSize, // Fixed size of the MPQ header 52 SFileMpqHeader, // Raw (unfixed) archive header (TMPQHeader) 53 SFileMpqHetTableOffset, // Offset of the HET table, relative to MPQ header (ULONGLONG) 54 SFileMpqHetTableSize, // Compressed size of the HET table (ULONGLONG) 55 SFileMpqHetHeader, // HET table header (TMPQHetHeader) 56 SFileMpqHetTable, // HET table as pointer. Must be freed using SFileFreeFileInfo 57 SFileMpqBetTableOffset, // Offset of the BET table, relative to MPQ header (ULONGLONG) 58 SFileMpqBetTableSize, // Compressed size of the BET table (ULONGLONG) 59 SFileMpqBetHeader, // BET table header, followed by the flags (TMPQBetHeader + DWORD[]) 60 SFileMpqBetTable, // BET table as pointer. Must be freed using SFileFreeFileInfo 61 SFileMpqHashTableOffset, // Hash table offset, relative to MPQ header (ULONGLONG) 62 SFileMpqHashTableSize64, // Compressed size of the hash table (ULONGLONG) 63 SFileMpqHashTableSize, // Size of the hash table, in entries (DWORD) 64 SFileMpqHashTable, // Raw (unfixed) hash table (TMPQBlock []) 65 SFileMpqBlockTableOffset, // Block table offset, relative to MPQ header (ULONGLONG) 66 SFileMpqBlockTableSize64, // Compressed size of the block table (ULONGLONG) 67 SFileMpqBlockTableSize, // Size of the block table, in entries (DWORD) 68 SFileMpqBlockTable, // Raw (unfixed) block table (TMPQBlock []) 69 SFileMpqHiBlockTableOffset, // Hi-block table offset, relative to MPQ header (ULONGLONG) 70 SFileMpqHiBlockTableSize64, // Compressed size of the hi-block table (ULONGLONG) 71 SFileMpqHiBlockTable, // The hi-block table (USHORT []) 72 SFileMpqSignatures, // Signatures present in the MPQ (DWORD) 73 SFileMpqStrongSignatureOffset, // Byte offset of the strong signature, relative to begin of the file (ULONGLONG) 74 SFileMpqStrongSignatureSize, // Size of the strong signature (DWORD) 75 SFileMpqStrongSignature, // The strong signature (BYTE []) 76 SFileMpqArchiveSize64, // Archive size from the header (ULONGLONG) 77 SFileMpqArchiveSize, // Archive size from the header (DWORD) 78 SFileMpqMaxFileCount, // Max number of files in the archive (DWORD) 79 SFileMpqFileTableSize, // Number of entries in the file table (DWORD) 80 SFileMpqSectorSize, // Sector size (DWORD) 81 SFileMpqNumberOfFiles, // Number of files (DWORD) 82 SFileMpqRawChunkSize, // Size of the raw data chunk for MD5 83 SFileMpqStreamFlags, // Stream flags (DWORD) 84 SFileMpqFlags, // Nonzero if the MPQ is read only (DWORD) 85 86 // Info classes for files 87 SFileInfoPatchChain, // Chain of patches where the file is (TCHAR []) 88 SFileInfoFileEntry, // The file entry for the file (TFileEntry) 89 SFileInfoHashEntry, // Hash table entry for the file (TMPQHash) 90 SFileInfoHashIndex, // Index of the hash table entry (DWORD) 91 SFileInfoNameHash1, // The first name hash in the hash table (DWORD) 92 SFileInfoNameHash2, // The second name hash in the hash table (DWORD) 93 SFileInfoNameHash3, // 64-bit file name hash for the HET/BET tables (ULONGLONG) 94 SFileInfoLocale, // File locale (DWORD) 95 SFileInfoFileIndex, // Block index (DWORD) 96 SFileInfoByteOffset, // File position in the archive (ULONGLONG) 97 SFileInfoFileTime, // File time (ULONGLONG) 98 SFileInfoFileSize, // Size of the file (DWORD) 99 SFileInfoCompressedSize, // Compressed file size (DWORD) 100 SFileInfoFlags, // File flags from (DWORD) 101 SFileInfoEncryptionKey, // File encryption key 102 SFileInfoEncryptionKeyRaw, // Unfixed value of the file key 103 SFileInfoCRC32 // CRC32 of the file 104 } 105 106 // void * pvUserData, ULONGLONG ByteOffset, DWORD dwTotalBytes 107 extern(C) alias SFILE_DOWNLOAD_CALLBACK = void function(void*, ULONGLONG, DWORD); 108 // void * pvUserData, DWORD dwBytesWritten, DWORD dwTotalBytes, bool bFinalCall 109 extern(C) alias SFILE_ADDFILE_CALLBACK = void function(void*, DWORD, DWORD, bool); 110 // void * pvUserData, DWORD dwWorkType, ULONGLONG BytesProcessed, ULONGLONG TotalBytes 111 extern(C) alias SFILE_COMPACT_CALLBACK = void function(void*, DWORD, ULONGLONG, ULONGLONG); 112