1/*
2  Copyright (c) 1990-2002 Info-ZIP.  All rights reserved.
3
4  See the accompanying file LICENSE, version 2000-Apr-09 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//******************************************************************************
10//
11// File:        INTRFACE.H
12//
13// Description: This module acts as the interface between the Info-ZIP code and
14//              our Windows code in WINMAIN.CPP.  See INTRFACE.CPP for a more
15//              detailed description and the actual implementation.
16//
17// Copyright:   All the source files for Pocket UnZip, except for components
18//              written by the Info-ZIP group, are copyrighted 1997 by Steve P.
19//              Miller.  The product "Pocket UnZip" itself is property of the
20//              author and cannot be altered in any way without written consent
21//              from Steve P. Miller.
22//
23// Disclaimer:  All project files are provided "as is" with no guarantee of
24//              their correctness.  The authors are not liable for any outcome
25//              that is the result of using this source.  The source for Pocket
26//              UnZip has been placed in the public domain to help provide an
27//              understanding of its implementation.  You are hereby granted
28//              full permission to use this source in any way you wish, except
29//              to alter Pocket UnZip itself.  For comments, suggestions, and
30//              bug reports, please write to stevemil@pobox.com.
31//
32//
33// Date      Name          History
34// --------  ------------  -----------------------------------------------------
35// 02/01/97  Steve Miller  Created (Version 1.0 using Info-ZIP UnZip 5.30)
36//
37//******************************************************************************
38
39#ifndef __INTRFACE_H__
40#define __INTRFACE_H__
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46#ifdef POCKET_UNZIP
47//******************************************************************************
48//***** Types and Structures
49//******************************************************************************
50
51typedef enum _OVERWRITE_MODE {
52   OM_PROMPT = 0,
53   OM_NEWER,
54   OM_ALWAYS,
55   OM_NEVER
56} OVERWRITE_MODE, *LPOVERWRITE_MODE;
57
58typedef struct _EXTRACT_INFO {
59   zusz_t          uzByteCount;   // Total bytes to extract/test
60   DWORD           dwFileCount;   // Number of files to extract/test.
61   LPSTR          *szFileList;    // ARGV list of files, NULL for all files.
62   LPSTR           szMappedPath;  // Used to store mapped name. May be NULL.
63   OVERWRITE_MODE  overwriteMode; // How to handle file overwrites.
64   BOOL            fExtract;      // TRUE for extract, FALSE for test
65   BOOL            fRestorePaths; // TRUE to restore paths, FALSE to junk them.
66   BOOL            fAbort;        // Set during operation by UI to abort.
67   int             result;        // Result code from extraction/test.
68
69   // Window handles for the various controls in our progress dialogs.
70   HWND            hWndEditFile;
71   HWND            hWndProgFile;
72   HWND            hWndProgTotal;
73   HWND            hWndPercentage;
74   HWND            hWndFilesProcessed;
75   HWND            hWndBytesProcessed;
76
77   // Values used to keep track of our progress.
78   zusz_t          uzBytesTotalThisFile;
79   zusz_t          uzBytesWrittenThisFile;
80   zusz_t          uzBytesWrittenPreviousFiles;
81   zusz_t          uzFileOffset;
82   DWORD           dwFile;
83   LPCSTR          szFile;
84   BOOL            fNewLineOfText;
85
86} EXTRACT_INFO, *LPEXTRACT_INFO;
87
88typedef struct _DECRYPT_INFO {
89   int    retry;
90   LPSTR  szPassword;
91   DWORD  nSize;
92   LPCSTR szFile;
93} DECRYPT_INFO, *LPDECRYPT_INFO;
94
95//******************************************************************************
96//***** Function Prototypes
97//******************************************************************************
98
99// Our exposed interface functions to the Info-ZIP core.
100int  DoListFiles(LPCSTR szZipFile);
101BOOL DoExtractOrTestFiles(LPCSTR szZipFile, EXTRACT_INFO *pei);
102int  DoGetComment(LPCSTR szZipFile);
103BOOL SetExtractToDirectory(LPTSTR szDirectory);
104
105// "Internal" callbacks from Info-ZIP code.
106// (The "official" callback functions are declared in the UnZip DLL headers,
107// see "unzip.h".)
108void WINAPI Wiz_NoPrinting(int f);
109int  win_fprintf(zvoid *pG, FILE *file, unsigned int dwCount, char far *buffer);
110
111
112//******************************************************************************
113//***** Global Variables
114//******************************************************************************
115
116#ifdef GLOBAL_DECLARE
117#undef GLOBAL_DECLARE
118#undef GLOBAL_INIT
119#endif
120
121#ifdef __INTRFACE_CPP__
122   #define GLOBAL_DECLARE
123   #define GLOBAL_INIT(value) =value
124#else
125   #define GLOBAL_DECLARE extern
126   #define GLOBAL_INIT(value)
127#endif
128
129GLOBAL_DECLARE jmp_buf         dll_error_return;
130GLOBAL_DECLARE LPDCL           lpDCL           GLOBAL_INIT(NULL);
131GLOBAL_DECLARE LPUSERFUNCTIONS lpUserFunctions GLOBAL_INIT(NULL);
132
133#endif // POCKET_UNZIP
134
135#ifdef __cplusplus
136} // extern "C"
137#endif
138
139#endif // __INTRFACE_H__
140