Информационный сервер для программистов: Исходники со всего света. Паскальные исходники со всего света
  Powered by Поисковый сервер Яndex: Найдется ВСЁ!
На Главную Исходники Форум Информер Страны мира
   Архивы и Архиваторы    >>    unziptmt
   
 
 Chief's UNZIP Unit for TP, BP, TMT and Delphi   Vadim Bodrov 28.04.2000

Модуль работы с ZIP файлами. Компилируется в TP7, BP7, Delphi, VP, TMT.
Chief's UNZIP Unit.The following compilers are supported: Turbo Pascal v7.x (MS-DOS), Borland Pascal v7.x (Dos, DPMI, and Windows), Borland Delphi, TMT Pascal Multi-target v.3.xx (MS-DOS 32-bit PMode, Win32 [console, GUI, DLL], OS/2 [console, PM, DLL]), Virtual Pascal v2.0 (Win32, OS/2)



128k 
 

Readme file for Chief's UNZIP ----------------------------- History ------- v1.00: May 7th 1998: * first release v1.00a: May 9th 1998: * minor amendments v1.01: May 12th 1998: * added support for no recursion v1.02: May 15th 1998: * added support for no Free Pascal (Peter Vreman) v1.03: June 19th 1998: * callback procedural types now declared as STDCALL in all Win32 platforms * new source file added (MATCH.PAS) v1.04: June 20th 1998: * fixed time stamping problems * renamed the Windows DLLs to unzipw16.dll and unzipw32.dll * added new DLL for DOS DPMI (unzipp16.dll) * amendments to UNZIP.INC * added support for OS/2 (Virtual Pascal) v1.05: June 23rd 1998: * fixed to support OS/2 DLLs * minor enhancements to MATCH.PAS V2.06: April 2000: * TMT Pascal Multi-target support added (http://www.tmt.com) ------------------- 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 * TMT Pascal v3.x (DOS PM 32-bit, Win32, OS/2) * Virtual Pascal v2.0 (Win32) * Virtual Pascal v2.0 (OS/2) 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 7. Match.pas - simple name match unit 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\unzipw16.dll - unzipdll.pas compiled for Win16 (rename to unzipdll.dll) 2. \dll\unzipw32.dll - unzipdll.pas compiled for Win32 (rename to unzipdll.dll) 3. \dll\unzipp16.dll - unzipdll.pas compiled for DOS Protected Mode (rename to unzipdll.dll) 4. \dll\unzipos2.dll - unzipdll.pas compiled for 32-bit OS/2 (rename to unzipdll.dll) 5. \delphi3\wincrt.dcu - compiled Win32 version of WinCRT unit (Delphi 3.x) 6. \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; Returns: the number of files that were extracted, or an error code (see ZIPTYPES.PAS for the list of errorcodes) 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; Returns: the same values as FileUnzip (above) 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; Returns: the number of files in archive 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!! *** } FUNCTION SetNoRecurseDirs(DontRecurse:Boolean):Boolean; { Set or unset the internal recursion flag; Returns: the original value (return value ignored) Usage: DontRecurse = TRUE = no recursion; false = full recursion e.g., SetNoRecurseDirs(True); } {******************************************************************} {********** 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) June 1998 http://ourworld.compuserve.com/homepages/African_Chief