Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CS_ZIP_H__
00021 #define __CS_ZIP_H__
00022
00027 #if defined(__cplusplus) && !defined(CS_COMPILER_BCC)
00028 extern "C" {
00029 #endif
00030
00031 #define Byte z_Byte
00032 #include <zlib.h>
00033 #undef Byte
00034
00035 #if defined(__cplusplus) && !defined(CS_COMPILER_BCC)
00036 }
00037 #endif
00038
00039 #define CENTRAL_HDR_SIG '\001','\002'
00040 #define LOCAL_HDR_SIG '\003','\004'
00041 #define END_CENTRAL_SIG '\005','\006'
00042 #define EXTD_LOCAL_SIG '\007','\010'
00043
00044 #define DEF_WBITS 15
00045 #define ZIP_STORE 0
00046 #define ZIP_DEFLATE 8
00047
00048 typedef uint8 uch;
00049 typedef uint16 ush;
00050 typedef uint32 u32;
00051
00052 #if 0
00053 # define CRCVAL_INITIAL crc32(0L, 0, 0)
00054 #else
00055 # define CRCVAL_INITIAL 0L
00056 #endif
00057
00058 typedef struct
00059 {
00060 uch version_needed_to_extract[2];
00061 ush general_purpose_bit_flag;
00062 ush compression_method;
00063 ush last_mod_file_time;
00064 ush last_mod_file_date;
00065 u32 crc32;
00066 u32 csize;
00067 u32 ucsize;
00068 ush filename_length;
00069 ush extra_field_length;
00070 } ZIP_local_file_header;
00071
00072 typedef struct
00073 {
00074 uch version_made_by[2];
00075 uch version_needed_to_extract[2];
00076 ush general_purpose_bit_flag;
00077 ush compression_method;
00078 ush last_mod_file_time;
00079 ush last_mod_file_date;
00080 u32 crc32;
00081 u32 csize;
00082 u32 ucsize;
00083 ush filename_length;
00084 ush extra_field_length;
00085 ush file_comment_length;
00086 ush disk_number_start;
00087 ush internal_file_attributes;
00088 u32 external_file_attributes;
00089 u32 relative_offset_local_header;
00090 } ZIP_central_directory_file_header;
00091
00092 typedef struct
00093 {
00094 ush number_this_disk;
00095 ush num_disk_start_cdir;
00096 ush num_entries_centrl_dir_ths_disk;
00097 ush total_entries_central_dir;
00098 u32 size_central_directory;
00099 u32 offset_start_central_directory;
00100 ush zipfile_comment_length;
00101 } ZIP_end_central_dir_record;
00102
00103
00104 #define ZIP_LOCAL_FILE_HEADER_SIZE 26
00105 # define L_VERSION_NEEDED_TO_EXTRACT_0 0
00106 # define L_VERSION_NEEDED_TO_EXTRACT_1 1
00107 # define L_GENERAL_PURPOSE_BIT_FLAG 2
00108 # define L_COMPRESSION_METHOD 4
00109 # define L_LAST_MOD_FILE_TIME 6
00110 # define L_LAST_MOD_FILE_DATE 8
00111 # define L_CRC32 10
00112 # define L_COMPRESSED_SIZE 14
00113 # define L_UNCOMPRESSED_SIZE 18
00114 # define L_FILENAME_LENGTH 22
00115 # define L_EXTRA_FIELD_LENGTH 24
00116
00117
00118 #define ZIP_CENTRAL_DIRECTORY_FILE_HEADER_SIZE 42
00119 # define C_VERSION_MADE_BY_0 0
00120 # define C_VERSION_MADE_BY_1 1
00121 # define C_VERSION_NEEDED_TO_EXTRACT_0 2
00122 # define C_VERSION_NEEDED_TO_EXTRACT_1 3
00123 # define C_GENERAL_PURPOSE_BIT_FLAG 4
00124 # define C_COMPRESSION_METHOD 6
00125 # define C_LAST_MOD_FILE_TIME 8
00126 # define C_LAST_MOD_FILE_DATE 10
00127 # define C_CRC32 12
00128 # define C_COMPRESSED_SIZE 16
00129 # define C_UNCOMPRESSED_SIZE 20
00130 # define C_FILENAME_LENGTH 24
00131 # define C_EXTRA_FIELD_LENGTH 26
00132 # define C_FILE_COMMENT_LENGTH 28
00133 # define C_DISK_NUMBER_START 30
00134 # define C_INTERNAL_FILE_ATTRIBUTES 32
00135 # define C_EXTERNAL_FILE_ATTRIBUTES 34
00136 # define C_RELATIVE_OFFSET_LOCAL_HEADER 38
00137
00138
00139 #define ZIP_END_CENTRAL_DIR_RECORD_SIZE 18
00140 # define E_NUMBER_THIS_DISK 0
00141 # define E_NUM_DISK_WITH_START_CENTRAL_DIR 2
00142 # define E_NUM_ENTRIES_CENTRL_DIR_THS_DISK 4
00143 # define E_TOTAL_ENTRIES_CENTRAL_DIR 6
00144 # define E_SIZE_CENTRAL_DIRECTORY 8
00145 # define E_OFFSET_START_CENTRAL_DIRECTORY 12
00146 # define E_ZIPFILE_COMMENT_LENGTH 16
00147
00148 #endif // __CS_ZIP_H__