1/*
2  api.h - Zip 3
3
4  Copyright (c) 1990-2007 Info-ZIP.  All rights reserved.
5
6  See the accompanying file LICENSE, version 2007-Mar-4 or later
7  (the contents of which are also included in zip.h) for terms of use.
8  If, for some reason, all these files are missing, the Info-ZIP license
9  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
10*/
11/* Only the Windows DLL is currently supported */
12#ifndef _ZIPAPI_H
13#define _ZIPAPI_H
14
15#include "zip.h"
16
17#ifdef WIN32
18#   ifndef PATH_MAX
19#      define PATH_MAX 260
20#   endif
21#else
22#   ifndef PATH_MAX
23#      define PATH_MAX 128
24#   endif
25#endif
26
27#if defined(WINDLL) || defined(API)
28#include <windows.h>
29/* Porting definations between Win 3.1x and Win32 */
30#ifdef WIN32
31#  define far
32#  define _far
33#  define __far
34#  define near
35#  define _near
36#  define __near
37#endif
38
39/*---------------------------------------------------------------------------
40    Prototypes for public Zip API (DLL) functions.
41  ---------------------------------------------------------------------------*/
42
43#define ZPVER_LEN    sizeof(ZpVer)
44/* These defines are set to zero for now, until OS/2 comes out
45   with a dll.
46 */
47#define D2_MAJORVER 0
48#define D2_MINORVER 0
49#define D2_PATCHLEVEL 0
50
51/* intended to be a private struct: */
52typedef struct _zip_ver {
53    uch major;              /* e.g., integer 5 */
54    uch minor;              /* e.g., 2 */
55    uch patchlevel;         /* e.g., 0 */
56    uch not_used;
57} _zip_version_type;
58
59typedef struct _ZpVer {
60    ulg structlen;          /* length of the struct being passed */
61    ulg flag;               /* bit 0: is_beta   bit 1: uses_zlib */
62    char betalevel[10];     /* e.g., "g BETA" or "" */
63    char date[20];          /* e.g., "4 Sep 95" (beta) or "4 September 1995" */
64    char zlib_version[10];  /* e.g., "0.95" or NULL */
65    BOOL fEncryption;       /* TRUE if encryption enabled, FALSE otherwise */
66    _zip_version_type zip;
67    _zip_version_type os2dll;
68    _zip_version_type windll;
69} ZpVer;
70
71#  ifndef EXPENTRY
72#    define EXPENTRY WINAPI
73#  endif
74
75#ifndef DEFINED_ONCE
76#define DEFINED_ONCE
77typedef int (WINAPI DLLPRNT) (LPSTR, unsigned long);
78typedef int (WINAPI DLLPASSWORD) (LPSTR, int, LPCSTR, LPCSTR);
79#endif
80#ifdef ZIP64_SUPPORT
81typedef int (WINAPI DLLSERVICE) (LPCSTR, unsigned __int64);
82typedef int (WINAPI DLLSERVICE_NO_INT64) (LPCSTR, unsigned long, unsigned long);
83#else
84typedef int (WINAPI DLLSERVICE) (LPCSTR, unsigned long);
85#endif
86typedef int (WINAPI DLLSPLIT) (LPSTR);
87typedef int (WINAPI DLLCOMMENT)(LPSTR);
88
89/* Structures */
90
91typedef struct {        /* zip options */
92LPSTR Date;             /* Date to include after */
93LPSTR szRootDir;        /* Directory to use as base for zipping */
94LPSTR szTempDir;        /* Temporary directory used during zipping */
95BOOL fTemp;             /* Use temporary directory '-b' during zipping */
96BOOL fSuffix;           /* include suffixes (not implemented) */
97BOOL fEncrypt;          /* encrypt files */
98BOOL fSystem;           /* include system and hidden files */
99BOOL fVolume;           /* Include volume label */
100BOOL fExtra;            /* Exclude extra attributes */
101BOOL fNoDirEntries;     /* Do not add directory entries */
102BOOL fExcludeDate;      /* Exclude files newer than specified date */
103BOOL fIncludeDate;      /* Include only files newer than specified date */
104BOOL fVerbose;          /* Mention oddities in zip file structure */
105BOOL fQuiet;            /* Quiet operation */
106BOOL fCRLF_LF;          /* Translate CR/LF to LF */
107BOOL fLF_CRLF;          /* Translate LF to CR/LF */
108BOOL fJunkDir;          /* Junk directory names */
109BOOL fGrow;             /* Allow appending to a zip file */
110BOOL fForce;            /* Make entries using DOS names (k for Katz) */
111BOOL fMove;             /* Delete files added or updated in zip file */
112BOOL fDeleteEntries;    /* Delete files from zip file */
113BOOL fUpdate;           /* Update zip file--overwrite only if newer */
114BOOL fFreshen;          /* Freshen zip file--overwrite only */
115BOOL fJunkSFX;          /* Junk SFX prefix */
116BOOL fLatestTime;       /* Set zip file time to time of latest file in it */
117BOOL fComment;          /* Put comment in zip file */
118BOOL fOffsets;          /* Update archive offsets for SFX files */
119BOOL fPrivilege;        /* Use privileges (WIN32 only) */
120BOOL fEncryption;       /* TRUE if encryption supported, else FALSE.
121                           this is a read only flag */
122LPSTR szSplitSize;      /* This string contains the size that you want to
123                           split the archive into. i.e. 100 for 100 bytes,
124                           2K for 2 k bytes, where K is 1024, m for meg
125                           and g for gig. If this string is not NULL it
126                           will automatically be assumed that you wish to
127                           split an archive. */
128LPSTR szIncludeList;    /* Pointer to include file list string (for VB) */
129long IncludeListCount;  /* Count of file names in the include list array */
130char **IncludeList;     /* Pointer to include file list array. Note that the last
131                           entry in the array must be NULL */
132LPSTR szExcludeList;    /* Pointer to exclude file list (for VB) */
133long ExcludeListCount;  /* Count of file names in the include list array */
134char **ExcludeList;     /* Pointer to exclude file list array. Note that the last
135                           entry in the array must be NULL */
136int  fRecurse;          /* Recurse into subdirectories. 1 => -r, 2 => -R */
137int  fRepair;           /* Repair archive. 1 => -F, 2 => -FF */
138char fLevel;            /* Compression level (0 - 9) */
139} ZPOPT, _far *LPZPOPT;
140
141typedef struct {
142  int  argc;            /* Count of files to zip */
143  LPSTR lpszZipFN;      /* name of archive to create/update */
144  char **FNV;           /* array of file names to zip up */
145  LPSTR lpszAltFNL;     /* pointer to a string containing a list of file
146                           names to zip up, separated by whitespace. Intended
147                           for use only by VB users, all others should set this
148                           to NULL. */
149} ZCL, _far *LPZCL;
150
151typedef struct {
152  DLLPRNT *print;
153  DLLCOMMENT *comment;
154  DLLPASSWORD *password;
155  DLLSPLIT *split;      /* This MUST be set to NULL unless you want to be queried
156                           for a destination for each split archive. */
157#ifdef ZIP64_SUPPORT
158  DLLSERVICE *ServiceApplication64;
159  DLLSERVICE_NO_INT64 *ServiceApplication64_No_Int64;
160#else
161  DLLSERVICE *ServiceApplication;
162#endif
163} ZIPUSERFUNCTIONS, far * LPZIPUSERFUNCTIONS;
164
165extern LPZIPUSERFUNCTIONS lpZipUserFunctions;
166
167void  EXPENTRY ZpVersion(ZpVer far *);
168int   EXPENTRY ZpInit(LPZIPUSERFUNCTIONS lpZipUserFunc);
169int   EXPENTRY ZpArchive(ZCL C, LPZPOPT Opts);
170
171#if defined(ZIPLIB) || defined(COM_OBJECT)
172#   define ydays zp_ydays
173#endif
174
175
176
177/* Functions not yet supported */
178#if 0
179int      EXPENTRY ZpMain            (int argc, char **argv);
180int      EXPENTRY ZpAltMain         (int argc, char **argv, ZpInit *init);
181#endif
182#endif /* WINDLL? || API? */
183
184#endif /* _ZIPAPI_H */
185