home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / exzip101.zip / UNZIP.DOC < prev    next >
Text File  |  1994-08-08  |  7KB  |  209 lines

  1. UNZIP.DLL
  2. =========
  3.  
  4. UNZIP.DLL is derived from code for the DOS utility UNZIP v5.0p1 produced by
  5. the Info-Zip group. As such the DLL is public domain and can be freely used
  6. in any program irrespective of whether you have registered your copy
  7. ExamineZip or not. If the DLL is used in a commercial product then no charges
  8. should be made for its inclusion. The code for UNZIP v5.0p1 was obtained from
  9. The Public Domain and Shareware Library (Tel: 0892 663298) and is also
  10. available from many other disk vendors and bulletin boards. 
  11.  
  12. What now follows is a description of how to use UNZIP.DLL with your program.
  13. All code is in C.
  14.  
  15. The Header File
  16. ===============
  17.  
  18. The following can be taken from this file and used as a header file to access
  19. the functions and capabilties of UNZIP.DLL
  20.  
  21. /* Start of header file*/
  22.  
  23.   extern void FAR PASCAL _export SetOptions      (int action);
  24.   extern void FAR PASCAL _export RegisterPattern (LPSTR szZipFilter);
  25.   extern int  FAR PASCAL _export ProcessZipFile  (HWND hwnd, LPSTR szFile);
  26.   extern void FAR PASCAL _export ChangeCase      (BOOL val);
  27.   extern void FAR PASCAL _export AbortUnZip      (void);
  28.  
  29.   #define LIST     0
  30.   #define TEST     1
  31.   #define EXTRACT  2
  32.   #define VIEW     3
  33.  
  34.   #define ID_FLUSHOUTPUT   201
  35.   #define ID_ZIPDATA       202
  36.   #define ID_ZIPCOMMENT    203
  37.   #define ID_ERRORMESSAGE  204       
  38.   #define ID_STATUSMESSAGE 205
  39.   #define ID_MULTITASK     206
  40.  
  41.   typedef struct view_info {
  42.     LPSTR  szInfo;
  43.     int    len;
  44.     DWORD  dwBytesRemaining;
  45.     BOOL   bFirstOutput;
  46.     LPSTR  szFileName;
  47.   } view_info;
  48.  
  49.   typedef struct zip_data {
  50.  
  51.     char szMethod[8];
  52.     DWORD compressed_size;
  53.     DWORD uncompressed_size;
  54.     UINT day, month, year;
  55.     UINT hour, min, sec;
  56.     int attr;
  57.     int ratio;
  58.     DWORD filecrc;
  59.     LPSTR szFileName;
  60.     LPSTR szZIPName;
  61.     LPSTR szComment;
  62.   } zip_data;
  63.  
  64. /* End of Header File */
  65.  
  66. As well as the header file you will also need to create a library file from
  67. the DLL using a program such as Borland's Import Librarian.
  68.  
  69. The Functions
  70. =============
  71.  
  72. Below is an example of a section of code to list all *.doc and *.txt files in
  73. the archive text.zip
  74.  
  75.     .
  76.     .
  77.     SetOptions (LIST);
  78.     RegisterPattern ("*.doc *.txt");
  79.     int iret = ProcessZipFile (hwnd, "text.zip");
  80.     .
  81.     .
  82.  
  83. void FAR PASCAL SetOptions (int action) 
  84.  
  85. This function tells UNZIP.DLL what action you would like to take on the Zip
  86. archive and may be called only once if you would like to perform the same
  87. action on a series of Zip archives.
  88.  
  89. int action - The action of your choice with the possible values being LIST,
  90.              TEST, EXTRACT or VIEW which are defined in the header file.
  91.  
  92.  
  93. void FAR PASCAL RegisterPattern (LPSTR szZipFilter)
  94.  
  95. This function tells UNZIP.DLL what files are to be acted upon in each archive
  96. and may be called only once if you would like to act on the same sort of
  97. files in a series of Zip archives. 
  98.  
  99. LPSTR szZipFilter - Far pointer to a string giving one or more DOS file
  100.             filters. Up to 10 file filters can be contained in the 
  101.             string with each filter separated by a space.
  102.  
  103.  
  104. int  FAR PASCAL ProcessZipFile  (HWND hwnd, LPSTR szFile)
  105.  
  106. In calling this function UNZIP.DLL will process the archive as requested and
  107. send any consequent messages to the window whose handle is given in the
  108. calling parameters.
  109.  
  110. HWND hwnd    - Handle of the window that UNZIP.DLL will send all its messages to.
  111. LPSTR szFile - Far pointer to a string giving the name of the archive.
  112. Return Value - zero for a succesful completion, a non-zero value if an error
  113.            occurs.  
  114.  
  115.  
  116. void FAR PASCAL ChangeCase (BOOL val)
  117.  
  118. This function tells UNZIP.DLL whether you want file information converted to
  119. lowercase or to keep the original case. This need be called only once.
  120.  
  121. BOOL val - TRUE to convert to lowercase, FALSE to keep the original case.
  122.  
  123.  
  124. void FAR PASCAL AbortUnZip (void)
  125.  
  126. This function can be called during the processing of a message sent from
  127. UNZIP.DLL and will cause the function ProcessZipFile to abort its current
  128. task.
  129.  
  130. The Messages
  131. ============
  132.  
  133. UNZIP.DLL communicates with the calling program via a series of messages
  134. which are WM_COMMAND messages with the wParam value being described by the
  135. identifiers in the header file and the lParam value either pointing to some
  136. data or having a value of zero.
  137.  
  138. ID_FLUSHOUTPUT
  139.  
  140. This message is sent to the calling window procedure when the function
  141. ProcessZipFile is called with the VIEW option. The value of lParam is a far
  142. pointer to a view_info structure defined in the header file. The members of
  143. the structure contain the following information.
  144.  
  145. LPSTR  szInfo         - far pointer to the buffer containing the output. 
  146. int    len            - number of bytes of output.
  147. DWORD  dwBytesRemaining - the number of bytes yet to be uncompressed from the
  148.                           archive and to be sent as output.
  149. BOOL   bFirstOutput     - TRUE if this the first output for a particular file,
  150.                           FALSE if not.
  151. LPSTR  szFileName     - far pointer to the filename. 
  152.  
  153.  
  154. ID_ZIPDATA
  155.  
  156. This message is sent to the calling window procedure when the function
  157. ProcessZipFile is called with the LIST option. The value of lParam is a far
  158. pointer to a zip_info structure defined in the header file. The members of
  159. the structure contain the following information.
  160.  
  161. char szMethod[8]     - contains the name of the compression method used.
  162. DWORD compressed_size     - the size of the file compressed in the archive.
  163. DWORD uncompressed_size - the size of the file if extracted to disk.
  164. UINT day, month, year     - the day, month and year that the file was created.
  165. UINT hour, min, sec     - the hour, minute and second that the file was created.
  166. int attr         - the DOS file attribute.
  167. int ratio         - the compression ratio. 0 no compression, 1000 
  168.               maximum compression. Divide by 10 to get the percent
  169.                           compression.
  170. DWORD filecrc         - 32 bit file CRC.
  171. LPSTR szFileName     - far pointer to the filename.
  172. LPSTR szZIPName     - far pointer to the archive name.
  173. LPSTR szComment     - far pointer to the file comment. If there is no
  174.               comment then this is NULL;
  175.  
  176.  
  177. ID_ZIPCOMMENT
  178.  
  179. This message is sent to the calling window procedure when the function
  180. ProcessZipFile is called with the LIST option. It describes the Zip archive
  181. comment if any. The value of lParam is a far pointer to a view_info structure
  182. defined in the header file and described above for the ID_FLUSHOUTPUT
  183. message. If there is no comment then lParam has a value of NULL.
  184.  
  185.  
  186. ID_ERRORMESSAGE 
  187.  
  188. This message is sent to the calling window procedure when UNZIP.DLL comes
  189. across an error condition. The value of lParam is a far pointer to text
  190. describing the error condition.
  191.       
  192.  
  193. ID_STATUSMESSAGE
  194.  
  195. This message is sent at least once to the calling window procedure while
  196. ProcessZipFile is operating. The value of lParam is a far pointer to text
  197. describing the current status of the process i.e "Testing: readme.txt".
  198.  
  199.  
  200. ID_MULTITASK
  201.  
  202. This message is sent at least once to the calling window procedure while
  203. ProcessZipFile is operating. The message sends no information but allows the
  204. main program to process other messages in a message queue if desired to give
  205. multitasking capabilities. It can give an opportunity to check whether the
  206. user still wants to continue with the current operation. 
  207.  
  208.  
  209.