blob: 977898cd6779489efca5634789c92123f6691ff5 [file] [log] [blame]
Thomas Hellerbb4b7d22002-11-22 20:39:33 +00001#pragma pack(1)
2
3/* zip-archive headers
4 * See: http://www.pkware.com/appnote.html
5 */
6
7struct eof_cdir {
8 long tag; /* must be 0x06054b50 */
9 short disknum;
10 short firstdisk;
11 short nTotalCDirThis;
12 short nTotalCDir;
13 long nBytesCDir;
14 long ofsCDir;
15 short commentlen;
16};
17
18struct cdir {
19 long tag; /* must be 0x02014b50 */
20 short version_made;
21 short version_extract;
22 short gp_bitflag;
23 short comp_method;
24 short last_mod_file_time;
25 short last_mod_file_date;
26 long crc32;
27 long comp_size;
28 long uncomp_size;
29 short fname_length;
30 short extra_length;
31 short comment_length;
32 short disknum_start;
33 short int_file_attr;
34 long ext_file_attr;
35 long ofs_local_header;
36};
37
38struct fhdr {
39 long tag; /* must be 0x04034b50 */
40 short version_needed;
41 short flags;
42 short method;
43 short last_mod_file_time;
44 short last_mod_file_date;
45 long crc32;
46 long comp_size;
47 long uncomp_size;
48 short fname_length;
49 short extra_length;
50};
51
52
53struct meta_data_hdr {
54 int tag;
55 int uncomp_size;
56 int bitmap_size;
57};
58
59#pragma pack()
60
61/* installation scheme */
62
63typedef struct tagSCHEME {
64 char *name;
65 char *prefix;
66} SCHEME;
67
68typedef int (*NOTIFYPROC)(int code, LPSTR text, ...);
69
70extern BOOL
71extract_file(char *dst, char *src, int method, int comp_size,
72 int uncomp_size, NOTIFYPROC notify);
73
74extern BOOL
75unzip_archive(SCHEME *scheme, char *dirname, char *data,
76 DWORD size, NOTIFYPROC notify);
77
78extern char *
79map_new_file(DWORD flags, char *filename, char
80 *pathname_part, int size,
81 WORD wFatDate, WORD wFatTime,
82 NOTIFYPROC callback);
83
84extern BOOL
85ensure_directory (char *pathname, char *new_part,
86 NOTIFYPROC callback);
87
88/* codes for NOITIFYPROC */
89#define DIR_CREATED 1
90#define CAN_OVERWRITE 2
91#define FILE_CREATED 3
92#define ZLIB_ERROR 4
93#define SYSTEM_ERROR 5
94#define NUM_FILES 6
95#define FILE_OVERWRITTEN 7
96