From 658a79d94add4f9d639b959b6ac7b57a6a0a30ca Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 19 Jun 2019 19:58:31 +0200 Subject: Dep/CascLib: Update to ladislav-zezula/CascLib@c588b7bf538a010fd3376c90bd3a59f2142f05be --- dep/CascLib/src/CascLib.h | 74 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 19 deletions(-) (limited to 'dep/CascLib/src/CascLib.h') diff --git a/dep/CascLib/src/CascLib.h b/dep/CascLib/src/CascLib.h index 52451ac8f20..1ed387aee01 100644 --- a/dep/CascLib/src/CascLib.h +++ b/dep/CascLib/src/CascLib.h @@ -133,13 +133,13 @@ extern "C" { // Flags for CASC_STORAGE_FEATURES::dwFeatures #define CASC_FEATURE_FILE_NAMES 0x00000001 // File names are supported by the storage #define CASC_FEATURE_ROOT_CKEY 0x00000002 // Present if the storage's ROOT returns CKey -#define CASC_FEATURE_TAGS 0x00000002 // Tags are supported by the storage -#define CASC_FEATURE_FNAME_HASHES 0x00000004 // The storage contains file name hashes on ALL files -#define CASC_FEATURE_FNAME_HASHES_OPTIONAL 0x00000008 // The storage contains file name hashes for SOME files -#define CASC_FEATURE_FILE_DATA_IDS 0x00000010 // The storage indexes files by FileDataId -#define CASC_FEATURE_LOCALE_FLAGS 0x00000020 // Locale flags are supported -#define CASC_FEATURE_CONTENT_FLAGS 0x00000040 // Content flags are supported -#define CASC_FEATURE_ONLINE 0x00000080 // The storage is an online storage +#define CASC_FEATURE_TAGS 0x00000004 // Tags are supported by the storage +#define CASC_FEATURE_FNAME_HASHES 0x00000008 // The storage contains file name hashes on ALL files +#define CASC_FEATURE_FNAME_HASHES_OPTIONAL 0x00000010 // The storage contains file name hashes for SOME files +#define CASC_FEATURE_FILE_DATA_IDS 0x00000020 // The storage indexes files by FileDataId +#define CASC_FEATURE_LOCALE_FLAGS 0x00000040 // Locale flags are supported +#define CASC_FEATURE_CONTENT_FLAGS 0x00000080 // Content flags are supported +#define CASC_FEATURE_ONLINE 0x00000100 // The storage is an online storage // Macro to convert FileDataId to the argument of CascOpenFile #define CASC_FILE_DATA_ID(FileDataId) ((LPCSTR)(size_t)FileDataId) @@ -158,11 +158,12 @@ typedef enum _CASC_STORAGE_INFO_CLASS // Returns the total file count, including the offline files CascStorageTotalFileCount, - // Returns the CASC_STORAGE_FEATURES structure. - CascStorageFeatures, + + CascStorageFeatures, // Returns the features flag CascStorageInstalledLocales, CascStorageProduct, // Gives CASC_STORAGE_PRODUCT CascStorageTags, // Gives CASC_STORAGE_TAGS structure + CascStoragePathProduct, // Gives Path:Product into a LPTSTR buffer CascStorageInfoClassMax } CASC_STORAGE_INFO_CLASS, *PCASC_STORAGE_INFO_CLASS; @@ -288,28 +289,63 @@ typedef struct _CASC_FILE_FULL_INFO } CASC_FILE_FULL_INFO, *PCASC_FILE_FULL_INFO; //----------------------------------------------------------------------------- -// Some operations (e.g. opening an online storage) may take long time. -// This callback allows an application to be notified about loading progress. -// This callback only works for a single CascOpen(Online)Storage call. +// Extended version of CascOpenStorage +// Some operations (e.g. opening an online storage) may take long time. +// This callback allows an application to be notified about loading progress +// and even cancel the storage loading process typedef bool (WINAPI * PFNPROGRESSCALLBACK)( // Return 'true' to cancel the loading process void * PtrUserParam, // User-specific parameter passed to the callback LPCSTR szWork, // Text for the current activity (example: "Loading "ENCODING" file") LPCSTR szObject, // (optional) name of the object tied to the activity (example: index file name) - DWORD nCurrent, // (optional) current object being processed - DWORD nTotal // (optional) If non-zero, this is the total number of objects to process + DWORD CurrentValue, // (optional) current object being processed + DWORD TotalValue // (optional) If non-zero, this is the total number of objects to process ); -void WINAPI CascSetProgressCallback( - PFNPROGRESSCALLBACK PtrUserCallback, // Pointer to the callback function that will be called during opening the storage - void * PtrUserParam // Arbitrary user parameter that will be passed to the callback +// Some storages support multi-product installation (e.g. World of Warcraft). +// With this callback, the calling application can specify which storage to open +typedef bool (WINAPI * PFNPRODUCTCALLBACK)( // Return 'true' to cancel the loading process + void * PtrUserParam, // User-specific parameter passed to the callback + LPCSTR * ProductList, // Array of product codenames found in the storage + size_t ProductCount, // Number of products in the ProductList array + size_t * PtrSelectedProduct // [out] This is the selected product to open. On input, set to 0 (aka the first product) ); +typedef struct _CASC_OPEN_STORAGE_ARGS +{ + size_t Size; // Length of this structure. Initialize to sizeof(CASC_OPEN_STORAGE_ARGS) + + LPCTSTR szLocalPath; // Local: Path to the storage directory (where ".build.info: is) or any of the sub-path + // Online: Path to the local storage cache + + LPCTSTR szCodeName; // If non-null, this will specify a product in a multi-product local storage + // Has higher priority than PfnProductCallback (if both specified) + LPCTSTR szRegion; // If non-null, this will specify a product region. + + PFNPROGRESSCALLBACK PfnProgressCallback; // Progress callback. If non-NULL, this can inform the caller about state of the opening storage + void * PtrProgressParam; // Pointer-sized parameter that will be passed to PfnProgressCallback + PFNPRODUCTCALLBACK PfnProductCallback; // Progress callback. If non-NULL, will be called on multi-product storage to select one of the products + void * PtrProductParam; // Pointer-sized parameter that will be passed to PfnProgressCallback + + DWORD dwLocaleMask; // Locale mask to open + DWORD dwFlags; // Reserved. Set to zero. + + // + // Any additional member from here on must be checked for availability using the ExtractVersionedArgument function. + // Example: + // + // DWORD dwMyExtraMember = 0; + // ExtractVersionedArgument(pArgs, offsetof(CASC_OPEN_STORAGE_ARGS, dwMyExtraMember), &dwMyExtraMember); + // + +} CASC_OPEN_STORAGE_ARGS, *PCASC_OPEN_STORAGE_ARGS; + //----------------------------------------------------------------------------- // Functions for storage manipulation -bool WINAPI CascOpenStorage(LPCTSTR szDataPath, DWORD dwLocaleMask, HANDLE * phStorage); -bool WINAPI CascOpenOnlineStorage(LPCTSTR szLocalCache, LPCSTR szCodeName, LPCSTR szRegion, DWORD dwLocaleMask, HANDLE * phStorage); +bool WINAPI CascOpenStorageEx(LPCTSTR szParams, PCASC_OPEN_STORAGE_ARGS pArgs, bool bOnlineStorage, HANDLE * phStorage); +bool WINAPI CascOpenStorage(LPCTSTR szParams, DWORD dwLocaleMask, HANDLE * phStorage); +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); LPBYTE WINAPI CascFindEncryptionKey(HANDLE hStorage, ULONGLONG KeyName); -- cgit v1.2.3