TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CascCommon.h File Reference
#include "zlib/zlib.h"
#include "CascPort.h"
#include "common/Common.h"
#include "common/DynamicArray.h"
#include "common/Map.h"
#include "common/FileStream.h"
#include "common/Directory.h"
#include "common/ListFile.h"
#include "common/DumpContext.h"
#include "common/RootHandler.h"
#include "libtomcrypt/src/headers/tomcrypt.h"
#include "jenkins/lookup.h"
+ Include dependency graph for CascCommon.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _ENCODING_KEY
 
struct  _CASC_INDEX_ENTRY
 
struct  _CASC_MAPPING_TABLE
 
struct  _CASC_FILE_FRAME
 
struct  _CASC_ENCODING_HEADER
 
struct  _CASC_ENCODING_ENTRY
 
struct  _CASC_ENCODING_ENTRY_1
 
struct  _TCascStorage
 
struct  _TCascFile
 
struct  _TCascSearch
 

Macros

#define CASC_GAME_HOTS   0x00010000
 
#define CASC_GAME_WOW6   0x00020000
 
#define CASC_GAME_DIABLO3   0x00030000
 
#define CASC_GAME_OVERWATCH   0x00040000
 
#define CASC_GAME_STARCRAFT2   0x00050000
 
#define CASC_GAME_MASK   0xFFFF0000
 
#define CASC_INDEX_COUNT   0x10
 
#define CASC_FILE_KEY_SIZE   0x09
 
#define CASC_MAX_DATA_FILES   0x100
 
#define CASC_EXTRA_FILES   0x20
 
#define CASC_SEARCH_HAVE_NAME   0x0001
 
#define BLTE_HEADER_SIGNATURE   0x45544C42
 
#define BLTE_HEADER_DELTA   0x1E
 
#define MAX_HEADER_AREA_SIZE   0x2A
 
#define CASCLIB_MIN(a, b)   ((a < b) ? a : b)
 
#define CASCLIB_MAX(a, b)   ((a > b) ? a : b)
 
#define CASCLIB_UNUSED(p)   ((void)(p))
 
#define CASC_PACKAGE_BUFFER   0x1000
 
#define _maxchars(buff)   ((sizeof(buff) / sizeof(buff[0])) - 1)
 
#define GET_INDEX_KEY(pEncodingEntry)   (pEncodingEntry->EncodingKey + MD5_HASH_SIZE)
 
#define FAKE_ENCODING_ENTRY_SIZE   (sizeof(CASC_ENCODING_ENTRY) + MD5_HASH_SIZE)
 
#define CASC_REALLOC(type, ptr, count)   (type *)realloc(ptr, (count) * sizeof(type))
 
#define CASC_ALLOC(type, count)   (type *)malloc((count) * sizeof(type))
 
#define CASC_FREE(ptr)   free(ptr)
 

Typedefs

typedef enum _CBLD_TYPE CBLD_TYPE
 
typedef enum _CBLD_TYPEPCBLD_TYPE
 
typedef struct _ENCODING_KEY ENCODING_KEY
 
typedef struct _ENCODING_KEYPENCODING_KEY
 
typedef struct _CASC_INDEX_ENTRY CASC_INDEX_ENTRY
 
typedef struct _CASC_INDEX_ENTRYPCASC_INDEX_ENTRY
 
typedef struct _CASC_MAPPING_TABLE CASC_MAPPING_TABLE
 
typedef struct
_CASC_MAPPING_TABLE
PCASC_MAPPING_TABLE
 
typedef struct _CASC_FILE_FRAME CASC_FILE_FRAME
 
typedef struct _CASC_FILE_FRAMEPCASC_FILE_FRAME
 
typedef struct
_CASC_ENCODING_HEADER 
CASC_ENCODING_HEADER
 
typedef struct
_CASC_ENCODING_HEADER
PCASC_ENCODING_HEADER
 
typedef struct _CASC_ENCODING_ENTRY CASC_ENCODING_ENTRY
 
typedef struct
_CASC_ENCODING_ENTRY
PCASC_ENCODING_ENTRY
 
typedef struct
_CASC_ENCODING_ENTRY_1 
CASC_ENCODING_ENTRY_1
 
typedef struct
_CASC_ENCODING_ENTRY_1
PCASC_ENCODING_ENTRY_1
 
typedef struct _TCascStorage TCascStorage
 
typedef struct _TCascFile TCascFile
 
typedef struct _TCascSearch TCascSearch
 

Enumerations

enum  _CBLD_TYPE { CascBuildNone = 0, CascBuildInfo, CascBuildDb }
 

Functions

DWORD ConvertBytesToInteger_3 (LPBYTE ValueAsBytes)
 
DWORD ConvertBytesToInteger_4 (LPBYTE ValueAsBytes)
 
DWORD ConvertBytesToInteger_4_LE (LPBYTE ValueAsBytes)
 
ULONGLONG ConvertBytesToInteger_5 (LPBYTE ValueAsBytes)
 
void ConvertIntegerToBytes_4 (DWORD Value, LPBYTE ValueAsBytes)
 
void FreeCascBlob (PQUERY_KEY pQueryKey)
 
int LoadBuildInfo (TCascStorage *hs)
 
int CheckGameDirectory (TCascStorage *hs, TCHAR *szDirectory)
 
int GetRootVariableIndex (const char *szLinePtr, const char *szLineEnd, const char *szVariableName, int *PtrIndex)
 
int ParseRootFileLine (const char *szLinePtr, const char *szLineEnd, int nFileNameIndex, PQUERY_KEY pEncodingKey, char *szFileName, size_t nMaxChars)
 
TCascStorageIsValidStorageHandle (HANDLE hStorage)
 
TCascFileIsValidFileHandle (HANDLE hFile)
 
PCASC_ENCODING_ENTRY FindEncodingEntry (TCascStorage *hs, PQUERY_KEY pEncodingKey, PDWORD PtrIndex)
 
PCASC_INDEX_ENTRY FindIndexEntry (TCascStorage *hs, PQUERY_KEY pIndexKey)
 
int CascDecompress (LPBYTE pvOutBuffer, PDWORD pcbOutBuffer, LPBYTE pvInBuffer, DWORD cbInBuffer)
 
int CascDecrypt (LPBYTE pbOutBuffer, PDWORD pcbOutBuffer, LPBYTE pbInBuffer, DWORD cbInBuffer, DWORD dwFrameIndex)
 
int CascDirectCopy (LPBYTE pbOutBuffer, PDWORD pcbOutBuffer, LPBYTE pbInBuffer, DWORD cbInBuffer)
 
int RootHandler_CreateMNDX (TCascStorage *hs, LPBYTE pbRootFile, DWORD cbRootFile)
 
int RootHandler_CreateDiablo3 (TCascStorage *hs, LPBYTE pbRootFile, DWORD cbRootFile)
 
int RootHandler_CreateOverwatch (TCascStorage *hs, LPBYTE pbRootFile, DWORD cbRootFile)
 
int RootHandler_CreateWoW6 (TCascStorage *hs, LPBYTE pbRootFile, DWORD cbRootFile, DWORD dwLocaleMask)
 

Macro Definition Documentation

#define _maxchars (   buff)    ((sizeof(buff) / sizeof(buff[0])) - 1)
#define BLTE_HEADER_DELTA   0x1E
#define BLTE_HEADER_SIGNATURE   0x45544C42
#define CASC_ALLOC (   type,
  count 
)    (type *)malloc((count) * sizeof(type))
#define CASC_EXTRA_FILES   0x20
#define CASC_FILE_KEY_SIZE   0x09
#define CASC_FREE (   ptr)    free(ptr)
#define CASC_GAME_DIABLO3   0x00030000
#define CASC_GAME_HOTS   0x00010000
#define CASC_GAME_MASK   0xFFFF0000
#define CASC_GAME_OVERWATCH   0x00040000
#define CASC_GAME_STARCRAFT2   0x00050000
#define CASC_GAME_WOW6   0x00020000
#define CASC_INDEX_COUNT   0x10
#define CASC_MAX_DATA_FILES   0x100
#define CASC_PACKAGE_BUFFER   0x1000
#define CASC_REALLOC (   type,
  ptr,
  count 
)    (type *)realloc(ptr, (count) * sizeof(type))
#define CASC_SEARCH_HAVE_NAME   0x0001
#define CASCLIB_MAX (   a,
 
)    ((a > b) ? a : b)
#define CASCLIB_MIN (   a,
 
)    ((a < b) ? a : b)
#define CASCLIB_UNUSED (   p)    ((void)(p))
#define FAKE_ENCODING_ENTRY_SIZE   (sizeof(CASC_ENCODING_ENTRY) + MD5_HASH_SIZE)
#define GET_INDEX_KEY (   pEncodingEntry)    (pEncodingEntry->EncodingKey + MD5_HASH_SIZE)
#define MAX_HEADER_AREA_SIZE   0x2A

Typedef Documentation

typedef enum _CBLD_TYPE CBLD_TYPE
typedef struct _ENCODING_KEY ENCODING_KEY
typedef enum _CBLD_TYPE * PCBLD_TYPE
typedef struct _ENCODING_KEY * PENCODING_KEY
typedef struct _TCascFile TCascFile
typedef struct _TCascSearch TCascSearch
typedef struct _TCascStorage TCascStorage

Enumeration Type Documentation

enum _CBLD_TYPE
Enumerator
CascBuildNone 
CascBuildInfo 
CascBuildDb 
90 {
91  CascBuildNone = 0, // No build type found
92  CascBuildInfo, // .build.info
93  CascBuildDb, // .build.db (older storages)
Definition: CascCommon.h:92
Definition: CascCommon.h:93
Definition: CascCommon.h:91
enum _CBLD_TYPE CBLD_TYPE
enum _CBLD_TYPE * PCBLD_TYPE

Function Documentation

int CascDecompress ( LPBYTE  pvOutBuffer,
PDWORD  pcbOutBuffer,
LPBYTE  pvInBuffer,
DWORD  cbInBuffer 
)
19 {
20  z_stream z; // Stream information for zlib
21  int nResult;
22 
23  // Fill the stream structure for zlib
24  z.next_in = pbInBuffer;
25  z.avail_in = cbInBuffer;
26  z.total_in = cbInBuffer;
27  z.next_out = pbOutBuffer;
28  z.avail_out = *pcbOutBuffer;
29  z.total_out = 0;
30  z.zalloc = NULL;
31  z.zfree = NULL;
32 
33  // Initialize the decompression structure
34  if((nResult = inflateInit(&z)) == Z_OK)
35  {
36  // Call zlib to decompress the data
37  nResult = inflate(&z, Z_NO_FLUSH);
38  inflateEnd(&z);
39 
40  // Give the size of the uncompressed data
41  *pcbOutBuffer = z.total_out;
42  }
43 
44  // Return an error code
45  return (nResult == Z_OK || nResult == Z_STREAM_END) ? ERROR_SUCCESS : ERROR_FILE_CORRUPT;
46 }
#define Z_NO_FLUSH
Definition: zlib.h:164
uInt avail_in
Definition: zlib.h:87
#define ERROR_FILE_CORRUPT
Definition: CascPort.h:218
arena_t NULL
Definition: jemalloc_internal.h:624
free_func zfree
Definition: zlib.h:98
uLong total_in
Definition: zlib.h:88
G3D::int16 z
Definition: Vector3int16.h:46
#define Z_STREAM_END
Definition: zlib.h:174
alloc_func zalloc
Definition: zlib.h:97
Bytef * next_out
Definition: zlib.h:90
uLong total_out
Definition: zlib.h:92
#define inflateInit(strm)
Definition: zlib.h:1649
uInt avail_out
Definition: zlib.h:91
z_const Bytef * next_in
Definition: zlib.h:86
#define Z_OK
Definition: zlib.h:173
Definition: zlib.h:85
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the caller graph for this function:

int CascDecrypt ( LPBYTE  pbOutBuffer,
PDWORD  pcbOutBuffer,
LPBYTE  pbInBuffer,
DWORD  cbInBuffer,
DWORD  dwFrameIndex 
)
206 {
207  ULONGLONG KeyName = 0;
208  LPBYTE pbBufferEnd = pbInBuffer + cbInBuffer;
209  LPBYTE pbKey;
210  DWORD KeyNameSize;
211  DWORD dwShift = 0;
212  DWORD IVSize;
213  BYTE Vector[0x08];
214  BYTE EncryptionType;
215  int nError;
216 
217  // Verify and retrieve the key name size
218  if(pbInBuffer >= pbBufferEnd)
219  return ERROR_FILE_CORRUPT;
220  if(pbInBuffer[0] != 0 && pbInBuffer[0] != 8)
221  return ERROR_NOT_SUPPORTED;
222  KeyNameSize = *pbInBuffer++;
223 
224  // Copy the key name
225  if((pbInBuffer + KeyNameSize) >= pbBufferEnd)
226  return ERROR_FILE_CORRUPT;
227  memcpy(&KeyName, pbInBuffer, KeyNameSize);
228  pbInBuffer += KeyNameSize;
229 
230  // Verify and retrieve the Vector size
231  if(pbInBuffer >= pbBufferEnd)
232  return ERROR_FILE_CORRUPT;
233  if(pbInBuffer[0] != 4 && pbInBuffer[0] != 8)
234  return ERROR_NOT_SUPPORTED;
235  IVSize = *pbInBuffer++;
236 
237  // Copy the initialization vector
238  if((pbInBuffer + IVSize) >= pbBufferEnd)
239  return ERROR_FILE_CORRUPT;
240  memset(Vector, 0, sizeof(Vector));
241  memcpy(Vector, pbInBuffer, IVSize);
242  pbInBuffer += IVSize;
243 
244  // Verify and retrieve the encryption type
245  if(pbInBuffer >= pbBufferEnd)
246  return ERROR_FILE_CORRUPT;
247  if(pbInBuffer[0] != 'S' && pbInBuffer[0] != 'A')
248  return ERROR_NOT_SUPPORTED;
249  EncryptionType = *pbInBuffer++;
250 
251  // Do we have enough space in the output buffer?
252  if((DWORD)(pbBufferEnd - pbInBuffer) > pcbOutBuffer[0])
254 
255  // Check if we know the key
256  pbKey = FindCascKey(KeyName);
257  if(pbKey == NULL)
258  return ERROR_UNKNOWN_FILE_KEY;
259 
260  // Shuffle the Vector with the block index
261  // Note that there's no point to go beyond 32 bits, unless the file has
262  // more than 0xFFFFFFFF frames.
263  for(int i = 0; i < sizeof(dwFrameIndex); i++)
264  {
265  Vector[i] = Vector[i] ^ (BYTE)((dwFrameIndex >> dwShift) & 0xFF);
266  dwShift += 8;
267  }
268 
269  // Perform the decryption-specific action
270  switch(EncryptionType)
271  {
272  case 'S': // Salsa20
273  nError = Decrypt_Salsa20(pbOutBuffer, pbInBuffer, (pbBufferEnd - pbInBuffer), pbKey, 0x10, Vector);
274  if(nError != ERROR_SUCCESS)
275  return nError;
276 
277  // Supply the size of the output buffer
278  pcbOutBuffer[0] = (DWORD)(pbBufferEnd - pbInBuffer);
279  return ERROR_SUCCESS;
280 
281 // case 'A':
282 // return ERROR_NOT_SUPPORTED;
283  }
284 
285  assert(false);
286  return ERROR_NOT_SUPPORTED;
287 }
unsigned long long ULONGLONG
Definition: CascPort.h:144
#define ERROR_UNKNOWN_FILE_KEY
Definition: CascLib.h:35
#define ERROR_INSUFFICIENT_BUFFER
Definition: CascPort.h:213
#define ERROR_FILE_CORRUPT
Definition: CascPort.h:218
arena_t NULL
Definition: jemalloc_internal.h:624
BYTE * LPBYTE
Definition: CascPort.h:152
static LPBYTE FindCascKey(ULONGLONG KeyName)
Definition: CascDecrypt.cpp:68
unsigned int DWORD
Definition: CascPort.h:139
static int Decrypt_Salsa20(LPBYTE pbOutBuffer, LPBYTE pbInBuffer, size_t cbInBuffer, LPBYTE pbKey, DWORD cbKeySize, LPBYTE pbVector)
Definition: CascDecrypt.cpp:194
#define ERROR_NOT_SUPPORTED
Definition: CascPort.h:209
unsigned char BYTE
Definition: CascPort.h:136
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int CascDirectCopy ( LPBYTE  pbOutBuffer,
PDWORD  pcbOutBuffer,
LPBYTE  pbInBuffer,
DWORD  cbInBuffer 
)
290 {
291  // Check the buffer size
292  if((cbInBuffer - 1) > pcbOutBuffer[0])
294 
295  // Copy the data
296  memcpy(pbOutBuffer, pbInBuffer, cbInBuffer);
297  pcbOutBuffer[0] = cbInBuffer;
298  return ERROR_SUCCESS;
299 }
#define ERROR_INSUFFICIENT_BUFFER
Definition: CascPort.h:213
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the caller graph for this function:

int CheckGameDirectory ( TCascStorage hs,
TCHAR szDirectory 
)
910 {
911  TFileStream * pStream;
912  TCHAR * szBuildFile;
913  int nError = ERROR_FILE_NOT_FOUND;
914 
915  // Try to find any of the root files used in the history
916  for(size_t i = 0; BuildTypes[i].szFileName != NULL; i++)
917  {
918  // Create the full name of the .agent.db file
919  szBuildFile = CombinePath(szDirectory, BuildTypes[i].szFileName);
920  if(szBuildFile != NULL)
921  {
922  // Attempt to open the file
923  pStream = FileStream_OpenFile(szBuildFile, 0);
924  if(pStream != NULL)
925  {
926  // Free the stream
927  FileStream_Close(pStream);
928 
929  // Check for the data directory
930  nError = CheckDataDirectory(hs, szDirectory);
931  if(nError == ERROR_SUCCESS)
932  {
933  hs->szBuildFile = szBuildFile;
935  return ERROR_SUCCESS;
936  }
937  }
938 
939  CASC_FREE(szBuildFile);
940  }
941  }
942 
943  return nError;
944 }
CBLD_TYPE BuildFileType
Definition: CascCommon.h:201
arena_t NULL
Definition: jemalloc_internal.h:624
char TCHAR
Definition: CascPort.h:148
const TCHAR * szFileName
Definition: CascFiles.cpp:26
#define CASC_FREE(ptr)
Definition: CascCommon.h:303
TCHAR * CombinePath(const TCHAR *szDirectory, const TCHAR *szSubDir)
Definition: Common.cpp:157
#define ERROR_FILE_NOT_FOUND
Definition: CascPort.h:205
static const TBuildFileInfo BuildTypes[]
Definition: CascFiles.cpp:37
TCHAR * szBuildFile
Definition: CascCommon.h:192
void FileStream_Close(TFileStream *pStream)
Definition: FileStream.cpp:2707
TFileStream * FileStream_OpenFile(const TCHAR *szFileName, DWORD dwStreamFlags)
Definition: FileStream.cpp:2384
CBLD_TYPE BuildFileType
Definition: CascFiles.cpp:27
static int CheckDataDirectory(TCascStorage *hs, TCHAR *szDirectory)
Definition: CascFiles.cpp:795
Definition: FileStream.h:153
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DWORD ConvertBytesToInteger_3 ( LPBYTE  ValueAsBytes)
20 {
21  DWORD Value = 0;
22 
23  Value = (Value << 0x08) | ValueAsBytes[0];
24  Value = (Value << 0x08) | ValueAsBytes[1];
25  Value = (Value << 0x08) | ValueAsBytes[2];
26 
27  return Value;
28 }
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:1706
unsigned int DWORD
Definition: CascPort.h:139

+ Here is the caller graph for this function:

DWORD ConvertBytesToInteger_4 ( LPBYTE  ValueAsBytes)
32 {
33  DWORD Value = 0;
34 
35  Value = (Value << 0x08) | ValueAsBytes[0];
36  Value = (Value << 0x08) | ValueAsBytes[1];
37  Value = (Value << 0x08) | ValueAsBytes[2];
38  Value = (Value << 0x08) | ValueAsBytes[3];
39 
40  return Value;
41 }
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:1706
unsigned int DWORD
Definition: CascPort.h:139

+ Here is the caller graph for this function:

DWORD ConvertBytesToInteger_4_LE ( LPBYTE  ValueAsBytes)
44 {
45  DWORD Value = 0;
46 
47  Value = (Value << 0x08) | ValueAsBytes[3];
48  Value = (Value << 0x08) | ValueAsBytes[2];
49  Value = (Value << 0x08) | ValueAsBytes[1];
50  Value = (Value << 0x08) | ValueAsBytes[0];
51 
52  return Value;
53 }
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:1706
unsigned int DWORD
Definition: CascPort.h:139

+ Here is the caller graph for this function:

ULONGLONG ConvertBytesToInteger_5 ( LPBYTE  ValueAsBytes)
57 {
58  ULONGLONG Value = 0;
59 
60  Value = (Value << 0x08) | ValueAsBytes[0];
61  Value = (Value << 0x08) | ValueAsBytes[1];
62  Value = (Value << 0x08) | ValueAsBytes[2];
63  Value = (Value << 0x08) | ValueAsBytes[3];
64  Value = (Value << 0x08) | ValueAsBytes[4];
65 
66  return Value;
67 }
unsigned long long ULONGLONG
Definition: CascPort.h:144
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:1706

+ Here is the caller graph for this function:

void ConvertIntegerToBytes_4 ( DWORD  Value,
LPBYTE  ValueAsBytes 
)
70 {
71  ValueAsBytes[0] = (Value >> 0x18) & 0xFF;
72  ValueAsBytes[1] = (Value >> 0x10) & 0xFF;
73  ValueAsBytes[2] = (Value >> 0x08) & 0xFF;
74  ValueAsBytes[3] = (Value >> 0x00) & 0xFF;
75 }
PCASC_ENCODING_ENTRY FindEncodingEntry ( TCascStorage hs,
PQUERY_KEY  pEncodingKey,
PDWORD  PtrIndex 
)
36 {
37  PCASC_ENCODING_ENTRY pEncodingEntry = NULL;
38 
39  if(hs->pEncodingMap != NULL)
40  pEncodingEntry = (PCASC_ENCODING_ENTRY)Map_FindObject(hs->pEncodingMap, pEncodingKey->pbData, PtrIndex);
41 
42  return pEncodingEntry;
43 }
void * Map_FindObject(PCASC_MAP pMap, void *pvKey, PDWORD PtrIndex)
Definition: Map.cpp:138
arena_t NULL
Definition: jemalloc_internal.h:624
struct _CASC_ENCODING_ENTRY * PCASC_ENCODING_ENTRY
LPBYTE pbData
Definition: CascLib.h:140
PCASC_MAP pEncodingMap
Definition: CascCommon.h:220
Definition: CascCommon.h:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PCASC_INDEX_ENTRY FindIndexEntry ( TCascStorage hs,
PQUERY_KEY  pIndexKey 
)
26 {
27  PCASC_INDEX_ENTRY pIndexEntry = NULL;
28 
29  if(hs->pIndexEntryMap != NULL)
30  pIndexEntry = (PCASC_INDEX_ENTRY)Map_FindObject(hs->pIndexEntryMap, pIndexKey->pbData, NULL);
31 
32  return pIndexEntry;
33 }
void * Map_FindObject(PCASC_MAP pMap, void *pvKey, PDWORD PtrIndex)
Definition: Map.cpp:138
PCASC_MAP pIndexEntryMap
Definition: CascCommon.h:217
arena_t NULL
Definition: jemalloc_internal.h:624
struct _CASC_INDEX_ENTRY * PCASC_INDEX_ENTRY
LPBYTE pbData
Definition: CascLib.h:140
Definition: CascCommon.h:102

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void FreeCascBlob ( PQUERY_KEY  pQueryKey)
81 {
82  if(pBlob != NULL)
83  {
84  if(pBlob->pbData != NULL)
85  CASC_FREE(pBlob->pbData);
86 
87  pBlob->pbData = NULL;
88  pBlob->cbData = 0;
89  }
90 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define CASC_FREE(ptr)
Definition: CascCommon.h:303

+ Here is the caller graph for this function:

int GetRootVariableIndex ( const char *  szLinePtr,
const char *  szLineEnd,
const char *  szVariableName,
int *  PtrIndex 
)
954 {
955  size_t nLength = strlen(szVariableName);
956  int nIndex = 0;
957 
958  while(szLinePtr < szLineEnd)
959  {
960  // Check the variable there
961  if(!_strnicmp(szLinePtr, szVariableName, nLength))
962  {
963  // Does the length match?
964  if(szLinePtr[nLength] == '|' || szLinePtr[nLength] == '0')
965  {
966  PtrIndex[0] = nIndex;
967  return ERROR_SUCCESS;
968  }
969  }
970 
971  // Get the next variable
972  szLinePtr = SkipInfoVariable(szLinePtr, szLineEnd);
973  if(szLinePtr == NULL)
974  break;
975  nIndex++;
976  }
977 
978  return ERROR_BAD_FORMAT;
979 }
static const char * SkipInfoVariable(const char *szLineBegin, const char *szLineEnd)
Definition: CascFiles.cpp:164
arena_t NULL
Definition: jemalloc_internal.h:624
#define _strnicmp
Definition: CascPort.h:186
#define ERROR_BAD_FORMAT
Definition: CascPort.h:214
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TCascFile* IsValidFileHandle ( HANDLE  hFile)
19 {
20  TCascFile * hf = (TCascFile *)hFile;
21 
22  return (hf != NULL && hf->hs != NULL && hf->szClassName != NULL && !strcmp(hf->szClassName, "TCascFile")) ? hf : NULL;
23 }
const char * szClassName
Definition: CascCommon.h:231
arena_t NULL
Definition: jemalloc_internal.h:624
TCascStorage * hs
Definition: CascCommon.h:229
Definition: CascCommon.h:227
TCascStorage* IsValidStorageHandle ( HANDLE  hStorage)
101 {
102  TCascStorage * hs = (TCascStorage *)hStorage;
103 
104  return (hs != NULL && hs->szClassName != NULL && !strcmp(hs->szClassName, "TCascStorage")) ? hs : NULL;
105 }
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: CascCommon.h:186
const char * szClassName
Definition: CascCommon.h:188

+ Here is the caller graph for this function:

int LoadBuildInfo ( TCascStorage hs)
827 {
828  PARSEINFOFILE PfnParseProc = NULL;
829  void * pvListFile;
830  int nError = ERROR_SUCCESS;
831 
832  switch(hs->BuildFileType)
833  {
834  case CascBuildInfo:
835  PfnParseProc = ParseFile_BuildInfo;
836  break;
837 
838  case CascBuildDb:
839  PfnParseProc = ParseFile_BuildDb;
840  break;
841 
842  default:
843  nError = ERROR_NOT_SUPPORTED;
844  break;
845  }
846 
847  // Parse the appropriate build file
848  if(nError == ERROR_SUCCESS)
849  {
850  pvListFile = ListFile_OpenExternal(hs->szBuildFile);
851  if(pvListFile != NULL)
852  {
853  // Parse the info file
854  nError = PfnParseProc(hs, pvListFile);
855  ListFile_Free(pvListFile);
856  }
857  else
858  nError = ERROR_FILE_NOT_FOUND;
859  }
860 
861  // If the .build.info OR .build.db file has been loaded,
862  // proceed with loading the CDN config file and CDN build file
863  if(nError == ERROR_SUCCESS)
864  {
865  // Load the configuration file
866  pvListFile = FetchAndVerifyConfigFile(hs, &hs->CdnConfigKey);
867  if(pvListFile != NULL)
868  {
869  nError = LoadCdnConfigFile(hs, pvListFile);
870  ListFile_Free(pvListFile);
871  }
872  else
873  nError = ERROR_FILE_NOT_FOUND;
874  }
875 
876  // Load the build file
877  if(nError == ERROR_SUCCESS)
878  {
879  pvListFile = FetchAndVerifyConfigFile(hs, &hs->CdnBuildKey);
880  if(pvListFile != NULL)
881  {
882  nError = LoadCdnBuildFile(hs, pvListFile);
883  ListFile_Free(pvListFile);
884  }
885  else
886  nError = ERROR_FILE_NOT_FOUND;
887  }
888 
889  // Fill the index directory
890  if(nError == ERROR_SUCCESS)
891  {
892  // First, check for more common "data" subdirectory
893  if((hs->szIndexPath = CheckForIndexDirectory(hs, _T("data"))) != NULL)
894  return ERROR_SUCCESS;
895 
896  // Second, try the "darch" subdirectory (older builds of HOTS - Alpha)
897  if((hs->szIndexPath = CheckForIndexDirectory(hs, _T("darch"))) != NULL)
898  return ERROR_SUCCESS;
899 
900  nError = ERROR_FILE_NOT_FOUND;
901  }
902 
903  return nError;
904 }
static int ParseFile_BuildDb(TCascStorage *hs, void *pvListFile)
Definition: CascFiles.cpp:618
void * ListFile_OpenExternal(const TCHAR *szListFile)
Definition: ListFile.cpp:52
static int ParseFile_BuildInfo(TCascStorage *hs, void *pvListFile)
Definition: CascFiles.cpp:519
void ListFile_Free(void *pvListFile)
Definition: ListFile.cpp:201
static TCHAR * CheckForIndexDirectory(TCascStorage *hs, const TCHAR *szSubDir)
Definition: CascFiles.cpp:177
CBLD_TYPE BuildFileType
Definition: CascCommon.h:201
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: CascCommon.h:92
QUERY_KEY CdnBuildKey
Definition: CascCommon.h:204
#define _T(x)
Definition: CascPort.h:171
static void * FetchAndVerifyConfigFile(TCascStorage *hs, PQUERY_KEY pFileKey)
Definition: CascFiles.cpp:489
int(* PARSEINFOFILE)(TCascStorage *hs, void *pvListFile)
Definition: CascFiles.cpp:19
#define ERROR_FILE_NOT_FOUND
Definition: CascPort.h:205
Definition: CascCommon.h:93
QUERY_KEY CdnConfigKey
Definition: CascCommon.h:203
TCHAR * szIndexPath
Definition: CascCommon.h:193
TCHAR * szBuildFile
Definition: CascCommon.h:192
#define ERROR_NOT_SUPPORTED
Definition: CascPort.h:209
static int LoadCdnBuildFile(TCascStorage *hs, void *pvListFile)
Definition: CascFiles.cpp:719
#define ERROR_SUCCESS
Definition: CascPort.h:204
static int LoadCdnConfigFile(TCascStorage *hs, void *pvListFile)
Definition: CascFiles.cpp:665

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ParseRootFileLine ( const char *  szLinePtr,
const char *  szLineEnd,
int  nFileNameIndex,
PQUERY_KEY  pEncodingKey,
char *  szFileName,
size_t  nMaxChars 
)
983 {
984  int nIndex = 0;
985  int nError;
986 
987  // Extract the MD5 (aka encoding key)
988  if(szLinePtr[MD5_STRING_SIZE] != '|')
989  return ERROR_BAD_FORMAT;
990 
991  // Convert the encoding key to binary
992  PtrEncodingKey->cbData = MD5_HASH_SIZE;
993  nError = ConvertStringToBinary(szLinePtr, MD5_STRING_SIZE, PtrEncodingKey->pbData);
994  if(nError != ERROR_SUCCESS)
995  return nError;
996 
997  // Skip the variable
998  szLinePtr += MD5_STRING_SIZE + 1;
999  nIndex = 1;
1000 
1001  // Skip the variables until we find the file name
1002  while(szLinePtr < szLineEnd && nIndex < nFileNameIndex)
1003  {
1004  if(szLinePtr[0] == '|')
1005  nIndex++;
1006  szLinePtr++;
1007  }
1008 
1009  // Extract the file name
1010  while(szLinePtr < szLineEnd && szLinePtr[0] != '|' && nMaxChars > 1)
1011  {
1012  *szFileName++ = *szLinePtr++;
1013  nMaxChars--;
1014  }
1015 
1016  *szFileName = 0;
1017  return ERROR_SUCCESS;
1018 }
int ConvertStringToBinary(const char *szString, size_t nMaxDigits, LPBYTE pbBinary)
Definition: Common.cpp:338
#define MD5_HASH_SIZE
Definition: CascLib.h:105
#define ERROR_BAD_FORMAT
Definition: CascPort.h:214
#define MD5_STRING_SIZE
Definition: CascLib.h:106
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int RootHandler_CreateDiablo3 ( TCascStorage hs,
LPBYTE  pbRootFile,
DWORD  cbRootFile 
)
1080 {
1081  TRootHandler_Diablo3 * pRootHandler;
1082  PCASC_MAP pPackageMap = NULL;
1083  LPBYTE pbRootFileEnd = pbRootFile + cbRootFile;
1084  LPBYTE pbPackagesDat = NULL;
1085  DWORD dwTotalFileCount;
1086  DWORD cbPackagesDat = 0;
1087  int nError;
1088 
1089  // Allocate the root handler object
1090  hs->pRootHandler = pRootHandler = CASC_ALLOC(TRootHandler_Diablo3, 1);
1091  if(pRootHandler == NULL)
1092  return ERROR_NOT_ENOUGH_MEMORY;
1093 
1094  // Fill-in the handler functions
1095  memset(pRootHandler, 0, sizeof(TRootHandler_Diablo3));
1096  pRootHandler->Insert = (ROOT_INSERT)D3Handler_Insert;
1097  pRootHandler->Search = (ROOT_SEARCH)D3Handler_Search;
1098  pRootHandler->EndSearch = (ROOT_ENDSEARCH)D3Handler_EndSearch;
1099  pRootHandler->GetKey = (ROOT_GETKEY)D3Handler_GetKey;
1100  pRootHandler->Close = (ROOT_CLOSE)D3Handler_Close;
1101 
1102  // Fill-in the flags
1103  pRootHandler->dwRootFlags |= ROOT_FLAG_HAS_NAMES;
1104 
1105  // Scan the total number of files in the root directories
1106  // Reserve space for extra files
1107  dwTotalFileCount = ScanDirectoryFile(hs, pbRootFile, pbRootFileEnd);
1108  if(dwTotalFileCount == 0)
1109  return ERROR_FILE_CORRUPT;
1110  dwTotalFileCount += CASC_EXTRA_FILES;
1111 
1112  // Allocate the global linear file table
1113  // Note: This is about 18 MB of memory for Diablo III PTR build 30013
1114  nError = Array_Create(&pRootHandler->FileTable, CASC_FILE_ENTRY, dwTotalFileCount);
1115  if(nError != ERROR_SUCCESS)
1116  return nError;
1117 
1118  // Allocate global buffer for file names.
1119  // The size of the buffer was taken from Diablo III build 30013
1120  nError = Array_Create(&pRootHandler->FileNames, char, 0x01000000);
1121  if(nError != ERROR_SUCCESS)
1122  return nError;
1123 
1124  // Create map of ROOT_ENTRY -> FileEntry
1125  pRootHandler->pRootMap = Map_Create(dwTotalFileCount, sizeof(ULONGLONG), FIELD_OFFSET(CASC_FILE_ENTRY, FileNameHash));
1126  if(pRootHandler->pRootMap == NULL)
1127  return ERROR_NOT_ENOUGH_MEMORY;
1128 
1129  // Parse the ROOT file and insert all entries in the file table
1130  nError = ParseDirectoryFile(pRootHandler, pbRootFile, pbRootFileEnd, DIABLO3_INVALID_INDEX);
1131  if(nError == ERROR_SUCCESS)
1132  {
1133  size_t dwRootEntries = pRootHandler->FileTable.ItemCount;
1134 
1135  // We expect the number of level-0 to be less than maximum
1136  assert(dwRootEntries < DIABLO3_MAX_SUBDIRS);
1137 
1138  // Now parse the all root items and load them
1139  for(size_t i = 0; i < dwRootEntries; i++)
1140  {
1141  PCASC_FILE_ENTRY pRootEntry = (PCASC_FILE_ENTRY)Array_ItemAt(&pRootHandler->FileTable, i);
1142 
1143  // Load the entire file to memory
1144  pbRootFile = LoadFileToMemory(hs, pRootEntry->EncodingKey.Value, &cbRootFile);
1145  if(pbRootFile != NULL)
1146  {
1147  nError = ParseDirectoryFile(pRootHandler, pbRootFile, pbRootFile + cbRootFile, i);
1148  CASC_FREE(pbRootFile);
1149  }
1150  }
1151  }
1152 
1153  // Note: The file "Base\Data_D3\PC\Misc\Packages.dat" contains the names
1154  // of the files (without level-0 and level-1 directory). We can use these
1155  // names for supplying the missing extensions
1156  if(nError == ERROR_SUCCESS)
1157  {
1158  // Load the entire file to memory
1159  pbPackagesDat = LoadFileToMemory(hs, "Base\\Data_D3\\PC\\Misc\\Packages.dat", &cbPackagesDat);
1160  if(pbPackagesDat != NULL)
1161  {
1162  pPackageMap = CreatePackageMap(pbPackagesDat, pbPackagesDat + cbPackagesDat);
1163  }
1164  }
1165 
1166  // Vast majorify of files at this moment don't have names.
1167  // We can load the Base\CoreTOC.dat file in order
1168  // to get directory asset indexes, file names and extensions
1169  if(nError == ERROR_SUCCESS)
1170  {
1171  LPBYTE pbCoreTOC;
1172  DWORD cbCoreTOC = 0;
1173 
1174  // Load the entire file to memory
1175  pbCoreTOC = LoadFileToMemory(hs, "Base\\CoreTOC.dat", &cbCoreTOC);
1176  if(pbCoreTOC != NULL)
1177  {
1178  ParseCoreTOC(pRootHandler, pPackageMap, pbCoreTOC, pbCoreTOC + cbCoreTOC);
1179  CASC_FREE(pbCoreTOC);
1180  }
1181  }
1182 
1183  // Free the packages map
1184  if(pPackageMap != NULL)
1185  Map_Free(pPackageMap);
1186  if(pbPackagesDat != NULL)
1187  CASC_FREE(pbPackagesDat);
1188  return nError;
1189 }
TRootHandler * pRootHandler
Definition: CascCommon.h:223
DYNAMIC_ARRAY FileTable
Definition: CascRootFile_Diablo3.cpp:149
static PCASC_MAP CreatePackageMap(LPBYTE pbPackagesDat, LPBYTE pbPackagesEnd)
Definition: CascRootFile_Diablo3.cpp:380
#define CASC_ALLOC(type, count)
Definition: CascCommon.h:302
unsigned long long ULONGLONG
Definition: CascPort.h:144
static DWORD ScanDirectoryFile(TCascStorage *hs, LPBYTE pbRootFile, LPBYTE pbFileEnd)
Definition: CascRootFile_Diablo3.cpp:756
static LPBYTE D3Handler_GetKey(TRootHandler_Diablo3 *pRootHandler, const char *szFileName)
Definition: CascRootFile_Diablo3.cpp:985
PCASC_MAP Map_Create(DWORD dwMaxItems, DWORD dwKeyLength, DWORD dwKeyOffset)
Definition: Map.cpp:93
LPBYTE(* ROOT_SEARCH)(struct TRootHandler *pRootHandler, struct _TCascSearch *pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags)
Definition: RootHandler.h:36
#define Array_Create(pArray, type, ItemCountMax)
Definition: DynamicArray.h:35
#define CASC_EXTRA_FILES
Definition: CascCommon.h:53
DWORD dwRootFlags
Definition: RootHandler.h:75
#define ERROR_NOT_ENOUGH_MEMORY
Definition: CascPort.h:208
void Map_Free(PCASC_MAP pMap)
Definition: Map.cpp:279
ROOT_GETKEY GetKey
Definition: RootHandler.h:71
ROOT_INSERT Insert
Definition: RootHandler.h:68
void(* ROOT_ENDSEARCH)(struct TRootHandler *pRootHandler, struct _TCascSearch *pSearch)
Definition: RootHandler.h:43
#define ERROR_FILE_CORRUPT
Definition: CascPort.h:218
#define ROOT_FLAG_HAS_NAMES
Definition: RootHandler.h:21
Definition: CascRootFile_Diablo3.cpp:130
arena_t NULL
Definition: jemalloc_internal.h:624
LPBYTE(* ROOT_GETKEY)(struct TRootHandler *pRootHandler, const char *szFileName)
Definition: RootHandler.h:48
#define DIABLO3_MAX_SUBDIRS
Definition: CascRootFile_Diablo3.cpp:22
ENCODING_KEY EncodingKey
Definition: CascRootFile_Diablo3.cpp:132
PCASC_MAP pRootMap
Definition: CascRootFile_Diablo3.cpp:155
BYTE * LPBYTE
Definition: CascPort.h:152
static LPBYTE D3Handler_Search(TRootHandler_Diablo3 *pRootHandler, TCascSearch *pSearch, PDWORD, PDWORD)
Definition: CascRootFile_Diablo3.cpp:949
#define CASC_FREE(ptr)
Definition: CascCommon.h:303
void * Array_ItemAt(PDYNAMIC_ARRAY pArray, size_t ItemIndex)
Definition: DynamicArray.cpp:81
#define DIABLO3_INVALID_INDEX
Definition: CascRootFile_Diablo3.cpp:24
struct _CASC_FILE_ENTRY * PCASC_FILE_ENTRY
ROOT_SEARCH Search
Definition: RootHandler.h:69
#define FIELD_OFFSET(t, f)
Definition: CascPort.h:122
static int ParseDirectoryFile(TRootHandler_Diablo3 *pRootHandler, LPBYTE pbDirFile, LPBYTE pbFileEnd, DWORD dwRootDirIndex)
Definition: CascRootFile_Diablo3.cpp:806
static int D3Handler_Insert(TRootHandler_Diablo3 *pRootHandler, const char *szFileName, LPBYTE pbEncodingKey)
Definition: CascRootFile_Diablo3.cpp:931
static void D3Handler_Close(TRootHandler_Diablo3 *pRootHandler)
Definition: CascRootFile_Diablo3.cpp:995
ROOT_ENDSEARCH EndSearch
Definition: RootHandler.h:70
unsigned int DWORD
Definition: CascPort.h:139
Definition: Map.h:19
Definition: CascRootFile_Diablo3.cpp:146
int(* ROOT_INSERT)(struct TRootHandler *pRootHandler, const char *szFileName, LPBYTE pbEncodingKey)
Definition: RootHandler.h:30
static int ParseCoreTOC(TRootHandler_Diablo3 *pRootHandler, PCASC_MAP pPackageMap, LPBYTE pbCoreTocFile, LPBYTE pbCoreTocEnd)
Definition: CascRootFile_Diablo3.cpp:862
BYTE Value[MD5_HASH_SIZE]
Definition: CascCommon.h:98
DYNAMIC_ARRAY FileNames
Definition: CascRootFile_Diablo3.cpp:152
static void D3Handler_EndSearch(TRootHandler_Diablo3 *, TCascSearch *)
Definition: CascRootFile_Diablo3.cpp:980
void(* ROOT_CLOSE)(struct TRootHandler *pRootHandler)
Definition: RootHandler.h:62
ROOT_CLOSE Close
Definition: RootHandler.h:73
#define ERROR_SUCCESS
Definition: CascPort.h:204
size_t ItemCount
Definition: DynamicArray.h:21
static LPBYTE LoadFileToMemory(TCascStorage *hs, LPBYTE pbEncodingKey, DWORD *pcbFileData)
Definition: CascRootFile_Diablo3.cpp:648

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int RootHandler_CreateMNDX ( TCascStorage hs,
LPBYTE  pbRootFile,
DWORD  cbRootFile 
)
3140 {
3141  PFILE_MNDX_HEADER pMndxHeader = (PFILE_MNDX_HEADER)pbRootFile;
3142  PCASC_MNDX_INFO pMndxInfo;
3143  TRootHandler_MNDX * pRootHandler;
3144  FILE_MAR_INFO MarInfo;
3145  PMAR_FILE pMarFile;
3146  LPBYTE pbRootFileEnd = pbRootFile + cbRootFile;
3147  DWORD cbToAllocate;
3148  DWORD dwFilePointer = 0;
3149  DWORD i;
3150  int nError = ERROR_SUCCESS;
3151 
3152  // Check signature and the other variables
3153  if(pMndxHeader->Signature != CASC_MNDX_SIGNATURE || pMndxHeader->FormatVersion > 2 || pMndxHeader->FormatVersion < 1)
3154  return ERROR_BAD_FORMAT;
3155 
3156  // Allocate the structure for the MNDX root file
3157  hs->pRootHandler = pRootHandler = CASC_ALLOC(TRootHandler_MNDX, 1);
3158  if(pRootHandler == NULL)
3159  return ERROR_NOT_ENOUGH_MEMORY;
3160 
3161  // Fill-in the handler functions
3162  memset(pRootHandler, 0, sizeof(TRootHandler_MNDX));
3163  pRootHandler->Insert = (ROOT_INSERT)MndxHandler_Insert;
3164  pRootHandler->Search = (ROOT_SEARCH)MndxHandler_Search;
3166  pRootHandler->GetKey = (ROOT_GETKEY)MndxHandler_GetKey;
3167  pRootHandler->Close = (ROOT_CLOSE) MndxHandler_Close;
3168  pMndxInfo = &pRootHandler->MndxInfo;
3169 
3170  // Fill-in the flags
3171  pRootHandler->dwRootFlags |= ROOT_FLAG_HAS_NAMES;
3172 
3173  // Copy the header into the MNDX info
3174  pMndxInfo->HeaderVersion = pMndxHeader->HeaderVersion;
3175  pMndxInfo->FormatVersion = pMndxHeader->FormatVersion;
3176  dwFilePointer += sizeof(FILE_MNDX_HEADER);
3177 
3178  // Header version 2 has 2 extra fields that we need to load
3179  if(pMndxInfo->HeaderVersion == 2)
3180  {
3181  if(!RootFileRead(pbRootFile + dwFilePointer, pbRootFileEnd, &pMndxInfo->field_1C, sizeof(DWORD) + sizeof(DWORD)))
3182  return ERROR_FILE_CORRUPT;
3183  dwFilePointer += sizeof(DWORD) + sizeof(DWORD);
3184  }
3185 
3186  // Load the rest of the file header
3187  if(!RootFileRead(pbRootFile + dwFilePointer, pbRootFileEnd, &pMndxInfo->MarInfoOffset, 0x1C))
3188  return ERROR_FILE_CORRUPT;
3189 
3190  // Verify the structure
3191  if(pMndxInfo->MarInfoCount > CASC_MAX_MAR_FILES || pMndxInfo->MarInfoSize != sizeof(FILE_MAR_INFO))
3192  return ERROR_FILE_CORRUPT;
3193 
3194  // Load all MAR infos
3195  for(i = 0; i < pMndxInfo->MarInfoCount; i++)
3196  {
3197  // Load the n-th MAR info
3198  dwFilePointer = pMndxInfo->MarInfoOffset + (pMndxInfo->MarInfoSize * i);
3199  if(!RootFileRead(pbRootFile + dwFilePointer, pbRootFileEnd, &MarInfo, sizeof(FILE_MAR_INFO)))
3200  return ERROR_FILE_CORRUPT;
3201 
3202  // Allocate MAR_FILE structure
3203  pMarFile = CASC_ALLOC(MAR_FILE, 1);
3204  if(pMarFile == NULL)
3205  {
3206  nError = ERROR_NOT_ENOUGH_MEMORY;
3207  break;
3208  }
3209 
3210  // Allocate space for the MAR data
3211  pMarFile->pDatabasePtr = NULL;
3212  pMarFile->pbMarData = CASC_ALLOC(BYTE, MarInfo.MarDataSize);
3213  pMarFile->cbMarData = MarInfo.MarDataSize;
3214  if(pMarFile->pbMarData == NULL)
3215  {
3216  nError = ERROR_NOT_ENOUGH_MEMORY;
3217  break;
3218  }
3219 
3220  // Read the MAR data
3221  if(!RootFileRead(pbRootFile + MarInfo.MarDataOffset, pbRootFileEnd, pMarFile->pbMarData, pMarFile->cbMarData))
3222  {
3223  nError = ERROR_FILE_CORRUPT;
3224  break;
3225  }
3226 
3227  // HOTS: 00E94FF1
3228  MAR_FILE_CreateDatabase(pMarFile);
3229  if(i == 0)
3230  pMndxInfo->pMarFile1 = pMarFile;
3231  if(i == 1)
3232  pMndxInfo->pMarFile2 = pMarFile;
3233  if(i == 2)
3234  pMndxInfo->pMarFile3 = pMarFile;
3235  }
3236 
3237  // All three MAR files must be loaded
3238  // HOTS: 00E9503B
3239  if(nError == ERROR_SUCCESS)
3240  {
3241  if(pMndxInfo->pMarFile1 == NULL || pMndxInfo->pMarFile2 == NULL || pMndxInfo->pMarFile3 == NULL)
3242  nError = ERROR_BAD_FORMAT;
3243  if(pMndxInfo->MndxEntrySize != sizeof(CASC_ROOT_ENTRY_MNDX))
3244  nError = ERROR_BAD_FORMAT;
3245  }
3246 
3247  // Load the complete array of MNDX entries
3248  if(nError == ERROR_SUCCESS)
3249  {
3250  TFileNameDatabasePtr * pDbPtr = pMndxInfo->pMarFile2->pDatabasePtr;
3251  DWORD FileNameCount;
3252 
3253  nError = pDbPtr->GetFileNameCount(&FileNameCount);
3254  if(nError == ERROR_SUCCESS && FileNameCount == pMndxInfo->MndxEntriesValid)
3255  {
3256  cbToAllocate = pMndxInfo->MndxEntriesTotal * pMndxInfo->MndxEntrySize;
3257  pRootHandler->pMndxEntries = (PCASC_ROOT_ENTRY_MNDX)CASC_ALLOC(BYTE, cbToAllocate);
3258  if(pRootHandler->pMndxEntries != NULL)
3259  {
3260  if(!RootFileRead(pbRootFile + pMndxInfo->MndxEntriesOffset, pbRootFileEnd, pRootHandler->pMndxEntries, cbToAllocate))
3261  nError = ERROR_FILE_CORRUPT;
3262  }
3263  else
3264  nError = ERROR_NOT_ENOUGH_MEMORY;
3265  }
3266  else
3267  nError = ERROR_FILE_CORRUPT;
3268  }
3269 
3270  // Pick the valid MNDX entries and put them to a separate array
3271  if(nError == ERROR_SUCCESS)
3272  {
3273  assert(pMndxInfo->MndxEntriesValid <= pMndxInfo->MndxEntriesTotal);
3274  pRootHandler->ppValidEntries = CASC_ALLOC(PCASC_ROOT_ENTRY_MNDX, pMndxInfo->MndxEntriesValid + 1);
3275  if(pRootHandler->ppValidEntries != NULL)
3276  {
3277  PCASC_ROOT_ENTRY_MNDX pRootEntry = pRootHandler->pMndxEntries;
3278  DWORD ValidEntryCount = 1; // edx
3279  DWORD nIndex1 = 0;
3280 
3281  // The first entry is always valid
3282  pRootHandler->ppValidEntries[nIndex1++] = pRootHandler->pMndxEntries;
3283 
3284  // Put the remaining entries
3285  for(i = 0; i < pMndxInfo->MndxEntriesTotal; i++, pRootEntry++)
3286  {
3287  if(ValidEntryCount > pMndxInfo->MndxEntriesValid)
3288  break;
3289 
3290  if(pRootEntry->Flags & 0x80000000)
3291  {
3292  pRootHandler->ppValidEntries[nIndex1++] = pRootEntry + 1;
3293  ValidEntryCount++;
3294  }
3295  }
3296 
3297  // Verify the final number of valid entries
3298  if((ValidEntryCount - 1) != pMndxInfo->MndxEntriesValid)
3299  nError = ERROR_BAD_FORMAT;
3300  }
3301  else
3302  nError = ERROR_NOT_ENOUGH_MEMORY;
3303  }
3304 
3305  // Load the MNDX packages
3306  if(nError == ERROR_SUCCESS)
3307  {
3308  nError = LoadPackageNames(pMndxInfo, &pRootHandler->pPackages);
3309  pMndxInfo->bRootFileLoaded = (nError == ERROR_SUCCESS);
3310  }
3311 
3312 #if defined(_DEBUG) && defined(_X86_) && defined(CASCLIB_TEST)
3313 // CascDumpNameFragTable("E:\\casc-name-fragment-table.txt", pMndxInfo->pMarFile1);
3314 // CascDumpFileNames("E:\\casc-listfile.txt", pMndxInfo->pMarFile1);
3315 // TestMndxRootFile(pRootHandler);
3316 #endif
3317 
3318  // Return the result
3319  return nError;
3320 }
DWORD field_1C
Definition: CascRootFile_Mndx.cpp:47
TRootHandler * pRootHandler
Definition: CascCommon.h:223
#define CASC_ALLOC(type, count)
Definition: CascCommon.h:302
struct _MAR_FILE * pMarFile3
Definition: CascRootFile_Mndx.cpp:58
DWORD MndxEntriesTotal
Definition: CascRootFile_Mndx.cpp:53
LPBYTE(* ROOT_SEARCH)(struct TRootHandler *pRootHandler, struct _TCascSearch *pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags)
Definition: RootHandler.h:36
#define CASC_MAX_MAR_FILES
Definition: CascMndx.h:16
DWORD dwRootFlags
Definition: RootHandler.h:75
#define ERROR_NOT_ENOUGH_MEMORY
Definition: CascPort.h:208
DWORD Flags
Definition: CascRootFile_Mndx.cpp:87
ROOT_GETKEY GetKey
Definition: RootHandler.h:71
Definition: CascMndx.h:272
ROOT_INSERT Insert
Definition: RootHandler.h:68
static LPBYTE MndxHandler_Search(TRootHandler_MNDX *pRootHandler, TCascSearch *pSearch, PDWORD PtrFileSize, PDWORD)
Definition: CascRootFile_Mndx.cpp:3048
void(* ROOT_ENDSEARCH)(struct TRootHandler *pRootHandler, struct _TCascSearch *pSearch)
Definition: RootHandler.h:43
#define ERROR_FILE_CORRUPT
Definition: CascPort.h:218
#define ROOT_FLAG_HAS_NAMES
Definition: RootHandler.h:21
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: CascRootFile_Mndx.cpp:85
DWORD FormatVersion
Definition: CascRootFile_Mndx.cpp:29
LPBYTE(* ROOT_GETKEY)(struct TRootHandler *pRootHandler, const char *szFileName)
Definition: RootHandler.h:48
DWORD MndxEntrySize
Definition: CascRootFile_Mndx.cpp:55
DWORD MarInfoOffset
Definition: CascRootFile_Mndx.cpp:49
static LPBYTE MndxHandler_GetKey(TRootHandler_MNDX *pRootHandler, const char *szFileName)
Definition: CascRootFile_Mndx.cpp:3088
bool bRootFileLoaded
Definition: CascRootFile_Mndx.cpp:61
BYTE * LPBYTE
Definition: CascPort.h:152
DWORD MarDataOffset
Definition: CascRootFile_Mndx.cpp:38
struct _CASC_ROOT_ENTRY_MNDX * PCASC_ROOT_ENTRY_MNDX
struct _FILE_MNDX_HEADER * PFILE_MNDX_HEADER
DWORD MarDataSize
Definition: CascRootFile_Mndx.cpp:36
TFileNameDatabasePtr * pDatabasePtr
Definition: CascMndx.h:345
Definition: CascMndx.h:343
PCASC_ROOT_ENTRY_MNDX * ppValidEntries
Definition: CascRootFile_Mndx.cpp:2923
DWORD cbMarData
Definition: CascMndx.h:347
int GetFileNameCount(PDWORD PtrFileNameCount)
Definition: CascRootFile_Mndx.cpp:2704
static int MndxHandler_Insert(TRootHandler_MNDX *, const char *, LPBYTE)
Definition: CascRootFile_Mndx.cpp:3043
CASC_MNDX_INFO MndxInfo
Definition: CascRootFile_Mndx.cpp:2921
ROOT_SEARCH Search
Definition: RootHandler.h:69
DWORD HeaderVersion
Definition: CascRootFile_Mndx.cpp:45
ROOT_ENDSEARCH EndSearch
Definition: RootHandler.h:70
unsigned int DWORD
Definition: CascPort.h:139
PCASC_MNDX_PACKAGES pPackages
Definition: CascRootFile_Mndx.cpp:2925
DWORD MarInfoSize
Definition: CascRootFile_Mndx.cpp:51
int(* ROOT_INSERT)(struct TRootHandler *pRootHandler, const char *szFileName, LPBYTE pbEncodingKey)
Definition: RootHandler.h:30
Definition: CascRootFile_Mndx.cpp:42
static void MAR_FILE_CreateDatabase(PMAR_FILE pMarFile)
Definition: CascRootFile_Mndx.cpp:2756
Definition: CascRootFile_Mndx.cpp:33
Definition: CascRootFile_Mndx.cpp:25
struct _FILE_MNDX_HEADER FILE_MNDX_HEADER
DWORD MarInfoCount
Definition: CascRootFile_Mndx.cpp:50
static int LoadPackageNames(PCASC_MNDX_INFO pMndxInfo, PCASC_MNDX_PACKAGES *ppPackages)
Definition: CascRootFile_Mndx.cpp:2876
static void MndxHandler_EndSearch(TRootHandler_MNDX *, TCascSearch *pSearch)
Definition: CascRootFile_Mndx.cpp:3081
#define ERROR_BAD_FORMAT
Definition: CascPort.h:214
static void MndxHandler_Close(TRootHandler_MNDX *pRootHandler)
Definition: CascRootFile_Mndx.cpp:3118
struct _MAR_FILE * pMarFile1
Definition: CascRootFile_Mndx.cpp:56
unsigned char BYTE
Definition: CascPort.h:136
PCASC_ROOT_ENTRY_MNDX pMndxEntries
Definition: CascRootFile_Mndx.cpp:2924
void(* ROOT_CLOSE)(struct TRootHandler *pRootHandler)
Definition: RootHandler.h:62
DWORD MndxEntriesOffset
Definition: CascRootFile_Mndx.cpp:52
DWORD FormatVersion
Definition: CascRootFile_Mndx.cpp:46
DWORD MndxEntriesValid
Definition: CascRootFile_Mndx.cpp:54
#define CASC_MNDX_SIGNATURE
Definition: CascMndx.h:17
struct _MAR_FILE * pMarFile2
Definition: CascRootFile_Mndx.cpp:57
LPBYTE pbMarData
Definition: CascMndx.h:346
DWORD Signature
Definition: CascRootFile_Mndx.cpp:27
ROOT_CLOSE Close
Definition: RootHandler.h:73
Definition: CascRootFile_Mndx.cpp:2919
static bool RootFileRead(LPBYTE pbFilePointer, LPBYTE pbFileEnd, void *pvBuffer, size_t dwBytesToRead)
Definition: CascRootFile_Mndx.cpp:254
#define ERROR_SUCCESS
Definition: CascPort.h:204
DWORD HeaderVersion
Definition: CascRootFile_Mndx.cpp:28

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int RootHandler_CreateOverwatch ( TCascStorage hs,
LPBYTE  pbRootFile,
DWORD  cbRootFile 
)
134 {
135  TRootHandler_Ovr * pRootHandler;
136  ENCODING_KEY KeyBuffer;
137  QUERY_KEY EncodingKey = {KeyBuffer.Value, MD5_HASH_SIZE};
138  void * pTextFile;
139  size_t nLength;
140  char szOneLine[0x200];
141  char szFileName[MAX_PATH+1];
142  DWORD dwFileCountMax = hs->pEncodingMap->TableSize;
143  int nFileNameIndex;
144  int nError = ERROR_SUCCESS;
145 
146  // Allocate the root handler object
147  hs->pRootHandler = pRootHandler = CASC_ALLOC(TRootHandler_Ovr, 1);
148  if(pRootHandler == NULL)
150 
151  // Fill-in the handler functions
152  memset(pRootHandler, 0, sizeof(TRootHandler_Ovr));
153  pRootHandler->Insert = (ROOT_INSERT)OvrHandler_Insert;
154  pRootHandler->Search = (ROOT_SEARCH)OvrHandler_Search;
156  pRootHandler->GetKey = (ROOT_GETKEY)OvrHandler_GetKey;
157  pRootHandler->Close = (ROOT_CLOSE)OvrHandler_Close;
158 
159  // Fill-in the flags
160  pRootHandler->dwRootFlags |= ROOT_FLAG_HAS_NAMES;
161 
162  // Allocate the linear array of file entries
163  nError = Array_Create(&pRootHandler->FileTable, CASC_FILE_ENTRY, 0x10000);
164  if(nError != ERROR_SUCCESS)
165  return nError;
166 
167  // Allocate the buffer for the file names
168  nError = Array_Create(&pRootHandler->FileNames, char, 0x10000);
169  if(nError != ERROR_SUCCESS)
170  return nError;
171 
172  // Create map of ROOT_ENTRY -> FileEntry
173  pRootHandler->pRootMap = Map_Create(dwFileCountMax, sizeof(ULONGLONG), FIELD_OFFSET(CASC_FILE_ENTRY, FileNameHash));
174  if(pRootHandler->pRootMap == NULL)
176 
177  // Parse the ROOT file
178  pTextFile = ListFile_FromBuffer(pbRootFile, cbRootFile);
179  if(pTextFile != NULL)
180  {
181  // Get the initial line, containing variable names
182  nLength = ListFile_GetNextLine(pTextFile, szOneLine, _maxchars(szOneLine));
183 
184  // Determine the index of the "FILENAME" variable
185  nError = GetRootVariableIndex(szOneLine, szOneLine + nLength, "FILENAME", &nFileNameIndex);
186  if(nError == ERROR_SUCCESS)
187  {
188  // Parse the next lines
189  while((nLength = ListFile_GetNextLine(pTextFile, szOneLine, _maxchars(szOneLine))) > 0)
190  {
191  // Parse the line
192  nError = ParseRootFileLine(szOneLine, szOneLine + nLength, nFileNameIndex, &EncodingKey, szFileName, _maxchars(szFileName));
193  if(nError == ERROR_SUCCESS)
194  {
195  InsertFileEntry(pRootHandler, szFileName, KeyBuffer.Value);
196  }
197  }
198  }
199 
200  // Free the listfile
201  ListFile_Free(pTextFile);
202  }
203 
204  // Succeeded
205  return nError;
206 }
TRootHandler * pRootHandler
Definition: CascCommon.h:223
Definition: CascCommon.h:96
#define CASC_ALLOC(type, count)
Definition: CascCommon.h:302
unsigned long long ULONGLONG
Definition: CascPort.h:144
PCASC_MAP Map_Create(DWORD dwMaxItems, DWORD dwKeyLength, DWORD dwKeyOffset)
Definition: Map.cpp:93
LPBYTE(* ROOT_SEARCH)(struct TRootHandler *pRootHandler, struct _TCascSearch *pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags)
Definition: RootHandler.h:36
#define Array_Create(pArray, type, ItemCountMax)
Definition: DynamicArray.h:35
DWORD dwRootFlags
Definition: RootHandler.h:75
#define ERROR_NOT_ENOUGH_MEMORY
Definition: CascPort.h:208
ROOT_GETKEY GetKey
Definition: RootHandler.h:71
ROOT_INSERT Insert
Definition: RootHandler.h:68
void ListFile_Free(void *pvListFile)
Definition: ListFile.cpp:201
void(* ROOT_ENDSEARCH)(struct TRootHandler *pRootHandler, struct _TCascSearch *pSearch)
Definition: RootHandler.h:43
Definition: CascLib.h:138
#define MAX_PATH
Definition: CascPort.h:160
#define ROOT_FLAG_HAS_NAMES
Definition: RootHandler.h:21
Definition: CascRootFile_Diablo3.cpp:130
arena_t NULL
Definition: jemalloc_internal.h:624
static int OvrHandler_Insert(TRootHandler_Ovr *pRootHandler, const char *szFileName, LPBYTE pbEncodingKey)
Definition: CascRootFile_Ovr.cpp:72
LPBYTE(* ROOT_GETKEY)(struct TRootHandler *pRootHandler, const char *szFileName)
Definition: RootHandler.h:48
int ParseRootFileLine(const char *szLinePtr, const char *szLineEnd, int nFileNameIndex, PQUERY_KEY pEncodingKey, char *szFileName, size_t nMaxChars)
Definition: CascFiles.cpp:982
static LPBYTE OvrHandler_GetKey(TRootHandler_Ovr *pRootHandler, const char *szFileName)
Definition: CascRootFile_Ovr.cpp:105
size_t TableSize
Definition: Map.h:21
#define MD5_HASH_SIZE
Definition: CascLib.h:105
#define _maxchars(buff)
Definition: CascCommon.h:80
size_t ListFile_GetNextLine(void *pvListFile, const char **pszLineBegin, const char **pszLineEnd)
Definition: ListFile.cpp:111
PCASC_MAP pRootMap
Definition: CascRootFile_Ovr.cpp:34
DYNAMIC_ARRAY FileNames
Definition: CascRootFile_Ovr.cpp:31
ROOT_SEARCH Search
Definition: RootHandler.h:69
#define FIELD_OFFSET(t, f)
Definition: CascPort.h:122
PCASC_MAP pEncodingMap
Definition: CascCommon.h:220
static void OvrHandler_Close(TRootHandler_Ovr *pRootHandler)
Definition: CascRootFile_Ovr.cpp:112
static LPBYTE OvrHandler_Search(TRootHandler_Ovr *pRootHandler, TCascSearch *pSearch, PDWORD, PDWORD)
Definition: CascRootFile_Ovr.cpp:80
ROOT_ENDSEARCH EndSearch
Definition: RootHandler.h:70
void * ListFile_FromBuffer(LPBYTE pbBuffer, DWORD cbBuffer)
Definition: ListFile.cpp:86
unsigned int DWORD
Definition: CascPort.h:139
static void OvrHandler_EndSearch(TRootHandler_Ovr *, TCascSearch *)
Definition: CascRootFile_Ovr.cpp:100
int(* ROOT_INSERT)(struct TRootHandler *pRootHandler, const char *szFileName, LPBYTE pbEncodingKey)
Definition: RootHandler.h:30
BYTE Value[MD5_HASH_SIZE]
Definition: CascCommon.h:98
Definition: CascRootFile_Ovr.cpp:25
void(* ROOT_CLOSE)(struct TRootHandler *pRootHandler)
Definition: RootHandler.h:62
DYNAMIC_ARRAY FileTable
Definition: CascRootFile_Ovr.cpp:28
int GetRootVariableIndex(const char *szLinePtr, const char *szLineEnd, const char *szVariableName, int *PtrIndex)
Definition: CascFiles.cpp:953
ROOT_CLOSE Close
Definition: RootHandler.h:73
static int InsertFileEntry(TRootHandler_Ovr *pRootHandler, const char *szFileName, LPBYTE pbEncodingKey)
Definition: CascRootFile_Ovr.cpp:40
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int RootHandler_CreateWoW6 ( TCascStorage hs,
LPBYTE  pbRootFile,
DWORD  cbRootFile,
DWORD  dwLocaleMask 
)
488 {
489  TRootHandler_WoW6 * pRootHandler;
490  LPBYTE pbRootFileEnd = pbRootFile + cbRootFile;
491  int nError;
492 
493  // Verify the size
494  if(pbRootFile == NULL || cbRootFile <= sizeof(PFILE_LOCALE_BLOCK))
495  nError = ERROR_FILE_CORRUPT;
496 
497  // Allocate the root handler object
498  hs->pRootHandler = pRootHandler = CASC_ALLOC(TRootHandler_WoW6, 1);
499  if(pRootHandler == NULL)
501 
502  // Fill-in the handler functions
503  memset(pRootHandler, 0, sizeof(TRootHandler_WoW6));
504  pRootHandler->Insert = (ROOT_INSERT)WowHandler_Insert;
505  pRootHandler->Search = (ROOT_SEARCH)WowHandler_Search;
507  pRootHandler->GetKey = (ROOT_GETKEY)WowHandler_GetKey;
508  pRootHandler->Close = (ROOT_CLOSE)WowHandler_Close;
509 
510 #ifdef _DEBUG
511  pRootHandler->Dump = TRootHandlerWoW6_Dump; // Support for ROOT file dump
512 #endif // _DEBUG
513 
514  // Count the files that are going to be loaded
515  ParseWowRootFile(pRootHandler, ParseRoot_CountFiles, pbRootFile, pbRootFileEnd, dwLocaleMask);
516  pRootHandler->dwTotalFileCount += CASC_EXTRA_FILES;
517 
518  // Create linear table that will contain all root items
519  nError = Array_Create(&pRootHandler->FileTable, CASC_FILE_ENTRY, pRootHandler->dwTotalFileCount);
520  if(nError != ERROR_SUCCESS)
521  return nError;
522 
523  // Create the map of FileHash ->FileEntry
524  pRootHandler->pRootMap = Map_Create(pRootHandler->dwTotalFileCount, sizeof(ULONGLONG), FIELD_OFFSET(CASC_FILE_ENTRY, FileNameHash));
525  if(pRootHandler->pRootMap == NULL)
527 
528  // Parse the root file again and insert all files to the map
529  ParseWowRootFile(pRootHandler, ParseRoot_AddRootEntries, pbRootFile, pbRootFileEnd, dwLocaleMask);
530  return ERROR_SUCCESS;
531 }
TRootHandler * pRootHandler
Definition: CascCommon.h:223
Definition: CascRootFile_WoW6.cpp:65
static void WowHandler_Close(TRootHandler_WoW6 *pRootHandler)
Definition: CascRootFile_WoW6.cpp:409
#define CASC_ALLOC(type, count)
Definition: CascCommon.h:302
unsigned long long ULONGLONG
Definition: CascPort.h:144
PCASC_MAP Map_Create(DWORD dwMaxItems, DWORD dwKeyLength, DWORD dwKeyOffset)
Definition: Map.cpp:93
LPBYTE(* ROOT_SEARCH)(struct TRootHandler *pRootHandler, struct _TCascSearch *pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags)
Definition: RootHandler.h:36
static int WowHandler_Insert(TRootHandler_WoW6 *pRootHandler, const char *szFileName, LPBYTE pbEncodingKey)
Definition: CascRootFile_WoW6.cpp:315
static LPBYTE WowHandler_Search(TRootHandler_WoW6 *pRootHandler, TCascSearch *pSearch, PDWORD, PDWORD PtrLocaleFlags)
Definition: CascRootFile_WoW6.cpp:351
#define Array_Create(pArray, type, ItemCountMax)
Definition: DynamicArray.h:35
#define CASC_EXTRA_FILES
Definition: CascCommon.h:53
#define ERROR_NOT_ENOUGH_MEMORY
Definition: CascPort.h:208
ROOT_GETKEY GetKey
Definition: RootHandler.h:71
ROOT_DUMP Dump
Definition: RootHandler.h:72
ROOT_INSERT Insert
Definition: RootHandler.h:68
void(* ROOT_ENDSEARCH)(struct TRootHandler *pRootHandler, struct _TCascSearch *pSearch)
Definition: RootHandler.h:43
static void WowHandler_EndSearch(TRootHandler_WoW6 *, TCascSearch *pSearch)
Definition: CascRootFile_WoW6.cpp:402
#define ERROR_FILE_CORRUPT
Definition: CascPort.h:218
Definition: CascRootFile_Diablo3.cpp:130
arena_t NULL
Definition: jemalloc_internal.h:624
PCASC_MAP pRootMap
Definition: CascRootFile_WoW6.cpp:71
LPBYTE(* ROOT_GETKEY)(struct TRootHandler *pRootHandler, const char *szFileName)
Definition: RootHandler.h:48
static int ParseRoot_AddRootEntries(TRootHandler_WoW6 *pRootHandler, PCASC_ROOT_BLOCK pRootBlock)
Definition: CascRootFile_WoW6.cpp:175
static LPBYTE WowHandler_GetKey(TRootHandler_WoW6 *pRootHandler, const char *szFileName)
Definition: CascRootFile_WoW6.cpp:377
BYTE * LPBYTE
Definition: CascPort.h:152
DYNAMIC_ARRAY FileTable
Definition: CascRootFile_WoW6.cpp:68
static int ParseRoot_CountFiles(TRootHandler_WoW6 *pRootHandler, PCASC_ROOT_BLOCK pRootBlock)
Definition: CascRootFile_WoW6.cpp:166
ROOT_SEARCH Search
Definition: RootHandler.h:69
#define FIELD_OFFSET(t, f)
Definition: CascPort.h:122
ROOT_ENDSEARCH EndSearch
Definition: RootHandler.h:70
DWORD dwTotalFileCount
Definition: CascRootFile_WoW6.cpp:74
int(* ROOT_INSERT)(struct TRootHandler *pRootHandler, const char *szFileName, LPBYTE pbEncodingKey)
Definition: RootHandler.h:30
void(* ROOT_CLOSE)(struct TRootHandler *pRootHandler)
Definition: RootHandler.h:62
static int ParseWowRootFile(TRootHandler_WoW6 *pRootHandler, PARSE_ROOT pfnParseRoot, LPBYTE pbRootFile, LPBYTE pbRootFileEnd, DWORD dwLocaleMask)
Definition: CascRootFile_WoW6.cpp:300
Definition: CascRootFile_WoW6.cpp:26
ROOT_CLOSE Close
Definition: RootHandler.h:73
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function: