Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

723 lines
26KB

  1. /*---------------------------------------------------------------------------
  2. unzip.h (new)
  3. Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
  4. This header file contains the public macros and typedefs required by
  5. both the UnZip sources and by any application using the UnZip API. If
  6. UNZIP_INTERNAL is defined, it includes unzpriv.h (containing includes,
  7. prototypes and extern variables used by the actual UnZip sources).
  8. ---------------------------------------------------------------------------*/
  9. /*---------------------------------------------------------------------------
  10. This is version 2009-Jan-02 of the Info-ZIP license.
  11. The definitive version of this document should be available at
  12. ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and
  13. a copy at http://www.info-zip.org/pub/infozip/license.html.
  14. Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
  15. For the purposes of this copyright and license, "Info-ZIP" is defined as
  16. the following set of individuals:
  17. Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois,
  18. Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth,
  19. Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz,
  20. David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko,
  21. Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs,
  22. Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda,
  23. Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren,
  24. Rich Wales, Mike White.
  25. This software is provided "as is," without warranty of any kind, express
  26. or implied. In no event shall Info-ZIP or its contributors be held liable
  27. for any direct, indirect, incidental, special or consequential damages
  28. arising out of the use of or inability to use this software.
  29. Permission is granted to anyone to use this software for any purpose,
  30. including commercial applications, and to alter it and redistribute it
  31. freely, subject to the above disclaimer and the following restrictions:
  32. 1. Redistributions of source code (in whole or in part) must retain
  33. the above copyright notice, definition, disclaimer, and this list
  34. of conditions.
  35. 2. Redistributions in binary form (compiled executables and libraries)
  36. must reproduce the above copyright notice, definition, disclaimer,
  37. and this list of conditions in documentation and/or other materials
  38. provided with the distribution. Additional documentation is not needed
  39. for executables where a command line license option provides these and
  40. a note regarding this option is in the executable's startup banner. The
  41. sole exception to this condition is redistribution of a standard
  42. UnZipSFX binary (including SFXWiz) as part of a self-extracting archive;
  43. that is permitted without inclusion of this license, as long as the
  44. normal SFX banner has not been removed from the binary or disabled.
  45. 3. Altered versions--including, but not limited to, ports to new operating
  46. systems, existing ports with new graphical interfaces, versions with
  47. modified or added functionality, and dynamic, shared, or static library
  48. versions not from Info-ZIP--must be plainly marked as such and must not
  49. be misrepresented as being the original source or, if binaries,
  50. compiled from the original source. Such altered versions also must not
  51. be misrepresented as being Info-ZIP releases--including, but not
  52. limited to, labeling of the altered versions with the names "Info-ZIP"
  53. (or any variation thereof, including, but not limited to, different
  54. capitalizations), "Pocket UnZip," "WiZ" or "MacZip" without the
  55. explicit permission of Info-ZIP. Such altered versions are further
  56. prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP
  57. e-mail addresses or the Info-ZIP URL(s), such as to imply Info-ZIP
  58. will provide support for the altered versions.
  59. 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip,"
  60. "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its
  61. own source and binary releases.
  62. ---------------------------------------------------------------------------*/
  63. #ifndef __unzip_h /* prevent multiple inclusions */
  64. #define __unzip_h
  65. /*---------------------------------------------------------------------------
  66. Predefined, machine-specific macros.
  67. ---------------------------------------------------------------------------*/
  68. #ifdef __GO32__ /* MS-DOS extender: NOT Unix */
  69. # ifdef unix
  70. # undef unix
  71. # endif
  72. # ifdef _unix
  73. # undef _unix
  74. # endif
  75. # ifdef __unix
  76. # undef __unix
  77. # endif
  78. # ifdef __unix__
  79. # undef __unix__
  80. # endif
  81. #endif
  82. #if ((defined(__convex__) || defined(__convexc__)) && !defined(CONVEX))
  83. # define CONVEX
  84. #endif
  85. #if (defined(unix) || defined(_unix) || defined(__unix) || defined(__unix__))
  86. # ifndef UNIX
  87. # define UNIX
  88. # endif
  89. #endif /* unix || _unix || __unix || __unix__ */
  90. #if (defined(M_XENIX) || defined(COHERENT) || defined(__hpux))
  91. # ifndef UNIX
  92. # define UNIX
  93. # endif
  94. #endif /* M_XENIX || COHERENT || __hpux */
  95. #if (defined(__NetBSD__) || defined(__FreeBSD__))
  96. # ifndef UNIX
  97. # define UNIX
  98. # endif
  99. #endif /* __NetBSD__ || __FreeBSD__ */
  100. #if (defined(CONVEX) || defined(MINIX) || defined(_AIX) || defined(__QNX__))
  101. # ifndef UNIX
  102. # define UNIX
  103. # endif
  104. #endif /* CONVEX || MINIX || _AIX || __QNX__ */
  105. #if (defined(VM_CMS) || defined(MVS))
  106. # define CMS_MVS
  107. #endif
  108. #if (defined(__OS2__) && !defined(OS2))
  109. # define OS2
  110. #endif
  111. #if (defined(__TANDEM) && !defined(TANDEM))
  112. # define TANDEM
  113. #endif
  114. #if (defined(__VMS) && !defined(VMS))
  115. # define VMS
  116. #endif
  117. #if ((defined(__WIN32__) || defined(_WIN32)) && !defined(WIN32))
  118. # define WIN32
  119. #endif
  120. #if ((defined(__WINNT__) || defined(__WINNT)) && !defined(WIN32))
  121. # define WIN32
  122. #endif
  123. #if defined(_WIN32_WCE)
  124. # ifndef WIN32 /* WinCE is treated as a variant of the Win32 API */
  125. # define WIN32
  126. # endif
  127. # ifndef UNICODE /* WinCE requires UNICODE wide character support */
  128. # define UNICODE
  129. # endif
  130. #endif
  131. #ifdef __COMPILER_KCC__
  132. # include <c-env.h>
  133. # ifdef SYS_T20
  134. # define TOPS20
  135. # endif
  136. #endif /* __COMPILER_KCC__ */
  137. /* Borland C does not define __TURBOC__ if compiling for a 32-bit platform */
  138. #ifdef __BORLANDC__
  139. # ifndef __TURBOC__
  140. # define __TURBOC__
  141. # endif
  142. # if (!defined(__MSDOS__) && !defined(OS2) && !defined(WIN32))
  143. # define __MSDOS__
  144. # endif
  145. #endif
  146. /* define MSDOS for Turbo C (unless OS/2) and Power C as well as Microsoft C */
  147. #ifdef __POWERC
  148. # define __TURBOC__
  149. # define MSDOS
  150. #endif /* __POWERC */
  151. #if (defined(__MSDOS__) && !defined(MSDOS)) /* just to make sure */
  152. # define MSDOS
  153. #endif
  154. /* RSXNTDJ (at least up to v1.3) compiles for WIN32 (RSXNT) using a derivate
  155. of the EMX environment, but defines MSDOS and __GO32__. ARG !!! */
  156. #if (defined(MSDOS) && defined(WIN32))
  157. # undef MSDOS /* WIN32 is >>>not<<< MSDOS */
  158. #endif
  159. #if (defined(__GO32__) && defined(__EMX__) && defined(__RSXNT__))
  160. # undef __GO32__
  161. #endif
  162. #if (defined(linux) && !defined(LINUX))
  163. # define LINUX
  164. #endif
  165. #ifdef __riscos
  166. # define RISCOS
  167. #endif
  168. #if (defined(THINK_C) || defined(MPW))
  169. # define MACOS
  170. #endif
  171. #if (defined(__MWERKS__) && defined(macintosh))
  172. # define MACOS
  173. #endif
  174. /* use prototypes and ANSI libraries if __STDC__, or MS-DOS, or OS/2, or Win32,
  175. * or IBM C Set/2, or Borland C, or Watcom C, or GNU gcc (emx or Cygwin),
  176. * or Macintosh, or Sequent, or Atari, or IBM RS/6000, or Silicon Graphics,
  177. * or Convex?, or AtheOS, or BeOS.
  178. */
  179. #if (defined(__STDC__) || defined(MSDOS) || defined(OS2) || defined(WIN32))
  180. # ifndef PROTO
  181. # define PROTO
  182. # endif
  183. # ifndef MODERN
  184. # define MODERN
  185. # endif
  186. #endif
  187. #if (defined(__IBMC__) || defined(__BORLANDC__) || defined(__WATCOMC__))
  188. # ifndef PROTO
  189. # define PROTO
  190. # endif
  191. # ifndef MODERN
  192. # define MODERN
  193. # endif
  194. #endif
  195. #if (defined(__EMX__) || defined(__CYGWIN__))
  196. # ifndef PROTO
  197. # define PROTO
  198. # endif
  199. # ifndef MODERN
  200. # define MODERN
  201. # endif
  202. #endif
  203. #if (defined(MACOS) || defined(ATARI_ST) || defined(RISCOS) || defined(THEOS))
  204. # ifndef PROTO
  205. # define PROTO
  206. # endif
  207. # ifndef MODERN
  208. # define MODERN
  209. # endif
  210. #endif
  211. /* Sequent running Dynix/ptx: non-modern compiler */
  212. #if (defined(_AIX) || defined(sgi) || (defined(_SEQUENT_) && !defined(PTX)))
  213. # ifndef PROTO
  214. # define PROTO
  215. # endif
  216. # ifndef MODERN
  217. # define MODERN
  218. # endif
  219. #endif
  220. #if (defined(CMS_MVS) || defined(__ATHEOS__) || defined(__BEOS__))
  221. /* || defined(CONVEX) ? */
  222. # ifndef PROTO
  223. # define PROTO
  224. # endif
  225. # ifndef MODERN
  226. # define MODERN
  227. # endif
  228. #endif
  229. /* Bundled C compiler on HP-UX needs this. Others shouldn't care. */
  230. #if (defined(__hpux))
  231. # ifndef MODERN
  232. # define MODERN
  233. # endif
  234. #endif
  235. /* turn off prototypes if requested */
  236. #if (defined(NOPROTO) && defined(PROTO))
  237. # undef PROTO
  238. #endif
  239. /* used to remove arguments in function prototypes for non-ANSI C */
  240. #ifdef PROTO
  241. # define OF(a) a
  242. #else
  243. # define OF(a) ()
  244. #endif
  245. /* enable the "const" keyword only if MODERN and if not otherwise instructed */
  246. #ifdef MODERN
  247. # if (!defined(ZCONST) && (defined(USE_CONST) || !defined(NO_CONST)))
  248. # define ZCONST const
  249. # endif
  250. #endif
  251. #ifndef ZCONST
  252. # define ZCONST
  253. #endif
  254. /* Tell Microsoft Visual C++ 2005 (and newer) to leave us alone
  255. * and let us use standard C functions the way we're supposed to.
  256. * (These preprocessor symbols must appear before the first system
  257. * header include. They are located here, because for WINDLL the
  258. * first system header includes follow just below.)
  259. */
  260. #if defined(_MSC_VER) && (_MSC_VER >= 1400)
  261. # ifndef _CRT_SECURE_NO_WARNINGS
  262. # define _CRT_SECURE_NO_WARNINGS
  263. # endif
  264. # ifndef _CRT_NONSTDC_NO_WARNINGS
  265. # define _CRT_NONSTDC_NO_WARNINGS
  266. # endif
  267. # if defined(POCKET_UNZIP) && !defined(_CRT_NON_CONFORMING_SWPRINTFS)
  268. # define _CRT_NON_CONFORMING_SWPRINTFS
  269. # endif
  270. #endif
  271. /* NO_UNIXBACKUP overrides UNIXBACKUP */
  272. #if defined(NO_UNIXBACKUP) && defined(UNIXBACKUP)
  273. # undef UNIXBACKUP
  274. #endif
  275. /*---------------------------------------------------------------------------
  276. Grab system-specific public include headers.
  277. ---------------------------------------------------------------------------*/
  278. #ifdef POCKET_UNZIP /* WinCE port */
  279. # include "wince/punzip.h" /* must appear before windows.h */
  280. #endif
  281. #ifdef WINDLL
  282. /* for UnZip, the "basic" part of the win32 api is sufficient */
  283. # ifndef WIN32_LEAN_AND_MEAN
  284. # define WIN32_LEAN_AND_MEAN
  285. # define IZ_HASDEFINED_WIN32LEAN
  286. # endif
  287. # include <windows.h>
  288. # include "windll/structs.h"
  289. # ifdef IZ_HASDEFINED_WIN32LEAN
  290. # undef WIN32_LEAN_AND_MEAN
  291. # undef IZ_HASDEFINED_WIN32LEAN
  292. # endif
  293. #endif
  294. /*---------------------------------------------------------------------------
  295. Grab system-dependent definition of EXPENTRY for prototypes below.
  296. ---------------------------------------------------------------------------*/
  297. #if 0
  298. #if (defined(OS2) && !defined(FUNZIP))
  299. # ifdef UNZIP_INTERNAL
  300. # define INCL_NOPM
  301. # define INCL_DOSNLS
  302. # define INCL_DOSPROCESS
  303. # define INCL_DOSDEVICES
  304. # define INCL_DOSDEVIOCTL
  305. # define INCL_DOSERRORS
  306. # define INCL_DOSMISC
  307. # ifdef OS2DLL
  308. # define INCL_REXXSAA
  309. # include <rexxsaa.h>
  310. # endif
  311. # endif /* UNZIP_INTERNAL */
  312. # include <os2.h>
  313. # define UZ_EXP EXPENTRY
  314. #endif /* OS2 && !FUNZIP */
  315. #endif /* 0 */
  316. #if (defined(OS2) && !defined(FUNZIP))
  317. # if (defined(__IBMC__) || defined(__WATCOMC__))
  318. # define UZ_EXP _System /* compiler keyword */
  319. # else
  320. # define UZ_EXP
  321. # endif
  322. #endif /* OS2 && !FUNZIP */
  323. #if (defined(WINDLL) || defined(USE_UNZIP_LIB))
  324. # ifndef EXPENTRY
  325. # define UZ_EXP WINAPI
  326. # else
  327. # define UZ_EXP EXPENTRY
  328. # endif
  329. #endif
  330. #ifndef UZ_EXP
  331. # define UZ_EXP
  332. #endif
  333. #ifdef __cplusplus
  334. extern "C" {
  335. #endif
  336. /*---------------------------------------------------------------------------
  337. Public typedefs.
  338. ---------------------------------------------------------------------------*/
  339. #ifndef _IZ_TYPES_DEFINED
  340. #ifdef MODERN
  341. typedef void zvoid;
  342. #else /* !MODERN */
  343. # ifndef AOS_VS /* mostly modern? */
  344. # ifndef VAXC /* not fully modern, but has knows 'void' */
  345. # define void int
  346. # endif /* !VAXC */
  347. # endif /* !AOS_VS */
  348. typedef char zvoid;
  349. #endif /* ?MODERN */
  350. typedef unsigned char uch; /* code assumes unsigned bytes; these type- */
  351. typedef unsigned short ush; /* defs replace byte/UWORD/ULONG (which are */
  352. typedef unsigned long ulg; /* predefined on some systems) & match zip */
  353. #define _IZ_TYPES_DEFINED
  354. #endif /* !_IZ_TYPES_DEFINED */
  355. /* InputFn is not yet used and is likely to change: */
  356. #ifdef PROTO
  357. typedef int (UZ_EXP MsgFn) (zvoid *pG, uch *buf, ulg size, int flag);
  358. typedef int (UZ_EXP InputFn) (zvoid *pG, uch *buf, int *size, int flag);
  359. typedef void (UZ_EXP PauseFn) (zvoid *pG, ZCONST char *prompt, int flag);
  360. typedef int (UZ_EXP PasswdFn) (zvoid *pG, int *rcnt, char *pwbuf,
  361. int size, ZCONST char *zfn,
  362. ZCONST char *efn);
  363. typedef int (UZ_EXP StatCBFn) (zvoid *pG, int fnflag, ZCONST char *zfn,
  364. ZCONST char *efn, ZCONST zvoid *details);
  365. typedef void (UZ_EXP UsrIniFn) (void);
  366. #else /* !PROTO */
  367. typedef int (UZ_EXP MsgFn) ();
  368. typedef int (UZ_EXP InputFn) ();
  369. typedef void (UZ_EXP PauseFn) ();
  370. typedef int (UZ_EXP PasswdFn) ();
  371. typedef int (UZ_EXP StatCBFn) ();
  372. typedef void (UZ_EXP UsrIniFn) ();
  373. #endif /* ?PROTO */
  374. typedef struct _UzpBuffer { /* rxstr */
  375. ulg strlength; /* length of string */
  376. char *strptr; /* pointer to string */
  377. } UzpBuffer;
  378. typedef struct _UzpInit {
  379. ulg structlen; /* length of the struct being passed */
  380. /* GRR: can we assume that each of these is a 32-bit pointer? if not,
  381. * does it matter? add "far" keyword to make sure? */
  382. MsgFn *msgfn;
  383. InputFn *inputfn;
  384. PauseFn *pausefn;
  385. UsrIniFn *userfn; /* user init function to be called after */
  386. /* globals constructed and initialized */
  387. /* pointer to program's environment area or something? */
  388. /* hooks for performance testing? */
  389. /* hooks for extra unzip -v output? (detect CPU or other hardware?) */
  390. /* anything else? let me (Greg) know... */
  391. } UzpInit;
  392. typedef struct _UzpCB {
  393. ulg structlen; /* length of the struct being passed */
  394. /* GRR: can we assume that each of these is a 32-bit pointer? if not,
  395. * does it matter? add "far" keyword to make sure? */
  396. MsgFn *msgfn;
  397. InputFn *inputfn;
  398. PauseFn *pausefn;
  399. PasswdFn *passwdfn;
  400. StatCBFn *statrepfn;
  401. } UzpCB;
  402. /* the collection of general UnZip option flags and option arguments */
  403. typedef struct _UzpOpts {
  404. #ifndef FUNZIP
  405. char *exdir; /* pointer to extraction root directory (-d option) */
  406. char *pwdarg; /* pointer to command-line password (-P option) */
  407. int zipinfo_mode; /* behave like ZipInfo or like normal UnZip? */
  408. int aflag; /* -a: do ASCII-EBCDIC and/or end-of-line translation */
  409. #ifdef VMS
  410. int bflag; /* -b: force fixed record format for binary files */
  411. #endif
  412. #ifdef TANDEM
  413. int bflag; /* -b: create text files in 'C' format (180)*/
  414. #endif
  415. #if defined(UNIX) || defined(OS2) || defined(WIN32)
  416. int B_flag; /* -B: back up existing files by renaming to *~##### */
  417. #else
  418. #ifdef UNIXBACKUP
  419. int B_flag; /* -B: back up existing files by renaming to *~##### */
  420. #endif
  421. #endif
  422. int cflag; /* -c: output to stdout */
  423. int C_flag; /* -C: match filenames case-insensitively */
  424. int D_flag; /* -D: don't restore directory (-DD: any) timestamps */
  425. #ifdef MACOS
  426. int E_flag; /* -E: [MacOS] show Mac extra field during restoring */
  427. #endif
  428. int fflag; /* -f: "freshen" (extract only newer files) */
  429. #if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))
  430. int acorn_nfs_ext; /* -F: RISC OS types & NFS filetype extensions */
  431. #endif
  432. int hflag; /* -h: header line (zipinfo) */
  433. #ifdef MACOS
  434. int i_flag; /* -i: [MacOS] ignore filenames stored in Mac e.f. */
  435. #endif
  436. #ifdef RISCOS
  437. int scanimage; /* -I: scan image files */
  438. #endif
  439. int jflag; /* -j: junk pathnames (unzip) */
  440. #if (defined(__ATHEOS__) || defined(__BEOS__) || defined(MACOS))
  441. int J_flag; /* -J: ignore AtheOS/BeOS/MacOS e. f. info (unzip) */
  442. #endif
  443. #if (defined(__ATHEOS__) || defined(__BEOS__) || defined(UNIX))
  444. int K_flag; /* -K: keep setuid/setgid/tacky permissions */
  445. #endif
  446. int lflag; /* -12slmv: listing format (zipinfo) */
  447. int L_flag; /* -L: convert filenames from some OSes to lowercase */
  448. int overwrite_none; /* -n: never overwrite files (no prompting) */
  449. #ifdef AMIGA
  450. int N_flag; /* -N: restore comments as AmigaDOS filenotes */
  451. #endif
  452. int overwrite_all; /* -o: OK to overwrite files without prompting */
  453. #endif /* !FUNZIP */
  454. int qflag; /* -q: produce a lot less output */
  455. #ifdef TANDEM
  456. int rflag; /* -r: remove file extensions */
  457. #endif
  458. #ifndef FUNZIP
  459. #if (defined(MSDOS) || defined(FLEXOS) || defined(OS2) || defined(WIN32))
  460. int sflag; /* -s: convert spaces in filenames to underscores */
  461. #endif
  462. #if (defined(NLM))
  463. int sflag; /* -s: convert spaces in filenames to underscores */
  464. #endif
  465. #ifdef VMS
  466. int S_flag; /* -S: use Stream_LF for text files (-a[a]) */
  467. #endif
  468. #if (defined(MSDOS) || defined(__human68k__) || defined(OS2) || defined(WIN32))
  469. int volflag; /* -$: extract volume labels */
  470. #endif
  471. int tflag; /* -t: test (unzip) or totals line (zipinfo) */
  472. int T_flag; /* -T: timestamps (unzip) or dec. time fmt (zipinfo) */
  473. int uflag; /* -u: "update" (extract only newer/brand-new files) */
  474. #if defined(UNIX) || defined(VMS) || defined(WIN32)
  475. int U_flag; /* -U: escape non-ASCII, -UU No Unicode paths */
  476. #endif
  477. int vflag; /* -v: (verbosely) list directory */
  478. int V_flag; /* -V: don't strip VMS version numbers */
  479. int W_flag; /* -W: wildcard '*' won't match '/' dir separator */
  480. #if (defined (__ATHEOS__) || defined(__BEOS__) || defined(UNIX))
  481. int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */
  482. #else
  483. #if (defined(TANDEM) || defined(THEOS))
  484. int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */
  485. #else
  486. #if (defined(OS2) || defined(VMS) || defined(WIN32))
  487. int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */
  488. #endif
  489. #endif
  490. #endif
  491. #ifdef VMS
  492. int Y_flag; /* -Y: treat ".nnn" as ";nnn" version */
  493. #endif
  494. int zflag; /* -z: display the zipfile comment (only, for unzip) */
  495. #ifdef VMS
  496. int ods2_flag; /* -2: force names to conform to ODS2 */
  497. #endif
  498. #if (!defined(RISCOS) && !defined(CMS_MVS) && !defined(TANDEM))
  499. int ddotflag; /* -:: don't skip over "../" path elements */
  500. #endif
  501. #ifdef UNIX
  502. int cflxflag; /* -^: allow control chars in extracted filenames */
  503. #endif
  504. #endif /* !FUNZIP */
  505. } UzpOpts;
  506. /* intended to be a private struct: */
  507. typedef struct _ver {
  508. uch major; /* e.g., integer 5 */
  509. uch minor; /* e.g., 2 */
  510. uch patchlevel; /* e.g., 0 */
  511. uch not_used;
  512. } _version_type;
  513. typedef struct _UzpVer {
  514. ulg structlen; /* length of the struct being passed */
  515. ulg flag; /* bit 0: is_beta bit 1: uses_zlib */
  516. ZCONST char *betalevel; /* e.g. "g BETA" or "" */
  517. ZCONST char *date; /* e.g. "9 Oct 08" (beta) or "9 October 2008" */
  518. ZCONST char *zlib_version;/* e.g. "1.2.3" or NULL */
  519. _version_type unzip; /* current UnZip version */
  520. _version_type zipinfo; /* current ZipInfo version */
  521. _version_type os2dll; /* OS2DLL version (retained for compatibility */
  522. _version_type windll; /* WinDLL version (retained for compatibility */
  523. _version_type dllapimin; /* last incompatible change of library API */
  524. } UzpVer;
  525. /* for Visual BASIC access to Windows DLLs: */
  526. typedef struct _UzpVer2 {
  527. ulg structlen; /* length of the struct being passed */
  528. ulg flag; /* bit 0: is_beta bit 1: uses_zlib */
  529. char betalevel[10]; /* e.g. "g BETA" or "" */
  530. char date[20]; /* e.g. "9 Oct 08" (beta) or "9 October 2008" */
  531. char zlib_version[10]; /* e.g. "1.2.3" or NULL */
  532. _version_type unzip; /* current UnZip version */
  533. _version_type zipinfo; /* current ZipInfo version */
  534. _version_type os2dll; /* OS2DLL version (retained for compatibility */
  535. _version_type windll; /* WinDLL version (retained for compatibility */
  536. _version_type dllapimin; /* last incompatible change of library API */
  537. } UzpVer2;
  538. typedef struct _Uzp_Siz64 {
  539. unsigned long lo32;
  540. unsigned long hi32;
  541. } Uzp_Siz64;
  542. typedef struct _Uzp_cdir_Rec {
  543. uch version_made_by[2];
  544. uch version_needed_to_extract[2];
  545. ush general_purpose_bit_flag;
  546. ush compression_method;
  547. ulg last_mod_dos_datetime;
  548. ulg crc32;
  549. Uzp_Siz64 csize;
  550. Uzp_Siz64 ucsize;
  551. ush filename_length;
  552. ush extra_field_length;
  553. ush file_comment_length;
  554. ush disk_number_start;
  555. ush internal_file_attributes;
  556. ulg external_file_attributes;
  557. Uzp_Siz64 relative_offset_local_header;
  558. } Uzp_cdir_Rec;
  559. #define UZPINIT_LEN sizeof(UzpInit)
  560. #define UZPVER_LEN sizeof(UzpVer)
  561. #define cbList(func) int (* UZ_EXP func)(char *filename, Uzp_cdir_Rec *crec)
  562. /*---------------------------------------------------------------------------
  563. Return (and exit) values of the public UnZip API functions.
  564. ---------------------------------------------------------------------------*/
  565. /* external return codes */
  566. #define PK_OK 0 /* no error */
  567. #define PK_COOL 0 /* no error */
  568. #define PK_WARN 1 /* warning error */
  569. #define PK_ERR 2 /* error in zipfile */
  570. #define PK_BADERR 3 /* severe error in zipfile */
  571. #define PK_MEM 4 /* insufficient memory (during initialization) */
  572. #define PK_MEM2 5 /* insufficient memory (password failure) */
  573. #define PK_MEM3 6 /* insufficient memory (file decompression) */
  574. #define PK_MEM4 7 /* insufficient memory (memory decompression) */
  575. #define PK_MEM5 8 /* insufficient memory (not yet used) */
  576. #define PK_NOZIP 9 /* zipfile not found */
  577. #define PK_PARAM 10 /* bad or illegal parameters specified */
  578. #define PK_FIND 11 /* no files found */
  579. #define PK_DISK 50 /* disk full */
  580. #define PK_EOF 51 /* unexpected EOF */
  581. #define IZ_CTRLC 80 /* user hit ^C to terminate */
  582. #define IZ_UNSUP 81 /* no files found: all unsup. compr/encrypt. */
  583. #define IZ_BADPWD 82 /* no files found: all had bad password */
  584. #define IZ_ERRBF 83 /* big-file archive, small-file program */
  585. /* return codes of password fetches (negative = user abort; positive = error) */
  586. #define IZ_PW_ENTERED 0 /* got some password string; use/try it */
  587. #define IZ_PW_CANCEL -1 /* no password available (for this entry) */
  588. #define IZ_PW_CANCELALL -2 /* no password, skip any further pwd. request */
  589. #define IZ_PW_ERROR 5 /* = PK_MEM2 : failure (no mem, no tty, ...) */
  590. /* flag values for status callback function */
  591. #define UZ_ST_START_EXTRACT 1 /* no details */
  592. #define UZ_ST_IN_PROGRESS 2 /* no details */
  593. #define UZ_ST_FINISH_MEMBER 3 /* 'details': extracted size */
  594. /* return values of status callback function */
  595. #define UZ_ST_CONTINUE 0
  596. #define UZ_ST_BREAK 1
  597. /*---------------------------------------------------------------------------
  598. Prototypes for public UnZip API (DLL) functions.
  599. ---------------------------------------------------------------------------*/
  600. #define UzpMatch match
  601. int UZ_EXP UzpMain OF((int argc, char **argv));
  602. int UZ_EXP UzpAltMain OF((int argc, char **argv, UzpInit *init));
  603. ZCONST UzpVer * UZ_EXP UzpVersion OF((void));
  604. void UZ_EXP UzpFreeMemBuffer OF((UzpBuffer *retstr));
  605. #ifndef WINDLL
  606. int UZ_EXP UzpUnzipToMemory OF((char *zip, char *file, UzpOpts *optflgs,
  607. UzpCB *UsrFunc, UzpBuffer *retstr));
  608. int UZ_EXP UzpGrep OF((char *archive, char *file,
  609. char *pattern, int cmd, int SkipBin,
  610. UzpCB *UsrFunc));
  611. #endif
  612. #ifdef OS2
  613. int UZ_EXP UzpFileTree OF((char *name, cbList(callBack),
  614. char *cpInclude[], char *cpExclude[]));
  615. #endif
  616. unsigned UZ_EXP UzpVersion2 OF((UzpVer2 *version));
  617. int UZ_EXP UzpValidate OF((char *archive, int AllCodes));
  618. /* default I/O functions (can be swapped out via UzpAltMain() entry point): */
  619. int UZ_EXP UzpMessagePrnt OF((zvoid *pG, uch *buf, ulg size, int flag));
  620. int UZ_EXP UzpMessageNull OF((zvoid *pG, uch *buf, ulg size, int flag));
  621. int UZ_EXP UzpInput OF((zvoid *pG, uch *buf, int *size, int flag));
  622. void UZ_EXP UzpMorePause OF((zvoid *pG, ZCONST char *prompt, int flag));
  623. int UZ_EXP UzpPassword OF((zvoid *pG, int *rcnt, char *pwbuf,
  624. int size, ZCONST char *zfn,
  625. ZCONST char *efn));
  626. #ifdef __cplusplus
  627. }
  628. #endif
  629. /*---------------------------------------------------------------------------
  630. Remaining private stuff for UnZip compilation.
  631. ---------------------------------------------------------------------------*/
  632. #ifdef UNZIP_INTERNAL
  633. # include "unzpriv.h"
  634. #endif
  635. #endif /* !__unzip_h */