1
/* zip.h -- IO for compress .zip files using zlib
2
Version 0.15 alpha, Mar 19th, 1998,
4
Copyright (C) 1998 Gilles Vollant
6
This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
7
WinZip, InfoZip tools and compatible.
8
Encryption and multi volume ZipFile (span) are not supported.
9
Old compressions used by old PKZip 1.x are not supported
11
For uncompress .zip file, look at unzip.h
13
THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
14
CAN CHANGE IN FUTURE VERSION !!
15
I WAIT FEEDBACK at mail info@winimage.com
16
Visit also http://www.winimage.com/zLibDll/zip.htm for evolution
18
Condition of use and distribution are the same than zlib :
20
This software is provided 'as-is', without any express or implied
21
warranty. In no event will the authors be held liable for any damages
22
arising from the use of this software.
24
Permission is granted to anyone to use this software for any purpose,
25
including commercial applications, and to alter it and redistribute it
26
freely, subject to the following restrictions:
28
1. The origin of this software must not be misrepresented; you must not
29
claim that you wrote the original software. If you use this software
30
in a product, an acknowledgment in the product documentation would be
31
appreciated but is not required.
32
2. Altered source versions must be plainly marked as such, and must not be
33
misrepresented as being the original software.
34
3. This notice may not be removed or altered from any source distribution.
39
/* for more info about .ZIP format, see
40
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
41
PkWare has also a specification at :
42
ftp://ftp.pkware.com/probdesc.zip
56
#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
57
/* like the STRICT of WIN32, we define a pointer that cannot be converted
58
from (void*) without cast */
59
typedef struct TagzipFile__ { int unused; } zipFile__;
60
typedef zipFile__ *zipFile;
62
typedef voidp zipFile;
66
#define ZIP_ERRNO (Z_ERRNO)
67
#define ZIP_PARAMERROR (-102)
68
#define ZIP_INTERNALERROR (-104)
70
/* tm_zip contain date/time info */
71
typedef struct tm_zip_s
73
uInt tm_sec; /* seconds after the minute - [0,59] */
74
uInt tm_min; /* minutes after the hour - [0,59] */
75
uInt tm_hour; /* hours since midnight - [0,23] */
76
uInt tm_mday; /* day of the month - [1,31] */
77
uInt tm_mon; /* months since January - [0,11] */
78
uInt tm_year; /* years - [1980..2044] */
83
tm_zip tmz_date; /* date in understandable format */
84
uLong dosDate; /* if dos_date == 0, tmu_date is used */
85
/* uLong flag; */ /* general purpose bit flag 2 bytes */
87
uLong internal_fa; /* internal file attributes 2 bytes */
88
uLong external_fa; /* external file attributes 4 bytes */
91
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
94
pathname contain on Windows NT a filename like "c:\\zlib\\zlib111.zip" or on
95
an Unix computer "zlib/zlib111.zip".
96
if the file pathname exist and append=1, the zip will be created at the end
97
of the file. (useful if the file contain a self extractor code)
98
If the zipfile cannot be opened, the return value is NULL.
99
Else, the return value is a zipFile Handle, usable with other function
105
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
106
const char* filename,
107
const zip_fileinfo* zipfi,
108
const void* extrafield_local,
109
uInt size_extrafield_local,
110
const void* extrafield_global,
111
uInt size_extrafield_global,
116
Open a file in the ZIP for writing.
117
filename : the filename in zip (if NULL, '-' without quote will be used
118
*zipfi contain supplemental information
119
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
120
contains the extrafield data the the local header
121
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
122
contains the extrafield data the the local header
123
if comment != NULL, comment contain the comment string
124
method contain the compression method (0 for store, Z_DEFLATED for deflate)
125
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
128
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
132
Write data in the zipfile
135
extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
137
Close the current file in the zipfile
140
extern int ZEXPORT zipClose OF((zipFile file,
141
const char* global_comment));