Unit unzip

Classes

Functions

GetSupportedMethods - ***********************************************************************} {$I z_global.
unzipfile - Checks which pack methods are supported by the dll} {bit 8=1 -> Format 8 supported, etc.
unzipfiletomemory - 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(.
UnzipTestIntegrity - usage: in_name: name of zip file with full path out_buf: buffer to recieve unpacked file buf_size: size of buffer to recieve unpacked 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

smaller buffer size than necessary

Types

Constants

unzip_CRCErr
unzip_Encrypted
unzip_InUse
unzip_NotSupported
unzip_Ok
unzip_ReadErr
unzip_UserAbort
unzip_WriteErr
unzip_ZipFileErr

Variables


Functions


function GetSupportedMethods:longint;

***********************************************************************} {$I z_global.pas} {global constants, types and variables} {$I z_tables.pas} {Tables for bit masking, huffman codes and CRC checking} {$I z_generl.pas} {General functions used by both inflate and explode} {$I z_huft.pas} {Huffman tree generating and destroying} {$I z_inflat.pas} {Inflate deflated file} {$I z_copyst.pas} {Copy stored file} {$I z_explod.pas} {Explode imploded file} {$I z_shrunk.pas} {Unshrink function} {$I z_expand.pas} {Expand function} {

function unzipfile(in_name:pchar;out_name:pchar;attr:word;offset:longint;hFileAction:thandle;cm_index:integer):integer;

Checks which pack methods are supported by the dll} {bit 8=1 -> Format 8 supported, etc.

****************** main function: unzipfile *****************************} {written and not copyrighted by Christian Ghisler


function unzipfiletomemory(in_name:pchar;out_buf:pchar;var buf_size:longint; offset:longint;hFileAction:thandle;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;

No user abort!


function UnzipTestIntegrity(in_name:pchar;offset:longint; hFileAction:thandle;cm_index:integer;var crc:longint):integer;

usage: in_name: name of zip file with full path out_buf: buffer to recieve unpacked file buf_size: size of buffer to recieve unpacked 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

smaller buffer size than necessary


Types


Constants

unzip_CRCErr = 1

unzip_Encrypted = 7

unzip_InUse = -1

unzip_NotSupported = 6

unzip_Ok = 0

Error codes returned by unzip

unzip_ReadErr = 3

unzip_UserAbort = 5

unzip_WriteErr = 2

unzip_ZipFileErr = 4


Variables