1 /*
2   Copyright (c) 1990-2009 Info-ZIP.  All rights reserved.
3 
4   See the accompanying file LICENSE, version 2009-Jan-02 or later
5   (the contents of which are also included in unzip.h) for terms of use.
6   If, for some reason, all these files are missing, the Info-ZIP license
7   also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
8 */
9 #ifndef __unzip_structs_h
10 #define __unzip_structs_h
11 
12 #ifndef Far
13 #  define Far far
14 #endif
15 
16 /* Porting definitions between Win 3.1x and Win32 */
17 #ifdef WIN32
18 #  define far
19 #  define _far
20 #  define __far
21 #  define near
22 #  define _near
23 #  define __near
24 #  ifndef FAR
25 #    define FAR
26 #  endif
27 #endif
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #ifndef Z_UINT8_DEFINED
34 # if defined(__GNUC__)
35    typedef unsigned long long    z_uint8;
36 #  define Z_UINT8_DEFINED
37 # elif (defined(_MSC_VER) && (_MSC_VER >= 1100))
38    typedef unsigned __int64      z_uint8;
39 #  define Z_UINT8_DEFINED
40 # elif (defined(__WATCOMC__) && (__WATCOMC__ >= 1100))
41    typedef unsigned __int64      z_uint8;
42 #  define Z_UINT8_DEFINED
43 # elif (defined(__IBMC__) && (__IBMC__ >= 350))
44    typedef unsigned __int64      z_uint8;
45 #  define Z_UINT8_DEFINED
46 # elif (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0500))
47    typedef unsigned __int64      z_uint8;
48 #  define Z_UINT8_DEFINED
49 # elif (defined(__LCC__))
50    typedef unsigned __int64      z_uint8;
51 #  define Z_UINT8_DEFINED
52 # endif
53 #endif
54 
55 /* The following "function" types are jointly defined in both Zip and UnZip
56  * DLLs.  They are guarded by the DEFINED_ONCE symbol to prevent multiple
57  * declarations in applications that reference both the Zip and the UnZip DLL.
58  */
59 #ifndef DEFINED_ONCE
60 #define DEFINED_ONCE
61 
62 typedef int (WINAPI DLLPRNT) (LPSTR, unsigned long);
63 typedef int (WINAPI DLLPASSWORD) (LPSTR pwbuf, int bufsiz,
64     LPCSTR promptmsg, LPCSTR entryname);
65 # ifdef Z_UINT8_DEFINED
66 typedef int (WINAPI DLLSERVICE) (LPCSTR entryname, z_uint8 uncomprsiz);
67 # else
68 typedef int (WINAPI DLLSERVICE) (LPCSTR entryname, unsigned long uncomprsiz);
69 # endif
70 typedef int (WINAPI DLLSERVICE_I32) (LPCSTR entryname,
71     unsigned long ucsz_lo, unsigned long ucsz_hi);
72 #endif /* DEFINED_ONCE */
73 
74 typedef void (WINAPI DLLSND) (void);
75 typedef int (WINAPI DLLREPLACE) (LPSTR efnam, unsigned efbufsiz);
76 #ifdef Z_UINT8_DEFINED
77 typedef void (WINAPI DLLMESSAGE) (z_uint8 ucsize, z_uint8 csize,
78     unsigned cfactor,
79     unsigned mo, unsigned dy, unsigned yr, unsigned hh, unsigned mm,
80     char c, LPCSTR filename, LPCSTR methbuf, unsigned long crc, char fCrypt);
81 #else
82 typedef void (WINAPI DLLMESSAGE) (unsigned long ucsize, unsigned long csize,
83     unsigned cfactor,
84     unsigned mo, unsigned dy, unsigned yr, unsigned hh, unsigned mm,
85     char c, LPCSTR filename, LPCSTR methbuf, unsigned long crc, char fCrypt);
86 #endif
87 typedef void (WINAPI DLLMESSAGE_I32) (unsigned long ucsiz_l,
88     unsigned long ucsiz_h, unsigned long csiz_l, unsigned long csiz_h,
89     unsigned cfactor,
90     unsigned mo, unsigned dy, unsigned yr, unsigned hh, unsigned mm,
91     char c, LPCSTR filename, LPCSTR methbuf, unsigned long crc, char fCrypt);
92 
93 typedef struct {
94   DLLPRNT *print;
95   DLLSND *sound;
96   DLLREPLACE *replace;
97   DLLPASSWORD *password;
98   DLLMESSAGE *SendApplicationMessage;
99   DLLSERVICE *ServCallBk;
100   DLLMESSAGE_I32 *SendApplicationMessage_i32;
101   DLLSERVICE_I32 *ServCallBk_i32;
102 #ifdef Z_UINT8_DEFINED
103   z_uint8 TotalSizeComp;
104   z_uint8 TotalSize;
105   z_uint8 NumMembers;
106 #else
107   struct _TotalSizeComp {
108     unsigned long u4Lo;
109     unsigned long u4Hi;
110   } TotalSizeComp;
111   struct _TotalSize {
112     unsigned long u4Lo;
113     unsigned long u4Hi;
114   } TotalSize;
115   struct _NumMembers {
116     unsigned long u4Lo;
117     unsigned long u4Hi;
118   } NumMembers;
119 #endif
120   unsigned CompFactor;
121   WORD cchComment;
122 } USERFUNCTIONS, far * LPUSERFUNCTIONS;
123 
124 /* The following symbol UZ_DCL_STRUCTVER must be incremented whenever an
125  * incompatible change is applied to the WinDLL API structure "DCL" !
126  */
127 #define UZ_DCL_STRUCTVER        0x600
128 /* The structure "DCL" is collects most the UnZip WinDLL program options
129  * that control the operation of the main UnZip WinDLL function.
130  */
131 typedef struct {
132   unsigned StructVersID;  /* struct version id (= UZ_DCL_STRUCTVER) */
133   int ExtractOnlyNewer;   /* TRUE for "update" without interaction
134                              (extract only newer/new files, without queries) */
135   int SpaceToUnderscore;  /* TRUE if convert space to underscore */
136   int PromptToOverwrite;  /* TRUE if prompt to overwrite is wanted */
137   int fQuiet;             /* quiet flag:
138                              { 0 = all | 1 = few | 2 = no } messages */
139   int ncflag;             /* write to stdout if TRUE */
140   int ntflag;             /* test zip file */
141   int nvflag;             /* verbose listing */
142   int nfflag;             /* "freshen" (replace existing files by newer versions) */
143   int nzflag;             /* display zip file comment */
144   int ndflag;             /* controls (sub)dir recreation during extraction
145                              0 = junk paths from filenames
146                              1 = "safe" usage of paths in filenames (skip ../)
147                              2 = allow unsafe path components (dir traversal)
148                            */
149   int noflag;             /* always overwriting existing files if TRUE */
150   int naflag;             /* do end-of-line translation */
151   int nZIflag;            /* get ZipInfo output if TRUE */
152   int B_flag;             /* backup existing files if TRUE */
153   int C_flag;             /* be case insensitive if TRUE */
154   int D_flag;             /* controls restoration of timestamps
155                              0 = restore all timestamps (default)
156                              1 = skip restoration of timestamps for folders
157                                  created on behalf of directory entries in the
158                                  Zip archive
159                              2 = no restoration of timestamps; extracted files
160                                  and dirs get stamped with current time */
161   int U_flag;             /* controls UTF-8 filename coding support
162                              0 = automatic UTF-8 translation enabled (default)
163                              1 = recognize UTF-8 coded names, but all non-ASCII
164                                  characters are "escaped" into "#Uxxxx"
165                              2 = UTF-8 support is disabled, filename handling
166                                  works exactly as in previous UnZip versions */
167   int fPrivilege;         /* 1 => restore ACLs in user mode,
168                              2 => try to use privileges for restoring ACLs */
169   LPSTR lpszZipFN;        /* zip file name */
170   LPSTR lpszExtractDir;   /* directory to extract to. This should be NULL if
171                              you are extracting to the current directory. */
172 } DCL, far * LPDCL;
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 /* return codes of the (DLLPASSWORD)() callback function */
179 #define IDM_REPLACE_NO     100
180 #define IDM_REPLACE_TEXT   101
181 #define IDM_REPLACE_YES    102
182 #define IDM_REPLACE_ALL    103
183 #define IDM_REPLACE_NONE   104
184 #define IDM_REPLACE_RENAME 105
185 #define IDM_REPLACE_HELP   106
186 
187 #endif /* __unzip_structs_h */
188