Readme file for Chief's UNZIP v1.00
-----------------------------------
History
v1.00:  May 7th 1998: first release
v1.00a: May 9th 1998: minor amendments

-------------------
This package is the Pascal version of Info-Zip's UNZIP.
The sources were translated from C to Pascal by Christian Ghisler.

The Pascal sources were subsequently amended to be repackaged as
Chief's UNZIP by Dr Abimbola Olowofoyeku (The African Chief).
Homepage: http://ourworld.compuserve.com/homepages/African_Chief

This package allows you to UNZIP deflated, imploded, shrunk and stored
ZIP archives. 

If you unzip the package with PKUNZIP(tm) use the "-D" switch to
recreate the subdirectory structure.

The source code is compatible with;
        * Turbo Pascal v7.x     (DOS)
        * Borland Pascal v7.x   (Dos, DPMI, and Windows)
        * Delphi v1.x
        * Delphi v2.x
        * Delphi v3.x
        * Virtual Pascal v2.0   (Win32)

Files in the package:
---------------------
1. The main UNZIP sources:
   1. UNZIP.INC       - conditional definitions for the various compilers
   2. ZIPTYPES.PAS    - data structures used in the UNZIP sources
   3. UNZIP.PAS       - the main UNIT for the UNZIP functions
   4. UNZIPDLL.PAS    - the UNZIP functions exported to a DLL
   5. ZIPINTER.PAS    - interface IMPORT UNIT for the DLL
   6. ChfUnzip.pas    - simple Delphi component/Pascal Object for UNZIP


2. Sample programs:
   1. test1.pas       - test program using high level unzip functions
   2. test2.pas       - high level functions + simple Pascal object
   3. test3.pas       - high level functions + Delphi component
   4. test4.pas       - test program using low level unzip functions


3. Documentation:
   1. README.TXT      - this file


4. Miscellaneous:
   1. \dll\unzip16.dll - unzipdll.pas compiled to 16-bit (rename to unzipdll.dll)
   2. \dll\unzip32.dll - unzipdll.pas compiled to 32-bit (rename to unzipdll.dll)
   3. \delphi3\wincrt.dcu - compiled Win32 version of WinCRT unit (Delphi 3.x)
   4. \delphi2\wincrt.dcu - compiled Win32 version of WinCRT unit (Delphi 2.x)


LICENCE
-------
This package is released as **FREEWARE**.
You got it FREE - so please do NOT charge others for it.
If you use it in commercial or shareware programs, please
give credit to INFO-ZIP, Christian Ghisler, and Dr Abimbola
Olowofoyeku.

The package can be redistributed freely, by ftp archives,
web sites, bulletin boards, computer magazine cover disks
and CD-ROMS, shareware and public domain CD-ROMs and archives,
etc., ON THE CONDITION THAT ALL THE FILES IN THIS PACKAGE ARE
INCLUDED IN THE DISTRIBUTION, INCLUDING THIS DOCUMENTATION, AND
ON THE CONDITION THAT ANY AMENDMENT TO ANY OF THE FILES IS CLEARLY
MARKED AS SUCH, WITH THE NAME AND DETAILS OF THE PERSON MAKING THE
AMENDMENT CLEARLY SPECIFIED.


DISCLAIMER
----------
THIS IS FREE SOFTWARE - so you get what you pay for. Thus,
this package is supplied WITHOUT ANY WARRANTIES WHATSOEVER.
You use the package or any of the files therein ENTIRELY AT
YOUR OWN RISK. If these terms are not acceptable to you, then
PLEASE DELETE THIS PACKAGE AND ALL THAT IS THEREIN FROM YOUR
DISKS AT ONCE, AND PLEASE DO NOT EVER TRY TO USE ANYTHING THEREIN.


**********************
* EXPORTED FUNCTIONS *
**********************

{****** HIGH LEVEL FUNCTIONS: BY THE AFRICAN CHIEF ********************}
Function FileUnzip(SourceZipFile, TargetDirectory, FileSpecs:pChar;
 Report:UnzipReportProc;Question:UnzipQuestionProc):integer;
{
high level unzip
usage:
SourceZipFile: source zip file;
TargetDirectory: target directory
FileSpecs: "*.*", etc.
Report: Report callback or Nil;
Question: Question callback (for confirmation of whether to replace existing
          files) or Nil;

e.g.,
   Count := FileUnzip('test.zip', 'c:\temp', '*.*', MyReportProc, Nil);

}

Function FileUnzipEx(SourceZipFile, TargetDirectory, FileSpecs:pChar):integer;
{
high level unzip with no callback parameters;
passes ZipReport & ZipQuestion internally, so you
can use SetZipReportProc and SetZipQuestionProc before calling this;

e.g.,
   Count := FileUnzipEx('test.zip', 'c:\temp', '*.*');
}

Function ViewZip(SourceZipFile, FileSpecs:pChar; Report:UnzipReportProc):integer;
{
view contents of zip file
usage:
SourceZipFile: source zip file;
FileSpecs: "*.*", etc.
Report: callback procedure to process the reported contents of ZIP file;

e.g.,
  ViewZip('test.zip', '*.*', MyReportProc);
}

Function  SetUnZipReportProc(aProc:UnzipReportProc):Pointer;
{
sets the internal unzip report procedure to aproc
Returns: pointer to the original report procedure
(return value should normally be ignored)

e.g.,
   SetUnZipReportProc(MyReportProc);
}

Function  SetUnZipQuestionProc(aProc:UnzipQuestionProc):Pointer;
{
sets the internal unzip question procedure to aproc
Returns: pointer to the original "question" procedure
(return value should normally be ignored)

e.g.,
SetUnZipQuestionProc(QueryFileExistProc);
}

Function UnzipSize(SourceZipFile:pChar;Var Compressed:Longint):longint;
{ uncompressed and compressed zip size
 usage:
 SourceZipFile  = the zip file
 Compressed     = the compressed size of the files in the archive
 Returns:         the uncompressed size of the ZIP archive

e.g.,
  Var
  Size,CSize:longint;
  begin
     Size := UnzipSize('test.zip', CSize);
  end;
}

Procedure ChfUnzip_Init;
{
initialise or reinitialise the global variables
 *** use with care!! ***
}

{**********************************************************************}
{************ LOW LEVEL FUNCTIONS: BY CHRISTIAN GHISLER ***************}
{**********************************************************************}
function GetSupportedMethods:longint;
{Checks which pack methods are supported by the dll}
{bit 8=1 -> Format 8 supported, etc.}

function UnzipFile(in_name:pchar;out_name:pchar;offset:longint;hFileAction:word;cm_index:integer):integer;
{usage:
 in_name:      name of zip file with full path
 out_name:     desired name for out file
 offset:       header position of desired file in zipfile
 hFileAction:  handle to dialog box showing advance of decompression (optional)
 cm_index:     notification code sent in a wm_command message to the dialog
               to update percent-bar
 Return value: one of the above unzip_xxx codes

 Example for handling the cm_index message in a progress dialog:

 unzipfile(......,cm_showpercent);

 ...

 procedure TFileActionDialog.wmcommand(var msg:tmessage);
 var ppercent:^word;
 begin
   TDialog.WMCommand(msg);
   if msg.wparam=cm_showpercent then begin
     ppercent:=pointer(lparam);
     if ppercent<>nil then begin
       if (ppercent^>=0) and (ppercent^<=100) then
         SetProgressBar(ppercent^);
       if UserPressedAbort then
         ppercent^:=$ffff
       else
         ppercent^:=0;
       end;
     end;
   end;
 end;
}

function  GetFirstInZip(zipfilename:pchar;var zprec:tZipRec):integer;
{
 Get first entry from ZIP file
 e.g.,
   rc:=GetFirstInZip('test.zip', myZipRec);
}

function  GetNextInZip(var Zprec:tZiprec):integer;
{
  Get next entry from ZIP file

 e.g.,
   rc:=GetNextInZip(myZipRec);
}

function  IsZip(filename:pchar):boolean;
{
  VERY simple test for zip file

  e.g.,
   ItsaZipFile := IsZip('test.zip');
}

procedure CloseZipFile(var Zprec:tZiprec);  {Only free buffer, file only open in Getfirstinzip}
{
  free ZIP buffers

  e.g.,
  CloseZipFile(myZipRec);
}



-----------------
Dr Abimbola A Olowofoyeku (The African Chief)
May 1998
http://ourworld.compuserve.com/homepages/African_Chief

