diff options
author | Shauren <shauren.trinity@gmail.com> | 2019-08-10 19:01:24 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-08-10 19:01:24 +0200 |
commit | cd720efbfa60f434f420ab66e220eca742c48e45 (patch) | |
tree | 3c960ac5249d0711b71fbfdc62f6c0b665ed85ee /dep/CascLib/src/CascLib.h | |
parent | 0d6320dfd3932865edb69c8528327b767bd476ef (diff) |
Dep/CascLib: Update to ladislav-zezula/CascLib@b91f87c770c78340dcd96df970e55b5c0469e884
Diffstat (limited to 'dep/CascLib/src/CascLib.h')
-rw-r--r-- | dep/CascLib/src/CascLib.h | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/dep/CascLib/src/CascLib.h b/dep/CascLib/src/CascLib.h index 1ed387aee01..90be65a00b2 100644 --- a/dep/CascLib/src/CascLib.h +++ b/dep/CascLib/src/CascLib.h @@ -16,7 +16,7 @@ #define __CASCLIB_H__ #ifdef _MSC_VER -#pragma warning(disable:4668) // 'XXX' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' +#pragma warning(disable:4668) // 'XXX' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' #pragma warning(disable:4820) // 'XXX' : '2' bytes padding added after data member 'XXX::yyy' #endif @@ -41,29 +41,29 @@ extern "C" { #ifdef _DEBUG // DEBUG VERSIONS #ifndef _UNICODE #ifdef _DLL - #pragma comment(lib, "CascLibDAD.lib") // Debug Ansi CRT-DLL version + #pragma comment(lib, "CascLibDAD.lib") // Debug Ansi CRT-DLL version #else - #pragma comment(lib, "CascLibDAS.lib") // Debug Ansi CRT-LIB version + #pragma comment(lib, "CascLibDAS.lib") // Debug Ansi CRT-LIB version #endif #else #ifdef _DLL - #pragma comment(lib, "CascLibDUD.lib") // Debug Unicode CRT-DLL version + #pragma comment(lib, "CascLibDUD.lib") // Debug Unicode CRT-DLL version #else - #pragma comment(lib, "CascLibDUS.lib") // Debug Unicode CRT-LIB version + #pragma comment(lib, "CascLibDUS.lib") // Debug Unicode CRT-LIB version #endif #endif #else // RELEASE VERSIONS #ifndef _UNICODE #ifdef _DLL - #pragma comment(lib, "CascLibRAD.lib") // Release Ansi CRT-DLL version + #pragma comment(lib, "CascLibRAD.lib") // Release Ansi CRT-DLL version #else - #pragma comment(lib, "CascLibRAS.lib") // Release Ansi CRT-LIB version + #pragma comment(lib, "CascLibRAS.lib") // Release Ansi CRT-LIB version #endif #else #ifdef _DLL - #pragma comment(lib, "CascLibRUD.lib") // Release Unicode CRT-DLL version + #pragma comment(lib, "CascLibRUD.lib") // Release Unicode CRT-DLL version #else - #pragma comment(lib, "CascLibRUS.lib") // Release Unicode CRT-LIB version + #pragma comment(lib, "CascLibRUS.lib") // Release Unicode CRT-LIB version #endif #endif #endif @@ -72,14 +72,14 @@ extern "C" { //----------------------------------------------------------------------------- // Defines -#define CASCLIB_VERSION 0x0132 // Current version of CascLib (1.50) -#define CASCLIB_VERSION_STRING "1.50" // String version of CascLib version +#define CASCLIB_VERSION 0x0200 // CascLib version - integral (1.50) +#define CASCLIB_VERSION_STRING "2.0" // CascLib version - string // Values for CascOpenFile #define CASC_OPEN_BY_NAME 0x00000000 // Open the file by name. This is the default value #define CASC_OPEN_BY_CKEY 0x00000001 // The name is just the content key; skip ROOT file processing #define CASC_OPEN_BY_EKEY 0x00000002 // The name is just the encoded key; skip ROOT file processing -#define CASC_OPEN_BY_FILEID 0x00000003 // The name is CASC_IDTONAME(FileDataId) +#define CASC_OPEN_BY_FILEID 0x00000003 // The name is CASC_FILE_DATA_ID(FileDataId) #define CASC_OPEN_TYPE_MASK 0x0000000F // The mask which gets open type from the dwFlags #define CASC_OPEN_FLAGS_MASK 0xFFFFFFF0 // The mask which gets open type from the dwFlags #define CASC_STRICT_DATA_CHECK 0x00000010 // Verify all data read from a file @@ -119,16 +119,13 @@ extern "C" { #define MD5_STRING_SIZE 0x20 #endif -#ifndef SHA1_DIGEST_SIZE -#define SHA1_DIGEST_SIZE 0x14 // 160 bits -#endif - // Return value for CascGetFileSize and CascSetFilePointer #define CASC_INVALID_INDEX 0xFFFFFFFF #define CASC_INVALID_SIZE 0xFFFFFFFF #define CASC_INVALID_POS 0xFFFFFFFF #define CASC_INVALID_ID 0xFFFFFFFF #define CASC_INVALID_OFFS64 0xFFFFFFFFFFFFFFFF +#define CASC_INVALID_SIZE64 0xFFFFFFFFFFFFFFFF // Flags for CASC_STORAGE_FEATURES::dwFeatures #define CASC_FEATURE_FILE_NAMES 0x00000001 // File names are supported by the storage @@ -160,7 +157,7 @@ typedef enum _CASC_STORAGE_INFO_CLASS CascStorageFeatures, // Returns the features flag - CascStorageInstalledLocales, + CascStorageInstalledLocales, // Not supported CascStorageProduct, // Gives CASC_STORAGE_PRODUCT CascStorageTags, // Gives CASC_STORAGE_TAGS structure CascStoragePathProduct, // Gives Path:Product into a LPTSTR buffer @@ -173,27 +170,10 @@ typedef enum _CASC_FILE_INFO_CLASS CascFileContentKey, CascFileEncodedKey, CascFileFullInfo, // Gives CASC_FILE_FULL_INFO structure + CascFileSpanInfo, // Gives CASC_FILE_SPAN_INFO structure for each file span CascFileInfoClassMax } CASC_FILE_INFO_CLASS, *PCASC_FILE_INFO_CLASS; -// See https://wowdev.wiki/TACT#Products -typedef enum _CASC_PRODUCT -{ - UnknownProduct, - HeroesOfTheStorm, - Diablo3, - Overwatch, - StarCraft1, - StarCraft2, - WorldOfWarcraft, - WarCraft3, - Destiny2, - CallOfDutyBlackOps4, - Odin, - MaxProductValue - -} CASC_PRODUCT, *PCASC_PRODUCT; - // CascLib may provide a fake name, constructed from file data id, CKey or EKey. // This enum helps to see what name was actually returned // Note that any of these names can be passed to CascOpenFile with no extra flags @@ -221,27 +201,29 @@ typedef struct _CASC_FIND_DATA // Tag mask. Only valid if the storage supports tags, otherwise 0 ULONGLONG TagBitMask; + // Size of the file, as retrieved from CKey entry + ULONGLONG FileSize; + // Plain name of the found file. Pointing inside the 'szFileName' array char * szPlainName; // File data ID. Only valid if the storage supports file data IDs, otherwise CASC_INVALID_ID DWORD dwFileDataId; - // Size of the file, as retrieved from CKey entry or EKey entry - DWORD dwFileSize; - // Locale flags. Only valid if the storage supports locale flags, otherwise CASC_INVALID_ID DWORD dwLocaleFlags; // Content flags. Only valid if the storage supports content flags, otherwise CASC_INVALID_ID DWORD dwContentFlags; - // Hints as for which open method is suitable - DWORD bFileAvailable:1; // If true the file is available locally - DWORD bCanOpenByName:1; - DWORD bCanOpenByDataId:1; - DWORD bCanOpenByCKey:1; - DWORD bCanOpenByEKey:1; + // Span count + DWORD dwSpanCount; + + // If true the file is available locally + DWORD bFileAvailable:1; + + // Name type in 'szFileName'. In case the file name is not known, + // CascLib can put FileDataId-like name or a string representation of CKey/EKey CASC_NAME_TYPE NameType; } CASC_FIND_DATA, *PCASC_FIND_DATA; @@ -264,9 +246,8 @@ typedef struct _CASC_STORAGE_TAGS typedef struct _CASC_STORAGE_PRODUCT { - LPCSTR szProductName; - DWORD dwBuildNumber; - CASC_PRODUCT Product; + char szCodeName[0x1C]; // Code name of the product ("wowt" = "World of Warcraft PTR") + DWORD BuildNumber; // Build number. If zero, then CascLib didn't recognize build number } CASC_STORAGE_PRODUCT, *PCASC_STORAGE_PRODUCT; @@ -279,15 +260,29 @@ typedef struct _CASC_FILE_FULL_INFO ULONGLONG SegmentOffset; // Offset of the file in the segment file ("data.###") ULONGLONG TagBitMask; // Bitmask of tags. Zero if not supported ULONGLONG FileNameHash; // Hash of the file name. Zero if not supported + ULONGLONG ContentSize; // Content size of all spans + ULONGLONG EncodedSize; // Encoded size of all spans DWORD SegmentIndex; // Index of the segment file (aka 0 = "data.000") + DWORD SpanCount; // Number of spans forming the file DWORD FileDataId; // File data ID. CASC_INVALID_ID if not supported. - DWORD ContentSize; // Content size of the file - DWORD EncodedSize; // Encoded size of the file DWORD LocaleFlags; // Locale flags. CASC_INVALID_ID if not supported. DWORD ContentFlags; // Locale flags. CASC_INVALID_ID if not supported } CASC_FILE_FULL_INFO, *PCASC_FILE_FULL_INFO; +typedef struct _CASC_FILE_SPAN_INFO +{ + BYTE CKey[MD5_HASH_SIZE]; // Content key of the file span + BYTE EKey[MD5_HASH_SIZE]; // Encoded key of the file span + ULONGLONG StartOffset; // Starting offset of the file span + ULONGLONG EndOffset; // Ending offset of the file span + DWORD ArchiveIndex; // Index of the archive + DWORD ArchiveOffs; // Offset in the archive + DWORD HeaderSize; // Size of encoded frame headers + DWORD FrameCount; // Number of frames in this span + +} CASC_FILE_SPAN_INFO, *PCASC_FILE_SPAN_INFO; + //----------------------------------------------------------------------------- // Extended version of CascOpenStorage @@ -348,16 +343,21 @@ bool WINAPI CascOpenStorage(LPCTSTR szParams, DWORD dwLocaleMask, HANDLE * phSt bool WINAPI CascOpenOnlineStorage(LPCTSTR szParams, DWORD dwLocaleMask, HANDLE * phStorage); bool WINAPI CascGetStorageInfo(HANDLE hStorage, CASC_STORAGE_INFO_CLASS InfoClass, void * pvStorageInfo, size_t cbStorageInfo, size_t * pcbLengthNeeded); bool WINAPI CascAddEncryptionKey(HANDLE hStorage, ULONGLONG KeyName, LPBYTE Key); +bool WINAPI CascAddStringEncryptionKey(HANDLE hStorage, ULONGLONG KeyName, LPCSTR szKey); LPBYTE WINAPI CascFindEncryptionKey(HANDLE hStorage, ULONGLONG KeyName); bool WINAPI CascCloseStorage(HANDLE hStorage); -bool WINAPI CascOpenFile(HANDLE hStorage, const void * pvFileName, DWORD dwLocaleFlags, DWORD dwOpenFlags, HANDLE * phFile); +bool WINAPI CascOpenFile(HANDLE hStorage, const void * pvFileName, DWORD dwLocaleFlags, DWORD dwOpenFlags, HANDLE * PtrFileHandle); +bool WINAPI CascOpenLocalFile(LPCTSTR szFileName, DWORD dwOpenFlags, HANDLE * PtrFileHandle); bool WINAPI CascGetFileInfo(HANDLE hFile, CASC_FILE_INFO_CLASS InfoClass, void * pvFileInfo, size_t cbFileInfo, size_t * pcbLengthNeeded); -DWORD WINAPI CascGetFileSize(HANDLE hFile, PDWORD pdwFileSizeHigh); -DWORD WINAPI CascSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * plFilePosHigh, DWORD dwMoveMethod); +bool WINAPI CascGetFileSize64(HANDLE hFile, PULONGLONG PtrFileSize); +bool WINAPI CascSetFilePointer64(HANDLE hFile, LONGLONG DistanceToMove, PULONGLONG PtrNewPos, DWORD dwMoveMethod); bool WINAPI CascReadFile(HANDLE hFile, void * lpBuffer, DWORD dwToRead, PDWORD pdwRead); bool WINAPI CascCloseFile(HANDLE hFile); +DWORD WINAPI CascGetFileSize(HANDLE hFile, PDWORD pdwFileSizeHigh); +DWORD WINAPI CascSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * PtrFilePosHigh, DWORD dwMoveMethod); + HANDLE WINAPI CascFindFirstFile(HANDLE hStorage, LPCSTR szMask, PCASC_FIND_DATA pFindData, LPCTSTR szListFile); bool WINAPI CascFindNextFile(HANDLE hFind, PCASC_FIND_DATA pFindData); bool WINAPI CascFindClose(HANDLE hFind); |