-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcasc.pxd
100 lines (84 loc) · 4.06 KB
/
casc.pxd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
from libcpp cimport bool
cdef extern from "Python.h":
char *PyString_AsString(object)
cdef extern from "CascLib.h":
ctypedef unsigned long size_t
ctypedef unsigned char BYTE;
ctypedef unsigned short USHORT;
ctypedef int LONG;
ctypedef unsigned int DWORD;
ctypedef long long LONGLONG;
ctypedef signed long long LONGLONG;
ctypedef signed long long *PLONGLONG;
ctypedef unsigned long long ULONGLONG;
ctypedef unsigned long long *PULONGLONG;
ctypedef void * HANDLE;
ctypedef char TCHAR;
ctypedef unsigned int LCID;
ctypedef LONG * PLONG;
ctypedef DWORD * PDWORD;
ctypedef BYTE * LPBYTE;
ctypedef char * LPSTR;
ctypedef const char * LPCSTR;
ctypedef TCHAR * LPTSTR;
ctypedef const TCHAR * LPCTSTR;
ctypedef bool (* PFNPRODUCTCALLBACK)\
(
void * PtrUserParam,
LPCSTR * ProductList,
size_t ProductCount,
size_t * PtrSelectedProduct
)
ctypedef bool (* PFNPROGRESSCALLBACK)\
(
void * PtrUserParam,
LPCSTR szWork,
LPCSTR szObject,
DWORD CurrentValue,
DWORD TotalValue
)
ctypedef struct CASC_OPEN_STORAGE_ARGS:
size_t Size
LPCTSTR szLocalPath
LPCTSTR szCodeName
LPCTSTR szRegion
PFNPROGRESSCALLBACK PfnProgressCallback
void * PtrProgressParam
PFNPRODUCTCALLBACK PfnProductCallback
void * PtrProductParam
DWORD dwLocaleMask
DWORD dwFlags
LPCTSTR szBuildKey
ctypedef CASC_OPEN_STORAGE_ARGS* PCASC_OPEN_STORAGE_ARGS
ctypedef 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
ctypedef struct CASC_FILE_FULL_INFO:
BYTE CKey[16] # CKey
BYTE EKey[16] # EKey
char DataFileName[0x10] # Plain name of the data file where the file is stored
ULONGLONG StorageOffset # Offset of the file over the entire storage
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 LocaleFlags # Locale flags. CASC_INVALID_ID if not supported.
DWORD ContentFlags # Locale flags. CASC_INVALID_ID if not supported
bool CascOpenStorageEx(LPCTSTR szParams, PCASC_OPEN_STORAGE_ARGS pArgs, bool bOnlineStorage, void** phStorage)
bool CascOpenStorage(LPCTSTR szParams, DWORD dwLocaleMask, void ** phStorage)
bool CascOpenOnlineStorage(LPCTSTR szParams, DWORD dwLocaleMask, HANDLE * phStorage)
bool CascOpenFile(HANDLE hStorage, const void * pvFileName, DWORD dwLocaleFlags, DWORD dwOpenFlags, void** PtrFileHandle)
DWORD CascGetFileSize(HANDLE hFile, PDWORD pdwFileSizeHigh);
bool CascGetFileSize64(HANDLE hFile, PULONGLONG PtrFileSize)
bool CascReadFile(HANDLE hFile, void * lpBuffer, DWORD dwToRead, PDWORD pdwRead)
bool CascCloseFile(void* hFile)
bool CascCloseStorage(void* hStorage)
bool CascGetFileInfo(HANDLE hFile, CASC_FILE_INFO_CLASS InfoClass, void* pvFileInfo, size_t cbFileInfo, size_t* pcbLengthNeeded)
DWORD GetCascError()