19 #pragma warning(disable:4668) // 'XXX' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
20 #pragma warning(disable:4820) // 'XXX' : '2' bytes padding added after data member 'XXX::yyy'
32 #define CASCLIB_VERSION 0x0100 // Current version of CascLib (1.0)
33 #define CASCLIB_VERSION_STRING "1.00" // String version of CascLib version
35 #define ERROR_UNKNOWN_FILE_KEY 10001 // Returned by encrypted stream when can't find file key
36 #define ERROR_FILE_INCOMPLETE 10006 // The required file part is missing
39 #define CASC_STOR_XXXXX 0x00000001 // Not used
42 #define CASC_OPEN_BY_ENCODING_KEY 0x00000001 // The name is just the encoding key; skip ROOT file processing
45 #define BASE_PROVIDER_FILE 0x00000000 // Base data source is a file
46 #define BASE_PROVIDER_MAP 0x00000001 // Base data source is memory-mapped file
47 #define BASE_PROVIDER_HTTP 0x00000002 // Base data source is a file on web server
48 #define BASE_PROVIDER_MASK 0x0000000F // Mask for base provider value
50 #define STREAM_PROVIDER_FLAT 0x00000000 // Stream is linear with no offset mapping
51 #define STREAM_PROVIDER_PARTIAL 0x00000010 // Stream is partial file (.part)
52 #define STREAM_PROVIDER_ENCRYPTED 0x00000020 // Stream is an encrypted archive
53 #define STREAM_PROVIDER_BLOCK4 0x00000030 // 0x4000 per block, text MD5 after each block, max 0x2000 blocks per file
54 #define STREAM_PROVIDER_MASK 0x000000F0 // Mask for stream provider value
56 #define STREAM_FLAG_READ_ONLY 0x00000100 // Stream is read only
57 #define STREAM_FLAG_WRITE_SHARE 0x00000200 // Allow write sharing when open for write
58 #define STREAM_FLAG_USE_BITMAP 0x00000400 // If the file has a file bitmap, load it and use it
59 #define STREAM_OPTIONS_MASK 0x0000FF00 // Mask for stream options
61 #define STREAM_PROVIDERS_MASK 0x000000FF // Mask to get stream providers
62 #define STREAM_FLAGS_MASK 0x0000FFFF // Mask for all stream flags (providers+options)
64 #define CASC_LOCALE_ALL 0xFFFFFFFF
65 #define CASC_LOCALE_NONE 0x00000000
66 #define CASC_LOCALE_UNKNOWN1 0x00000001
67 #define CASC_LOCALE_ENUS 0x00000002
68 #define CASC_LOCALE_KOKR 0x00000004
69 #define CASC_LOCALE_RESERVED 0x00000008
70 #define CASC_LOCALE_FRFR 0x00000010
71 #define CASC_LOCALE_DEDE 0x00000020
72 #define CASC_LOCALE_ZHCN 0x00000040
73 #define CASC_LOCALE_ESES 0x00000080
74 #define CASC_LOCALE_ZHTW 0x00000100
75 #define CASC_LOCALE_ENGB 0x00000200
76 #define CASC_LOCALE_ENCN 0x00000400
77 #define CASC_LOCALE_ENTW 0x00000800
78 #define CASC_LOCALE_ESMX 0x00001000
79 #define CASC_LOCALE_RURU 0x00002000
80 #define CASC_LOCALE_PTBR 0x00004000
81 #define CASC_LOCALE_ITIT 0x00008000
82 #define CASC_LOCALE_PTPT 0x00010000
84 #define CASC_LOCALE_BIT_ENUS 0x01
85 #define CASC_LOCALE_BIT_KOKR 0x02
86 #define CASC_LOCALE_DUAL_LANG 0x03
87 #define CASC_LOCALE_BIT_FRFR 0x04
88 #define CASC_LOCALE_BIT_DEDE 0x05
89 #define CASC_LOCALE_BIT_ZHCN 0x06
90 #define CASC_LOCALE_BIT_ESES 0x07
91 #define CASC_LOCALE_BIT_ZHTW 0x08
92 #define CASC_LOCALE_BIT_ENGB 0x09
93 #define CASC_LOCALE_BIT_ENCN 0x0A
94 #define CASC_LOCALE_BIT_ENTW 0x0B
95 #define CASC_LOCALE_BIT_ESMX 0x0C
96 #define CASC_LOCALE_BIT_RURU 0x0D
97 #define CASC_LOCALE_BIT_PTBR 0x0E
98 #define CASC_LOCALE_BIT_ITIT 0x0F
99 #define CASC_LOCALE_BIT_PTPT 0x10
102 #define MAX_CASC_KEY_LENGTH 0x10 // Maximum length of the key (equal to MD5 hash)
104 #ifndef MD5_HASH_SIZE
105 #define MD5_HASH_SIZE 0x10
106 #define MD5_STRING_SIZE 0x20
109 #ifndef SHA1_DIGEST_SIZE
110 #define SHA1_DIGEST_SIZE 0x14 // 160 bits
114 #define LANG_NEUTRAL 0x00 // Neutral locale
118 #define CASC_INVALID_SIZE 0xFFFFFFFF
119 #define CASC_INVALID_POS 0xFFFFFFFF
122 #define CASC_FEATURE_LISTFILE 0x00000001 // The storage supports listfile
164 void qsort_pointer_array(
void ** base,
size_t num,
int (*compare)(
const void *,
const void *,
const void *),
const void * context);
188 #ifndef PLATFORM_WINDOWS
193 #endif // PLATFORM_WINDOWS
199 #endif // __CASCLIB_H__
Definition: CascLib.h:131
DWORD WINAPI CascSetFilePointer(HANDLE hFile, LONG lFilePos, LONG *plFilePosHigh, DWORD dwMoveMethod)
Definition: CascReadFile.cpp:395
Definition: CascLib.h:132
void * HANDLE
Definition: CascPort.h:146
unsigned long long ULONGLONG
Definition: CascPort.h:144
DWORD * PDWORD
Definition: CascPort.h:151
char * szPlainName
Definition: CascLib.h:148
Definition: CascLib.h:138
#define MAX_PATH
Definition: CascPort.h:160
HANDLE WINAPI CascFindFirstFile(HANDLE hStorage, const char *szMask, PCASC_FIND_DATA pFindData, const TCHAR *szListFile)
Definition: CascFindFile.cpp:248
char TCHAR
Definition: CascPort.h:148
void qsort_pointer_array(void **base, size_t num, int(*compare)(const void *, const void *, const void *), const void *context)
Definition: Common.cpp:533
struct _QUERY_KEY QUERY_KEY
_CASC_STORAGE_INFO_CLASS
Definition: CascLib.h:127
struct _CASC_FIND_DATA * PCASC_FIND_DATA
int LONG
Definition: CascPort.h:138
Definition: CascLib.h:129
BYTE * LPBYTE
Definition: CascPort.h:152
bool WINAPI CascOpenFileByIndexKey(HANDLE hStorage, PQUERY_KEY pIndexKey, DWORD dwFlags, HANDLE *phFile)
Definition: CascOpenFile.cpp:150
#define WINAPI
Definition: CascPort.h:163
Definition: CascLib.h:145
DWORD cbData
Definition: CascLib.h:141
DWORD dwFileSize
Definition: CascLib.h:151
#define MD5_HASH_SIZE
Definition: CascLib.h:105
bool WINAPI CascCloseStorage(HANDLE hStorage)
Definition: CascOpenStorage.cpp:1133
Definition: CascLib.h:130
void SetLastError(int nError)
Definition: Common.cpp:75
bool WINAPI CascGetStorageInfo(HANDLE hStorage, CASC_STORAGE_INFO_CLASS InfoClass, void *pvStorageInfo, size_t cbStorageInfo, size_t *pcbLengthNeeded)
Definition: CascOpenStorage.cpp:1075
TCHAR * szFileName
Definition: FileStream.h:182
LPBYTE pbData
Definition: CascLib.h:140
void(WINAPI * STREAM_DOWNLOAD_CALLBACK)(void *pvUserData, ULONGLONG ByteOffset, DWORD dwTotalBytes)
Definition: CascLib.h:159
BYTE EncodingKey[MD5_HASH_SIZE]
Definition: CascLib.h:149
DWORD WINAPI CascGetFileSize(HANDLE hFile, PDWORD pdwFileSizeHigh)
Definition: CascReadFile.cpp:367
enum _CASC_STORAGE_INFO_CLASS * PCASC_STORAGE_INFO_CLASS
unsigned int DWORD
Definition: CascPort.h:139
bool WINAPI CascFindNextFile(HANDLE hFind, PCASC_FIND_DATA pFindData)
Definition: CascFindFile.cpp:293
char szFileName[MAX_PATH]
Definition: CascLib.h:147
int GetLastError()
Definition: Common.cpp:70
bool WINAPI CascFindClose(HANDLE hFind)
Definition: CascFindFile.cpp:310
bool WINAPI CascCloseFile(HANDLE hFile)
Definition: CascOpenFile.cpp:273
DWORD dwLocaleFlags
Definition: CascLib.h:150
DWORD dwFlags
Definition: FileStream.h:187
bool WINAPI CascOpenFileByEncodingKey(HANDLE hStorage, PQUERY_KEY pEncodingKey, DWORD dwFlags, HANDLE *phFile)
Definition: CascOpenFile.cpp:173
bool WINAPI CascReadFile(HANDLE hFile, void *lpBuffer, DWORD dwToRead, PDWORD pdwRead)
Definition: CascReadFile.cpp:459
Definition: FileStream.h:153
enum _CASC_STORAGE_INFO_CLASS CASC_STORAGE_INFO_CLASS
struct _QUERY_KEY * PQUERY_KEY
bool WINAPI CascOpenStorage(const TCHAR *szDataPath, DWORD dwLocaleMask, HANDLE *phStorage)
Definition: CascOpenStorage.cpp:1011
unsigned char BYTE
Definition: CascPort.h:136
Definition: CascLib.h:133
struct _CASC_FIND_DATA CASC_FIND_DATA
bool WINAPI CascOpenFile(HANDLE hStorage, const char *szFileName, DWORD dwLocale, DWORD dwFlags, HANDLE *phFile)
Definition: CascOpenFile.cpp:196