home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / mslang / zstud1 / zip.h_ / ZIP.H
Encoding:
C/C++ Source or Header  |  1994-04-09  |  8.6 KB  |  203 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. // 
  3. //        Zip Studio 1.2 COPYRIGHT 1993, 1994 Denis CHEVRON 
  4. //
  5. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  6. //
  7. //        Zip functions declarations header file for C/C++
  8. //        To Zip, Put ZDLL12A.DLL and ZDLL12B.DLL in the current dir and 
  9. //        link with ZDLL12A.DLL (ZDLL12A.LIB) and define _GOZIP.
  10. //        To UnZip, Put UZDLL12.DLL in the current dir, link with UZDLL12.DLL
  11. //        (UZDLL12.LIB) and define _GOUNZIP.                               
  12. //
  13. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  14. #define _GOZIP            // to remove?
  15. #define _GOUNZIP        // to remove?
  16.  
  17. #ifndef _zip_h
  18. #define _zip_h
  19.  
  20. #ifdef __cplusplus
  21. extern "C"
  22.     {
  23. #endif
  24.  
  25.  
  26. #ifdef _GOZIP
  27. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  28. //
  29. //        Zip functions
  30. //
  31. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  32.  
  33.  
  34. /* Errors constants */
  35. #define ZERROR_OK        0    // No error
  36. #define ZERROR_WARNING        1    // Just a warning (not an error)
  37. #define ZERROR_DESTFILE        2    // Destfile ( *.ZIP ) error
  38. #define ZERROR_INTERNAL     3    // Internal error
  39. #define ZERROR_FORMAT        4    // Not a Zip file
  40. #define ZERROR_NOMEM        5    // Not enough memory 
  41. #define ZERROR_NOFILE        6    // Nothing to do ( can be just a warning )
  42. #define ZERROR_NODLL        7    // Can' t find required DLLs
  43. #define ZERROR_COMMENT        8    // Comment missing or NULL
  44.  
  45.  
  46. /* Overwrite mode */
  47. #define OVERWRITE_ALWAYS    0    // Always overwrite ( always zip files ) (default)
  48. #define OVERWRITE_NEVER        1     // Never overwrite
  49. #define OVERWRITE_PROMPT    2    // Ask the user
  50. #define OVERWRITE_UPDATE    3    // Overwrite if external file is newer
  51.  
  52.  
  53. /* Language mode ( for the replace dialog box )*/
  54. #define LANGUAGE_FRENCH        0    // French mode
  55. #define LANGUAGE_ENGLISH    1    // US Mode ( default )
  56.  
  57.  
  58. /* More easy to use with AddFileToZip */
  59. #define STOREPATH_NO        0    // Don' t store paths
  60. #define STOREPATH_YES        1    // Store paths
  61. #define RECURSE_NO        0    // Don' t recurse sub dirs
  62. #define RECURSE_YES        1    // Recurse sub dirs
  63.  
  64.  
  65. /* Notification messages */
  66. #define ZN_ZIPPING        WM_USER + 46    // Zipping a file, WP = compressed size in K, LP = current file name
  67. #define ZN_FILEZIPPED        WM_USER + 45    // File is zipped, WP = compress rate, LP = file name
  68. #define ZN_WRITING        WM_USER + 48    // Replace the Zip file, LP = zip file name
  69. #define ZN_DELETING        WM_USER + 47    // Delete a file , LP = current file name
  70. #define ZN_REPARING        WM_USER + 49    // Repare a Zip file, WP = (int)state
  71.                         //    step =  1 : Read / Write ,  LP = current file name
  72.                         //    step = 3 : Checking zip file, LP = zip file name
  73. #define ZN_COMPUTE        WM_USER +52    // Before zip read, WP = zip files ( over 500, computing can be very long )
  74.  
  75.  
  76. /* Main functions */
  77. extern void WINAPI ZipInit( LPCSTR szYourName, LPCSTR szPassword );     // Init the Zip DLL
  78. extern int  WINAPI AddFileToZip( LPCSTR szZipFile, LPCSTR szMask, 
  79.                  int OverwriteMode, BOOL bStorePath,
  80.                  BOOL bRecurse, HWND hParentWnd );    // Zip a file
  81. extern int  WINAPI ZipDeleteFiles( LPCSTR szZipFile, LPCSTR szFiles, 
  82.                    HWND hParentWnd );            // Delete files in a Zip
  83. extern int  WINAPI ZipRepare( LPCSTR szZipFile, HWND hParentWnd );    // Recreate the Zip file
  84. extern int  WINAPI ZipSetComment( LPCSTR szZipFile, LPCSTR szComment, 
  85.                   HWND hParentWnd );            // Set the Zip Comment
  86.                   
  87.  
  88. /* Helpers */
  89. extern BOOL WINAPI ZipSetLanguage( UINT cZipLanguage );            // Set the Language
  90. extern int  WINAPI ZipGetReplaceFlag( void );                // Return the current overwrite mode
  91.  
  92.  
  93. #endif // _GOZIP
  94.  
  95.  
  96. #ifdef _GOUNZIP    
  97. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  98. //
  99. //        UnZip functions
  100. //
  101. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  102.  
  103.  
  104. /* Initialisation function */
  105. extern void WINAPI UnzipInit( LPCSTR szYourName, LPCSTR szPassword );    // required, if you are not a registered user szYourName = "TEST"
  106.  
  107.  
  108. /* Interface constants */
  109. #ifndef LANGUAGE_FRENCH
  110.     #define LANGUAGE_FRENCH        0    // french language will be used in the replace dialog box
  111. #endif
  112. #ifndef LANGUAGE_ENGLISH
  113.     #define LANGUAGE_ENGLISH    1    // English language will be used in the replace dialog box ( default )
  114. #endif
  115.  
  116.  
  117. /* Interface setting functions */
  118. extern BOOL WINAPI UnzipSetMsgBoxTitle( LPCSTR szNewTitle );    // Set the replace dialog box title ( default = "Replace...");
  119. extern void WINAPI UnzipSetLanguage( UINT iLanguage );        // Set the language for the replace dialog box
  120. extern BOOL WINAPI UnzipSetReceivingWindow( HWND hWnd );    // Set the window for notification messages
  121. extern void WINAPI UnzipSetBackgroundMode( BOOL bBackGroundMode );    // if TRUE, activate the multitask mode ( default )
  122.  
  123.  
  124. /* Zip method constants */
  125. #define        ZMETHOD_STORED        0
  126. #define        ZMETHOD_SHRUNK        1
  127. #define        ZMETHOD_REDUCE1        2
  128. #define        ZMETHOD_REDUCE2        3
  129. #define        ZMETHOD_REDUCE3        4
  130. #define        ZMETHOD_REDUCE4        5
  131. #define        ZMETHOD_IMPLODE        6
  132. #define        ZMETHOD_TOKEN        7
  133. #define        ZMETHOD_DEFLATE        8
  134. #define        ZMETHOD_UNKNOWN        9
  135. #define        ZMETHOD_ERROR        10
  136.  
  137.  
  138. /* Information functions ( Zip ) */
  139. extern int WINAPI CountFileInZip( LPCSTR szFileName );                    // Return number of files in this Zip File
  140. extern LPSTR WINAPI GetFileNameFromZIP( LPCSTR szFileName, UINT iFileNumber );        // Return the name of the iFileNumber file in this Zip File
  141. extern long WINAPI GetZFileOriginalSize( LPCSTR szZIPFileName, LPCSTR szFileName );    // Return the not compressed size of szFileName in octets.
  142. extern long WINAPI GetZFileCompressedSize( LPCSTR szZIPFileName, LPCSTR szFileName );    // Return the compressed size of szFileName in octets.
  143. extern LPSTR WINAPI GetZFileDate( LPCSTR szZIPFileName, LPCSTR szFileName );        // Return the date of a file in a Zip
  144. extern LPSTR WINAPI GetZFileTime( LPCSTR szZIPFileName, LPCSTR szFileName );        // Return the time of a file in a Zip
  145. extern UINT WINAPI GetZCompressMethod( LPCSTR szZipFileName, LPCSTR szFileName );    // Return the Zip method for a file ( ZMETHOD_* )
  146. extern BOOL WINAPI IsThisFileAZipFile( LPCSTR szFileName );        // return TRUE if this file seems to be a zip file
  147. extern BOOL WINAPI IsFileUnzipable( LPCSTR szFileName );        // return TRUE if this file name can be reproduce under DOS
  148. extern UINT WINAPI GetZipCommentLength( LPCSTR szFileName );        // return the size of the zip file comment in octets
  149. extern BOOL WINAPI GetZipComment( LPCSTR szFileName, LPSTR szBuffer );    // Put the zip comment in buffer
  150.  
  151.  
  152. /* Information functions ( General ) */
  153. extern BOOL WINAPI bDoesFileExist( LPCSTR szFileName );                // True if this file exists
  154. extern LPSTR WINAPI GetShortFileName( LPCSTR szFileName );            // Return filename without any path
  155. extern LPSTR WINAPI GetPathFromFileName( LPCSTR szFileName );            // Return the path without the file name
  156. extern BOOL WINAPI IsFileNameInFilter( LPCSTR szFileName, LPCSTR szMask );    // Return TRUE if filename is in specified filter
  157.  
  158.  
  159. /* Extraction function result constants */
  160. #define ZEXTRACT_OK            0
  161. #define ZEXTRACT_INTERNALERROR        1
  162. #define ZEXTRACT_FILENOTFOUND        2
  163. #define ZEXTRACT_CORRUPTED        3
  164. #define ZEXTRACT_EMPTY            4
  165. #define ZEXTRACT_ERRORINZIPFILE        5
  166. #define ZEXTRACT_NOMEM            6
  167. #define ZEXTRACT_DISKFULL        8
  168. #define ZEXTRACT_WARNING        10
  169.  
  170.  
  171. /* Helper constants */
  172. #define OVERWRITE_FALSE            0
  173. #define OVERWRITE_TRUE            1
  174. #define OVERWRITE_QUERY            2
  175. #define CREATEDIR_FALSE            0
  176. #define CREATEDIR_TRUE            1
  177.  
  178.  
  179. /* Extraction functions */                                        
  180. extern UINT WINAPI ExtractZipFiles( LPCSTR szFileName, LPCSTR szMask, LPCSTR szDestDir, UINT bOverwrite, BOOL bCreateDir );
  181. extern int WINAPI GetQueryFlag( void );        // Return the overwrite mode the user asked for
  182.  
  183.  
  184. /* Notification messages for UNZIP and VIEW*/
  185. #define ZN_OPENFILE        WM_USER + 38        // Open a file, WP = TRUE if Ok, LP = filename
  186. #define ZN_EXPANDING        WM_USER + 39        // Unzipping a file, WP = file current rate, LP = filename
  187. #define ZN_CLOSEFILE        WM_USER + 40        // Close a file, WP = TRUE if Ok, LP = filename
  188.  
  189.  
  190. /* View function */
  191. extern BOOL WINAPI ViewFileFromZip( LPCSTR szZipFile, LPCSTR szMask, BOOL bTextOnly );    // view one or several files in a Zip
  192.  
  193.  
  194. #endif // _GOUNZIP
  195.  
  196. #ifdef __cplusplus
  197.     }
  198. #endif
  199.  
  200. /* ---------------------------------------- End of file ------------------------------------------*/
  201. #endif
  202.             
  203.