1 /*
2   IMPORTANT NOTE: IF THIS FILE IS CHANGED, WININST-6.EXE MUST BE RECOMPILED
3   WITH THE MSVC6 WININST.DSW WORKSPACE FILE MANUALLY, AND WININST-7.1.EXE MUST
4   BE RECOMPILED WITH THE MSVC 2003.NET WININST-7.1.VCPROJ FILE MANUALLY.
5 
6   IF CHANGES TO THIS FILE ARE CHECKED INTO PYTHON CVS, THE RECOMPILED BINARIES
7   MUST BE CHECKED IN AS WELL!
8 */
9 
10 #pragma pack(1)
11 
12 /* zip-archive headers
13  * See: http://www.pkware.com/appnote.html
14  */
15 
16 struct eof_cdir {
17     long tag;           /* must be 0x06054b50 */
18     short disknum;
19     short firstdisk;
20     short nTotalCDirThis;
21     short nTotalCDir;
22     long nBytesCDir;
23     long ofsCDir;
24     short commentlen;
25 };
26 
27 struct cdir {
28     long tag;           /* must be 0x02014b50 */
29     short version_made;
30     short version_extract;
31     short gp_bitflag;
32     short comp_method;
33     short last_mod_file_time;
34     short last_mod_file_date;
35     long crc32;
36     long comp_size;
37     long uncomp_size;
38     short fname_length;
39     short extra_length;
40     short comment_length;
41     short disknum_start;
42     short int_file_attr;
43     long ext_file_attr;
44     long ofs_local_header;
45 };
46 
47 struct fhdr {
48     long tag;           /* must be 0x04034b50 */
49     short version_needed;
50     short flags;
51     short method;
52     short last_mod_file_time;
53     short last_mod_file_date;
54     long crc32;
55     long comp_size;
56     long uncomp_size;
57     short fname_length;
58     short extra_length;
59 };
60 
61 
62 struct meta_data_hdr {
63     int tag;
64     int uncomp_size;
65     int bitmap_size;
66 };
67 
68 #pragma pack()
69 
70 /* installation scheme */
71 
72 typedef struct tagSCHEME {
73     char *name;
74     char *prefix;
75 } SCHEME;
76 
77 typedef int (*NOTIFYPROC)(int code, LPSTR text, ...);
78 
79 extern BOOL
80 extract_file(char *dst, char *src, int method, int comp_size,
81              int uncomp_size, NOTIFYPROC notify);
82 
83 extern BOOL
84 unzip_archive(SCHEME *scheme, char *dirname, char *data,
85               DWORD size,  NOTIFYPROC notify);
86 
87 extern char *
88 map_new_file(DWORD flags, char *filename, char
89              *pathname_part, int size,
90              WORD wFatDate, WORD wFatTime,
91              NOTIFYPROC callback);
92 
93 extern BOOL
94 ensure_directory (char *pathname, char *new_part,
95                   NOTIFYPROC callback);
96 
97 /* codes for NOITIFYPROC */
98 #define DIR_CREATED 1
99 #define CAN_OVERWRITE 2
100 #define FILE_CREATED 3
101 #define ZLIB_ERROR 4
102 #define SYSTEM_ERROR 5
103 #define NUM_FILES 6
104 #define FILE_OVERWRITTEN 7
105 
106