aboutsummaryrefslogtreecommitdiff
path: root/dep/CascLib/src
diff options
context:
space:
mode:
Diffstat (limited to 'dep/CascLib/src')
-rw-r--r--dep/CascLib/src/CascCommon.h3
-rw-r--r--dep/CascLib/src/CascDecrypt.cpp2
-rw-r--r--dep/CascLib/src/CascFiles.cpp2
-rw-r--r--dep/CascLib/src/CascLib.h23
-rw-r--r--dep/CascLib/src/CascOpenStorage.cpp3
-rw-r--r--dep/CascLib/src/CascPort.h5
-rw-r--r--dep/CascLib/src/CascRootFile_Diablo3.cpp8
-rw-r--r--dep/CascLib/src/CascRootFile_WoW6.cpp2
-rw-r--r--dep/CascLib/src/common/FileStream.cpp8
-rw-r--r--dep/CascLib/src/common/FileStream.h22
10 files changed, 42 insertions, 36 deletions
diff --git a/dep/CascLib/src/CascCommon.h b/dep/CascLib/src/CascCommon.h
index 71855726d03..e7a9d6b5464 100644
--- a/dep/CascLib/src/CascCommon.h
+++ b/dep/CascLib/src/CascCommon.h
@@ -58,7 +58,7 @@
#define BLTE_HEADER_DELTA 0x1E // Distance of BLTE header from begin of the header area
#define MAX_HEADER_AREA_SIZE 0x2A // Length of the file header area
-// File header area in the data.xxx:
+// File header area in the data.nnn:
// BYTE HeaderHash[MD5_HASH_SIZE]; // MD5 of the frame array
// DWORD dwFileSize; // Size of the file (see comment before CascGetFileSize for details)
// BYTE SomeSize[4]; // Some size (big endian)
@@ -205,6 +205,7 @@ typedef struct _TCascStorage
QUERY_KEY ArchivesGroup; // Key array of the "archive-group"
QUERY_KEY ArchivesKey; // Key array of the "archives"
QUERY_KEY PatchArchivesKey; // Key array of the "patch-archives"
+ QUERY_KEY PatchArchivesGroup; // Key array of the "patch-archive-group"
QUERY_KEY RootKey;
QUERY_KEY PatchKey;
QUERY_KEY DownloadKey;
diff --git a/dep/CascLib/src/CascDecrypt.cpp b/dep/CascLib/src/CascDecrypt.cpp
index 5f4dc77dfe8..21477b30e8d 100644
--- a/dep/CascLib/src/CascDecrypt.cpp
+++ b/dep/CascLib/src/CascDecrypt.cpp
@@ -255,7 +255,7 @@ int CascDecrypt(LPBYTE pbOutBuffer, PDWORD pcbOutBuffer, LPBYTE pbInBuffer, DWOR
// Check if we know the key
pbKey = FindCascKey(KeyName);
if(pbKey == NULL)
- return ERROR_UNKNOWN_FILE_KEY;
+ return ERROR_FILE_ENCRYPTED;
// Shuffle the Vector with the block index
// Note that there's no point to go beyond 32 bits, unless the file has
diff --git a/dep/CascLib/src/CascFiles.cpp b/dep/CascLib/src/CascFiles.cpp
index a32f411462f..0641b315a09 100644
--- a/dep/CascLib/src/CascFiles.cpp
+++ b/dep/CascLib/src/CascFiles.cpp
@@ -696,7 +696,7 @@ static int LoadCdnConfigFile(TCascStorage * hs, void * pvListFile)
szVarBegin = CheckLineVariable(szLineBegin, szLineEnd, "patch-archive-group");
if(szVarBegin != NULL)
{
- LoadSingleBlob(&hs->PatchArchivesKey, szVarBegin, szLineEnd);
+ LoadSingleBlob(&hs->PatchArchivesGroup, szVarBegin, szLineEnd);
continue;
}
diff --git a/dep/CascLib/src/CascLib.h b/dep/CascLib/src/CascLib.h
index cc22738d63a..b6c68938d8e 100644
--- a/dep/CascLib/src/CascLib.h
+++ b/dep/CascLib/src/CascLib.h
@@ -32,35 +32,12 @@ extern "C" {
#define CASCLIB_VERSION 0x0100 // Current version of CascLib (1.0)
#define CASCLIB_VERSION_STRING "1.00" // String version of CascLib version
-#define ERROR_UNKNOWN_FILE_KEY 10001 // Returned by encrypted stream when can't find file key
-#define ERROR_FILE_INCOMPLETE 10006 // The required file part is missing
-
// Values for CascOpenStorage
#define CASC_STOR_XXXXX 0x00000001 // Not used
// Values for CascOpenFile
#define CASC_OPEN_BY_ENCODING_KEY 0x00000001 // The name is just the encoding key; skip ROOT file processing
-// Flags for file stream
-#define BASE_PROVIDER_FILE 0x00000000 // Base data source is a file
-#define BASE_PROVIDER_MAP 0x00000001 // Base data source is memory-mapped file
-#define BASE_PROVIDER_HTTP 0x00000002 // Base data source is a file on web server
-#define BASE_PROVIDER_MASK 0x0000000F // Mask for base provider value
-
-#define STREAM_PROVIDER_FLAT 0x00000000 // Stream is linear with no offset mapping
-#define STREAM_PROVIDER_PARTIAL 0x00000010 // Stream is partial file (.part)
-#define STREAM_PROVIDER_ENCRYPTED 0x00000020 // Stream is an encrypted archive
-#define STREAM_PROVIDER_BLOCK4 0x00000030 // 0x4000 per block, text MD5 after each block, max 0x2000 blocks per file
-#define STREAM_PROVIDER_MASK 0x000000F0 // Mask for stream provider value
-
-#define STREAM_FLAG_READ_ONLY 0x00000100 // Stream is read only
-#define STREAM_FLAG_WRITE_SHARE 0x00000200 // Allow write sharing when open for write
-#define STREAM_FLAG_USE_BITMAP 0x00000400 // If the file has a file bitmap, load it and use it
-#define STREAM_OPTIONS_MASK 0x0000FF00 // Mask for stream options
-
-#define STREAM_PROVIDERS_MASK 0x000000FF // Mask to get stream providers
-#define STREAM_FLAGS_MASK 0x0000FFFF // Mask for all stream flags (providers+options)
-
#define CASC_LOCALE_ALL 0xFFFFFFFF
#define CASC_LOCALE_NONE 0x00000000
#define CASC_LOCALE_UNKNOWN1 0x00000001
diff --git a/dep/CascLib/src/CascOpenStorage.cpp b/dep/CascLib/src/CascOpenStorage.cpp
index d8508da73bf..4883e83283e 100644
--- a/dep/CascLib/src/CascOpenStorage.cpp
+++ b/dep/CascLib/src/CascOpenStorage.cpp
@@ -507,7 +507,7 @@ static int LoadKeyMapping(PCASC_MAPPING_TABLE pKeyMapping, DWORD KeyIndex)
{
// Retrieve the file size
FileStream_GetSize(pStream, &FileSize);
- if(0 < FileSize && FileSize <= 0x100000)
+ if(0 < FileSize && FileSize <= 0x200000)
{
// WoW6 actually reads THE ENTIRE file to memory
// Verified on Mac build (x64)
@@ -991,6 +991,7 @@ static TCascStorage * FreeCascStorage(TCascStorage * hs)
FreeCascBlob(&hs->ArchivesGroup);
FreeCascBlob(&hs->ArchivesKey);
FreeCascBlob(&hs->PatchArchivesKey);
+ FreeCascBlob(&hs->PatchArchivesGroup);
FreeCascBlob(&hs->RootKey);
FreeCascBlob(&hs->PatchKey);
FreeCascBlob(&hs->DownloadKey);
diff --git a/dep/CascLib/src/CascPort.h b/dep/CascLib/src/CascPort.h
index 366aedcc89d..6a9aee2edce 100644
--- a/dep/CascLib/src/CascPort.h
+++ b/dep/CascLib/src/CascPort.h
@@ -216,6 +216,11 @@
#define ERROR_HANDLE_EOF 1002 // No such error code under Linux
#define ERROR_CAN_NOT_COMPLETE 1003 // No such error code under Linux
#define ERROR_FILE_CORRUPT 1004 // No such error code under Linux
+ #define ERROR_FILE_ENCRYPTED 1005 // Returned by encrypted stream when can't find file key
+#endif
+
+#ifndef ERROR_FILE_INCOMPLETE
+#define ERROR_FILE_INCOMPLETE 1006 // The required file part is missing
#endif
//-----------------------------------------------------------------------------
diff --git a/dep/CascLib/src/CascRootFile_Diablo3.cpp b/dep/CascLib/src/CascRootFile_Diablo3.cpp
index c515567af5f..6fa8309a2fe 100644
--- a/dep/CascLib/src/CascRootFile_Diablo3.cpp
+++ b/dep/CascLib/src/CascRootFile_Diablo3.cpp
@@ -231,7 +231,7 @@ static const DIABLO3_ASSET_INFO Assets[] =
{"Accolade", "aco"}, // 0x42
};
-static const DIABLO3_ASSET_INFO UnknownAsset = {"Unknown", "xxx"};
+static const DIABLO3_ASSET_INFO UnknownAsset = {"Unknown", "unk"};
#define DIABLO3_ASSET_COUNT (sizeof(Assets) / sizeof(Assets[0]))
@@ -327,7 +327,7 @@ static size_t CreateShortName(
}
}
- // If we havent't found the package, we either use the default asset extension or "xxx"
+ // If we havent't found the package, we either use the default asset extension or "unk"
if(szPackageName == NULL)
{
if(dwSubIndex == DIABLO3_INVALID_INDEX)
@@ -337,7 +337,7 @@ static size_t CreateShortName(
}
else
{
- strcpy(szBuffer + nLength, "xxx");
+ strcpy(szBuffer + nLength, "unk");
nLength += 3;
}
}
@@ -887,7 +887,7 @@ static int ParseCoreTOC(
// Find out the entry with the maximum index
for(DWORD n = 0; n < pTocHeader->EntryCounts[i]; n++)
{
- if(pTocEntry->FileIndex > dwFileIndexes)
+ if(pTocEntry->FileIndex >= dwFileIndexes)
dwFileIndexes = pTocEntry->FileIndex + 1;
pTocEntry++;
}
diff --git a/dep/CascLib/src/CascRootFile_WoW6.cpp b/dep/CascLib/src/CascRootFile_WoW6.cpp
index ee915986114..2e6a23610f3 100644
--- a/dep/CascLib/src/CascRootFile_WoW6.cpp
+++ b/dep/CascLib/src/CascRootFile_WoW6.cpp
@@ -381,7 +381,7 @@ static LPBYTE WowHandler_GetKey(TRootHandler_WoW6 * pRootHandler, const char * s
BYTE FileDataIdLE[4];
// Open by FileDataId. The file name must be as following:
- // File########.xxx, where '#' are hexa-decimal numbers (case insensitive).
+ // File########.unk, where '#' are hexa-decimal numbers (case insensitive).
// Extension is ignored in that case
if(IsFileDataIdName(szFileName))
{
diff --git a/dep/CascLib/src/common/FileStream.cpp b/dep/CascLib/src/common/FileStream.cpp
index ccd3a65318d..cb49f7f4ac1 100644
--- a/dep/CascLib/src/common/FileStream.cpp
+++ b/dep/CascLib/src/common/FileStream.cpp
@@ -1,7 +1,7 @@
/*****************************************************************************/
/* FileStream.cpp Copyright (c) Ladislav Zezula 2010 */
/*---------------------------------------------------------------------------*/
-/* File stream support for CascLib */
+/* File stream support */
/* */
/* Windows support: Written by Ladislav Zezula */
/* Mac support: Written by Sam Wilkins */
@@ -162,7 +162,7 @@ static bool BaseFile_Read(
#ifdef PLATFORM_WINDOWS
{
- // Note: CascLib no longer supports Windows 9x.
+ // Note: We no longer support Windows 9x.
// Thus, we can use the OVERLAPPED structure to specify
// file offset to read from file. This allows us to skip
// one system call to SetFilePointer
@@ -233,7 +233,7 @@ static bool BaseFile_Write(TFileStream * pStream, ULONGLONG * pByteOffset, const
#ifdef PLATFORM_WINDOWS
{
- // Note: CascLib no longer supports Windows 9x.
+ // Note: We no longer support Windows 9x.
// Thus, we can use the OVERLAPPED structure to specify
// file offset to read from file. This allows us to skip
// one system call to SetFilePointer
@@ -2097,7 +2097,7 @@ static TFileStream * EncrStream_Open(const TCHAR * szFileName, DWORD dwStreamFla
// Cleanup the stream and return
FileStream_Close(pStream);
- SetLastError(ERROR_UNKNOWN_FILE_KEY);
+ SetLastError(ERROR_FILE_ENCRYPTED);
return NULL;
}
diff --git a/dep/CascLib/src/common/FileStream.h b/dep/CascLib/src/common/FileStream.h
index 1e51acfc845..1c72619e393 100644
--- a/dep/CascLib/src/common/FileStream.h
+++ b/dep/CascLib/src/common/FileStream.h
@@ -12,6 +12,28 @@
#define __FILESTREAM_H__
//-----------------------------------------------------------------------------
+// Flags for file stream
+
+#define BASE_PROVIDER_FILE 0x00000000 // Base data source is a file
+#define BASE_PROVIDER_MAP 0x00000001 // Base data source is memory-mapped file
+#define BASE_PROVIDER_HTTP 0x00000002 // Base data source is a file on web server
+#define BASE_PROVIDER_MASK 0x0000000F // Mask for base provider value
+
+#define STREAM_PROVIDER_FLAT 0x00000000 // Stream is linear with no offset mapping
+#define STREAM_PROVIDER_PARTIAL 0x00000010 // Stream is partial file (.part)
+#define STREAM_PROVIDER_ENCRYPTED 0x00000020 // Stream is an encrypted archive
+#define STREAM_PROVIDER_BLOCK4 0x00000030 // 0x4000 per block, text MD5 after each block, max 0x2000 blocks per file
+#define STREAM_PROVIDER_MASK 0x000000F0 // Mask for stream provider value
+
+#define STREAM_FLAG_READ_ONLY 0x00000100 // Stream is read only
+#define STREAM_FLAG_WRITE_SHARE 0x00000200 // Allow write sharing when open for write
+#define STREAM_FLAG_USE_BITMAP 0x00000400 // If the file has a file bitmap, load it and use it
+#define STREAM_OPTIONS_MASK 0x0000FF00 // Mask for stream options
+
+#define STREAM_PROVIDERS_MASK 0x000000FF // Mask to get stream providers
+#define STREAM_FLAGS_MASK 0x0000FFFF // Mask for all stream flags (providers+options)
+
+//-----------------------------------------------------------------------------
// Function prototypes
typedef void (*STREAM_INIT)(