home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip540.zip / wince / intrface.h < prev    next >
C/C++ Source or Header  |  1998-02-14  |  5KB  |  151 lines

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