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