Repository navigation
Expand file tree
/
Copy pathapi.h
More file actions
131 lines (104 loc) · 3.1 KB
/
Copy pathapi.h
File metadata and controls
131 lines (104 loc) · 3.1 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef UNPACKRAT_API_H
#define UNPACKRAT_API_H
/**
This file is licensed under the GNU LGPLv3.
It includes/modifies code originally from Observer (https://github.com/lazyhamster/Observer).
**/
// The minimum required platform is Windows Vista. WINVER and _WIN32_WINNT (both 0x0600) are
// supplied as compiler definitions by the shared MSBuild toolchain in build/unpackrat-project.props,
// so this header no longer declares the reserved _WIN32_WINNT identifier itself.
// Exclude rarely-used stuff from Windows headers.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define MODULE_EXPORT __stdcall
// Extract progress callbacks
typedef int(CALLBACK *ExtractProgressFunc)(HANDLE, __int64);
#pragma pack(push, 1)
struct ExtractProcessCallbacks
{
HANDLE signalContext;
ExtractProgressFunc FileProgress;
};
#define ACTUAL_API_VERSION 6
#define STORAGE_FORMAT_NAME_MAX_LEN 32
#define STORAGE_PARAM_MAX_LEN 64
struct StorageGeneralInfo
{
wchar_t Format[STORAGE_FORMAT_NAME_MAX_LEN];
wchar_t Compression[STORAGE_PARAM_MAX_LEN];
wchar_t Comment[STORAGE_PARAM_MAX_LEN];
FILETIME Created;
};
struct StorageOpenParams
{
size_t StructSize;
const wchar_t *FilePath;
const char *Password;
const void *Data;
size_t DataSize;
};
struct StorageItemInfo
{
__int64 Size;
__int64 PackedSize;
DWORD Attributes;
FILETIME CreationTime;
FILETIME ModificationTime;
WORD NumHardlinks;
wchar_t Owner[64];
wchar_t Path[1024];
};
struct ExtractOperationParams
{
int ItemIndex;
int Flags;
const wchar_t *DestPath;
const char *Password;
ExtractProcessCallbacks Callbacks;
};
typedef int(MODULE_EXPORT *OpenStorageFunc)(StorageOpenParams params, HANDLE *storage, StorageGeneralInfo *info);
typedef int(MODULE_EXPORT *PrepareFilesFunc)(HANDLE storage);
typedef void(MODULE_EXPORT *CloseStorageFunc)(HANDLE storage);
typedef int(MODULE_EXPORT *GetItemFunc)(HANDLE storage, int item_index, StorageItemInfo *item_info);
typedef int(MODULE_EXPORT *ExtractFunc)(HANDLE storage, ExtractOperationParams params);
struct module_cbs
{
OpenStorageFunc OpenStorage;
CloseStorageFunc CloseStorage;
GetItemFunc GetItem;
ExtractFunc ExtractItem;
PrepareFilesFunc PrepareFiles;
};
struct ModuleLoadParameters
{
// IN
size_t StructSize;
const wchar_t *Settings;
// OUT
GUID ModuleId;
DWORD ModuleVersion;
DWORD ApiVersion;
module_cbs ApiFuncs;
};
#pragma pack(pop)
// Function that should be exported from modules
typedef int(MODULE_EXPORT *LoadSubModuleFunc)(ModuleLoadParameters *);
typedef void(MODULE_EXPORT *UnloadSubModuleFunc)(void);
#define MAKEMODULEVERSION(mj, mn) (((mj) << 16U) | (mn))
#define STRBUF_SIZE(x) (sizeof(x) / sizeof((x)[0]))
// Open storage return results
#define SOR_INVALID_FILE 0
#define SOR_SUCCESS 1
#define SOR_PASSWORD_REQUIRED 2
// Item retrieval result
#define GET_ITEM_ERROR 0
#define GET_ITEM_OK 1
#define GET_ITEM_NOMOREITEMS 2
// Extract result
#define SER_SUCCESS 0
#define SER_ERROR_WRITE 1
#define SER_ERROR_READ 2
#define SER_ERROR_SYSTEM 3
#define SER_USERABORT 4
#define SER_PASSWORD_REQUIRED 5
#endif