[7891] Replace harcoded array of creature family skill lines by using DBC data.
[getmangos.git] / contrib / vmap_extractor_v2 / stormlib / SCommon.h
blobb53be0ae2a85ba12fbcc58de66653c0241c8d35c
1 /*****************************************************************************/
2 /* SCommon.h Copyright (c) Ladislav Zezula 2003 */
3 /*---------------------------------------------------------------------------*/
4 /* Common functions for encryption/decryption from Storm.dll. Included by */
5 /* SFile*** functions, do not include and do not use this file directly */
6 /*---------------------------------------------------------------------------*/
7 /* Date Ver Who Comment */
8 /* -------- ---- --- ------- */
9 /* 24.03.03 1.00 Lad The first version of SFileCommon.h */
10 /* 12.06.04 1.00 Lad Renamed to SCommon.h */
11 /*****************************************************************************/
13 #ifndef __SCOMMON_H__
14 #define __SCOMMON_H__
16 //-----------------------------------------------------------------------------
17 // StormLib private defines
19 #define SFILE_TYPE_DATA 0 // Process the file as data file
20 #define SFILE_TYPE_WAVE 1 // Process the file as WAVe file
22 //-----------------------------------------------------------------------------
23 // External variables
25 extern TMPQArchive * pFirstOpen;
26 extern LCID lcLocale;
28 //-----------------------------------------------------------------------------
29 // Encryption and decryption functions
31 int PrepareStormBuffer();
33 void EncryptHashTable(DWORD * pdwTable, BYTE * pbKey, DWORD dwLength);
34 void DecryptHashTable(DWORD * pdwTable, BYTE * pbKey, DWORD dwLength);
35 TMPQHash * FindFreeHashEntry(TMPQArchive * ha, const char * szFileName);
37 void EncryptBlockTable(DWORD * pdwTable, BYTE * pbKey, DWORD dwLength);
38 void DecryptBlockTable(DWORD * pdwTable, BYTE * pbKey, DWORD dwLength);
40 DWORD DetectFileSeed(DWORD * block, DWORD decrypted);
41 DWORD DetectFileSeed2(DWORD * block, UINT nDwords, ...);
42 void EncryptMPQBlock(DWORD * pdwBlock, DWORD dwLength, DWORD dwSeed1);
43 void DecryptMPQBlock(DWORD * pdwBlock, DWORD dwLength, DWORD dwSeed1);
45 DWORD DecryptHashIndex(TMPQArchive * ha, const char * szFileName);
46 DWORD DecryptName1 (const char * szFileName);
47 DWORD DecryptName2 (const char * szFileName);
48 DWORD DecryptFileSeed (const char * szFileName);
50 TMPQHash * GetHashEntry (TMPQArchive * ha, const char * szFileName);
51 TMPQHash * GetHashEntryEx(TMPQArchive * ha, const char * szFileName, LCID lcLocale);
53 //-----------------------------------------------------------------------------
54 // Compression and decompression functions
56 int Compress_pklib (char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int dwInLength, int * pCmpType, int nCmpLevel);
57 int Decompress_pklib(char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int dwInLength);
59 //-----------------------------------------------------------------------------
60 // Checking functions
62 BOOL IsValidMpqHandle(TMPQArchive * ha);
63 BOOL IsValidFileHandle(TMPQFile * hf);
65 //-----------------------------------------------------------------------------
66 // Other functions
68 BOOL SFileOpenArchiveEx(const char * szMpqName, DWORD dwPriority, DWORD dwFlags, HANDLE * phMPQ, DWORD dwAccessMode = GENERIC_READ);
69 int AddFileToArchive(TMPQArchive * ha, HANDLE hFile, const char * szArchivedName, DWORD dwFlags, DWORD dwQuality, int nFileType, BOOL * pbReplaced);
70 int SetDataCompression(int nDataCompression);
71 int SaveMPQTables(TMPQArchive * ha);
72 void FreeMPQArchive(TMPQArchive *& ha);
74 BOOL CheckWildCard(const char * szString, const char * szWildCard);
76 //-----------------------------------------------------------------------------
77 // Listfile functions
79 int SListFileCreateListFile(TMPQArchive * ha);
80 int SListFileAddNode(TMPQArchive * ha, const char * szAddedFile);
81 int SListFileRemoveNode(TMPQArchive * ha, const char * szFileName);
82 int SListFileRenameNode(TMPQArchive * ha, const char * szOldFileName, const char * szNewFileName);
83 int SListFileFreeListFile(TMPQArchive * ha);
85 int SListFileSaveToMpq(TMPQArchive * ha);
87 #endif // __SCOMMON_H__