Thomas Heller | bb4b7d2 | 2002-11-22 20:39:33 +0000 | [diff] [blame^] | 1 | #pragma pack(1) |
| 2 | |
| 3 | /* zip-archive headers |
| 4 | * See: http://www.pkware.com/appnote.html |
| 5 | */ |
| 6 | |
| 7 | struct 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 | |
| 18 | struct 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 | |
| 38 | struct 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 | |
| 53 | struct meta_data_hdr { |
| 54 | int tag; |
| 55 | int uncomp_size; |
| 56 | int bitmap_size; |
| 57 | }; |
| 58 | |
| 59 | #pragma pack() |
| 60 | |
| 61 | /* installation scheme */ |
| 62 | |
| 63 | typedef struct tagSCHEME { |
| 64 | char *name; |
| 65 | char *prefix; |
| 66 | } SCHEME; |
| 67 | |
| 68 | typedef int (*NOTIFYPROC)(int code, LPSTR text, ...); |
| 69 | |
| 70 | extern BOOL |
| 71 | extract_file(char *dst, char *src, int method, int comp_size, |
| 72 | int uncomp_size, NOTIFYPROC notify); |
| 73 | |
| 74 | extern BOOL |
| 75 | unzip_archive(SCHEME *scheme, char *dirname, char *data, |
| 76 | DWORD size, NOTIFYPROC notify); |
| 77 | |
| 78 | extern char * |
| 79 | map_new_file(DWORD flags, char *filename, char |
| 80 | *pathname_part, int size, |
| 81 | WORD wFatDate, WORD wFatTime, |
| 82 | NOTIFYPROC callback); |
| 83 | |
| 84 | extern BOOL |
| 85 | ensure_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 | |