Contents
Whats New?

Coming Soon

READ THIS NOW

version 0.61

The complete compression solution for Windows developers.

How do I ... ?

Function reference

Warnings and errors

License

Registration

Distribution

Contacting the author

Release History

Acknowledgements

Questionnaire


How do I ... ?

This section presents the solutions to many commonly asked questions - if your question isn't answered here please contact the author.

How do I get the latest version?

How do I get started?

How do I create an archive?

How do I extract files from an archive?

How do I encrypt/decrypt files?

How do I get feedback from the addZIP Compression Libraries?

How do I view the contents of an archive?

How do I use comments in an archive?

How do I check the integrity of a .ZIP archive?

How do I repair .ZIP archives?

How do I create multi-disk archives?

How do I extract files from a multi-disk archive?


How do I get the latest version?

The latest version is always available direct from the author (see Contacting the author). Alternatively you can download the most recent version from the following Web site(s)

http://ourworld.compuserve.com/homepages/Stephen_Darlington/addzip.htm


How do I get started?

Please read the section relevant to your programming language. After registering you should also add the appropriate function calls to your start-up code.

Visual Basic

(You may want to look over the VB sample files - these will provide you with a good insight into the libraries).

1) Start a new project, and add the addzip.bas file to your project.

2) Put the following code in the Form_Load event

Dim I as Integer

addZIP_Initialise

addUNZIP_Initialise

I = addZIP_SetParentWindowHandle(Me.hWnd)

I = addUNZIP_SetParentWindowHandle(Me.hWnd)

You may wish to test the return value of these function calls in case there is a problem with setting the Windows handle (this will probably never occur, but you never know).

C

(This example assumes you are using the 16-bit libraries. To use the 32-bit libraries substitute 32 for every 16)

1) Start a new project (or open an existing project) and add the azip16.lib and aunzip16.lib files to the project.

2) Add

#include "addzip.h"

#include "addunzip.h"

to your main .C/.CPP file.

3) Add the following to the function where the main window is created

HWND hWnd;

BOOL bReturn;

addZIP_Initialise();

addUNZIP_Initialise();

hWnd = CreateWindow(...);

bReturn = addZIP_SetParentWindowHandle(hWnd);

bReturn = addUNZIP_SetParentWindowHandle(hWnd);

You may wish to test the return value of these function calls in case there is a problem with setting the Windows handle (this will probably never occur, but you never know).

This code should work with all Windows C/C++ compilers include Borland's C++ Builder - if you have any trouble then email me for guidance.


How do I create an archive?

This can be as simple as calling addZIP_ArchiveName to set the name of the archive, and addZIP to start the compression process. This will take all files in the current directory, compress them at the default (normal) compression level, save full path information (the default) and add them to the archive.

As an example, the following will compress all .INI files and .GRP files on the C:\ drive with maximum compression to an archive name BACKUP.ZIP in the TEMP subdirectory.

I = addZIP_ArchiveName("c:\temp\backup.zip")

I = addZIP_Include("c:\*.ini|c:\*.grp")

I = addZIP_Recurse(TRUE)

I = addZIP_SetCompressionLevel(COMPRESSION_MAXIMUM)

I = addZIP()


How do I extract files from an archive?

Extracting files from an archive can be as simple as setting the name of the .ZIP archive and calling the addUNZIP function. This would extract all files from the archive into the current directory. If there are files in the current directory with the same names as those you are extracting, a dialog box will appear asking if you wish to overwrite the existing file(s).

As a further example, the following would extract only the .INI files from the archive backup.zip (see How do I create an archive?). The stored path information will be ignored (which is the default). The files will be extracted to the TEMP directory, overwriting all previous files without prompting.

I = addUNZIP_ArchiveName(c:\temp\backup.zip)

I = addUNZIP_Include(*.ini)

I = addUNZIP_RestoreStructure(FALSE)

I = addUNZIP_ExtractTo(c:\temp)

I = addUNZIP_Overwrite(OVERWRITE_ALL)

I = addUNZIP()


How do I encrypt/decrypt files?

First of all you must register. Without registering you will only be able to encrypt/decrypt files using the password Unregistered. When you registered, you will have been provided with a registration number. Use this, with the registered user name, in function calls to addZIP_Register and/or addUNZIP_Register. Calling addZIP_Encrypt with a password before adding files to an archive will then encrypt all further files added. Use addUNZIP_Decrypt with the appropriate password to extract encypted files from an archive.

N.B. Remember that after calls to addZIP() and addUNZIP(), all defaults will be reset.


How do I get feedback from the addZIP Compression Libraries?

The addZIP libraries communicates with the calling (parent) program by means of notification messages. These messages are sent at important points during the processing of a addZIP() or addUNZIP() function. It is up to you to process this message or ignore it.

The ideal way for the addZIP libraries to pass this information to the calling program is via a callback function (see addZIP_InstallCallback or addUNZIP_InstallCallback). This function then gets called as part of the normal running of the libraries as if it were a native part of the code i.e. the execution of the addZIP code stops when the callback function is called and only restarts when the function is exited. However some development environments (most notably Visual Basic pre version 5) do not support callbacks, the addZIP_SetWindowHandle and addUNZIP_SetWindowHandle functions are available to overcome this limitation. N.B. Without using a callback function, some of the event messages are not available.

The information for a particular notification message is passed as a pipe (|) delimited string of parameters relevant to the message. If you are not using a callback function, the first three parameters are the calling library (azLIBRARY_ADDZIP or azLIBRARY_ADDUNZIP), the message id (see descriptions below) and the current archive name. If you are using a callback function, the first parameter in the list is the current archive name.

AM_SEARCHING     0x0a

This message is generated at the start of a compression process when the addZIP library is using the wildcard patterns specified (or the default *.*) to create a list of files to compress. This message will be generated multiple times.The extra parameters provided with this message are |wildcard_pattern|directory_being_searched|.

AM_ZIPCOMMENT     0x0b

This message is only generated once during the processing of an existing ZIP archive if a comment exists for the archive. The extra parameters are |comment_length|comment|.

AM_ZIPPING        0x0c

This message is generated multiple times during the compression of a file. The extra parameters are |filename|original_size|current_bytes_read|percentage_read|number_of_files_still_to_process.

AM_ZIPPED         0x0d

This message is generated once after a file has been compressed. The extra parameters are |filename|original_size|compressed_size|compression_ratio|number_of_files_still_to_process.

AM_UNZIPPING      0x0e

This message is generated multiple times during the de-compression of a file. The extra parameters are |filename|original_size|bytes_decompressed|percentage_decompressed|.

AM_UNZIPPED       0x0f

This message is generated once after a file has been de-compressed. The extra parameters are |filename|original_size|decompressed_size|percentage|.

AM_TESTING        0x10

Like the AM_UNZIPPING message, this message is generated multiple times during a test decompression of the file. Unlike AM_UNZIPPING no file is actual extracted. The extra parameters are |filename|original_size|bytes_decompressed|percentage_decompressed|.

AM_TESTED         0x11

Like the AM_UNZIPPED message, this message is generated once after the test decompression of the file. Unlike AM_UNZIPPED no file is actual extracted. The extra parameters are |filename|original_size|decompressed_size|percentage_decompressed|.

AM_DELETING       0x12

This message is generated once at the start of the deletion of a file from the archive. The extra parameter is |filename|.

AM_DELETED        0x13

This message is generated once at the end of the deletion of a file from the archive. The extra parameter is |filename|.

AM_DISKCHANGE     0x14

The message is generated during the processing of multi-disk archives and only if you are using a callback function. You need to prompt the user to insert the correct disk before exiting the callback function. The extra parameter is |required_disk_number|.

AM_VIEW           0x15

Please see the topic How do I view the contents of an archive? for information on the AM_VIEW message.

AM_ERROR          0x16

Should a serious error occur during processing, this message will be generated prior to the process being aborted. The extra parameters are |filename|error_code|.

AM_WARNING        0x17

Should a non-serious error occur during processing, this message will be generated prior to the process continuing. The extra parameters are |filename|warning_code|.

AM_QUERYOVERWRITE 0x18

This message is generated only if using a callback function, and a file with the same name exists in the archive (for addZIP), or on the destination drive (for addUNZIP). You should prompt the user to select an option and then the function should return the required azOW_ constant. The extra parameters are |current_filename|current_size|current_datetime|new_filename|new_size|new_datetime|

.

AM_COPYING        0x19

This message is generated when copying the archive from its temporary location to its proper location. No extra parameters are passed.

AM_COPIED         0x1a

This message is generated after the archive has been copied from its temporary location to its proper location. No extra parameters are passed.

AM_ABORT          0xff

Only used in the callback function, if the function returns this message the library will abort its current processing. No extra parameters.


How do I view the contents of an archive?

N.B. With archives that span multiple disks, only the addUNZIP_View function should be used.

By including a call to addUNZIP_View() in your code, a notification message will be generated for all the files in the .ZIP archive that match the given file specification (or all the files if none given). See previous How do I ... ? for information on receiving notification messages withinh your program.

As with other notification messages, the extra information is passed as a list of | (pipe) delimited parameters as detailed below.

|path	the stored directory structure (if included), or empty

|filename	the compressed file name

|original_size	the file's original (uncompressed) size

|compressed_size	the compressed size

|ratio	the percentage compression achieved

|date	the last accessed date (in YYYY-MM-DD sortable format)

|time 	the last accessed time (in HH:MM:SS format)

|attributes	the stored file attributes (operating system dependant)

|method	the compression method used

|encrypted flag	boolean value indicating whether the file is encrypted (1) or not (0)

|CRC	the Cyclical Redundancy Check 32-bit value

|filetype flag	boolean value indicating whether the file is binary (1) or text (0)

|created	floating point value indicating version of PKZIP used to compress file

|needed	floating point value indciating version of PKUNZIP needed to extract file


How do I use comments in an archive?

From version 0.5 of the libraries it is possible to add, retrieve, display and delete a comment stored in a .ZIP archive.

Please see the relevant function reference for more information on the comment functions, and also refer to How do I get feedback from the addZIP Compression Libraries?

N.B. When the comment is passed back to the calling program as part of the processing of an archive it is terminated with a NULL character (ASCII value = 0). Most languages recognise this as the terminator for a line, however other languages, for example Visual Basic, do not. If your language does not recognise NULL as the end of a line, use InStr (or its equivalent) to locate the instance of the NULL character, and then truncate the line at the previous character.


How do I check the integrity of a .ZIP archive?

Briefly you need to make calls to the following functions addUNZIP_ArchiveName, addUNZIP_Test and addUNZIP. You should then check the feedback edit box (see previous How do I ... ?) - any problems will be reported as errors and warnings. See the next How do I ... ? to see how to repair any damaged .ZIP archives.


How do I repair .ZIP archives?

The short answer to this, at the moment, is that you can't. Well not with the addZIP Compression Libraries. PKWARE provides an excellent zip repair utility with its PKZIP package.


How do I create multi-disk archives?

As of version 0.5 of the libraries it is possible to create .ZIP archives that span multiple diskettes ( or other removable media). These multi-disk archives are compatible with PKUNZIP.

To create a multi-disk archive, include a call to addZIP_Span in your code that sets up the library, and ensure that the .ZIP archive will be created on a diskette and that no previous .ZIP archive of the same name exists at that location (otherwise it will be overwritten). Although the file(s) will be compressed to the specified removable media, some temporary disk space is needed to hold a file whilst it is being compressed. This temporary disk space need not be any more than the largest file to be compressed.

When the disk is full, a notification message will be sent (if using a callback function) or a prompt will be displayed (if not using a callback function) to request the removal and labelling of the current diskette, and the insertion of a new diskette. This disk will then be used until all files are compressed or it too is full - again a prompt will be displayed. This will be repeated until all files are compressed.


How do I extract files from a multi-disk archive?

The addUNZIP libraries have now been made 'multi-disk archive' aware. This means that if you want to extract files from a multi-disk archive, addUNZIP will prompt for the correct disks.

Because .ZIP archives stores its central information at the end of the archive, it is necessary to insert the last disk of the multi-disk set first. addUNZIP will then read all the relevant information before prompting for the correct disks. If you insert the first disk first, addUNZIP is smart enough to prompt for the last disk. If you insert any other disk in the set first, addUNZIP has no way of knowing whether the archive is part of a multi-disk set or, possibly, a corrupt archive.


Function reference

addZIP Compression Libraries azip16.dll and azip32.dll

addUNZIP Compression Libraries aunzip16.dll and aunzip32.dll

addINMEMORY Compression Libraries aim16.dll and aim32.dll


addZIP Function Reference

* new function in this version

addZIP

addZIP_ArchiveName

addZIP_ClearAttributes *

addZIP_Comment

addZIP_Delete

addZIP_DeleteComment

addZIP_DisplayComment *

addZIP_Encrypt

addZIP_Exclude

addZIP_ExcludeListFile

addZIP_Freshen *

addZIP_GetLastError

addZIP_GetLastWarning

addZIP_Include

addZIP_IncludeDirectoryEntries *

addZIP_IncludeFilesNewer *

addZIP_IncludeFilesOlder *

addZIP_IncludeArchive *

addZIP_IncludeHidden *

addZIP_IncludeReadOnly *

addZIP_IncludeSystem *

addZIP_IncludeListFile

addZIP_Initialise *

addZIP_InstallCallback *

addZIP_Overwrite

addZIP_Recurse

addZIP_Register

addZIP_SaveAttributes *

adZIP_SaveStructure

addZIP_SetArchiveDate *

addZIP_SetCompressionLevel

addZIP_SetParentWindowHandle

addZIP_SetTempDrive

addZIP_SetWindowHandle

addZIP_Span

addZIP_Store

addZIP_Update *

addZIP_UseLFN

addZIP_View


addZIP

This function begins the compression process.

Syntax

int addZIP()

Parameters

None.

Returns

This function returns the number of files processed. If -1 is returned, there is no .ZIP archive name specified. 0 indicates no files have been processed.

Remarks

This function should not be called without first specifying the name of the .ZIP archive (see addZIP_ArchiveName)

Example(s)


addZIP_ArchiveName

This function specifies the name of the .ZIP archive to work with.

Syntax

int addZIP_ArchiveName(LPSTR lpsz)

Parameters

lpsz	the name of the .ZIP archive

Returns

The return value is non-zero if no error occurs. If it is zero, an error has occurred (probably out of memory).

Remarks

This function is always required.

Example(s)


addZIP_ClearAttributes

Allows the specified file attributes to be cleared after the file is compressed. The default is to clear no attributes (equivalent to addZIP_ClearAttributes(azATTR_NONE)).

Syntax

int addZIP_ClearAttributes(int iAttributes)

Parameter

iAttributes	specifies the attributes to be cleared. This can be any combination of  azATTR_READONLY, azATTR_HIDDEN, azATTR_SYSTEM and azATTR_ARCHIVE. For convenience there also flags to specify no attributes are cleared (azATTR_NONE) and to clear all attributes (azATTR_ALL).

Returns

The return value represents the attributes that will be cleared during the processing of addZIP (i.e. it should return the same value that was passed as a parameter).

Remarks

Example(s)


addZIP_Comment

This function allows the user to add a comment to the .ZIP archive.

Syntax

int addZIP_Comment(LPSTR lpsz)

Parameters

lpsz	the comment to add to the archive

Returns

This function returns a non-zero value if no error occurs.

Remarks

The most common cause for an error is a NULL (or zero-length) string being passed in error.

Example(s)


addZIP_Delete

This function will allow the deletion of the specified files from the archive

Syntax

int addZIP_Delete(BOOL bFlag)

Parameters

bFlag	set this value to true if you want to delete files from an archive

Returns

This function returns a non-zero value on success.

Remarks

Example(s)

The following example will delete all files matching *.INI and WINDOWS\*.GRP from the archive BACKUP.ZIP.

addZIP_ArchiveName("BACKUP.ZIP")

addZIP_Include("*.INI|WINDOWS\*.GRP")

addZIP_Delete(TRUE)

addZIP()


addZIP_DeleteComment

This function allows the user to remove the comment (if one exists) from the .ZIP archive.

Syntax

int addZIP_DeleteComment(BOOL bFlag)

Parameters

bFlag	set this value to TRUE to remove the ZIP comment from the archive

Returns

This function returns a non-zero value if the next call to addZIP will delete any existing comment. A value 0 means that the comment will be left untouched.

Remarks

Example(s)


addZIP_DisplayComment

Allows the addZIP library to display the archive comment (if one exists) prior to further processing. The default is not to display the comment.

Syntax

int addZIP_DisplayComment(int iFlag)

Parameter

iFlag	a boolean value (O for FALSE, 1 or -1 for TRUE) indicating whether to display the comment

Returns

This function returns a non-zero value indicating the comment will be displayed, 0 if no comment will be displayed.

Remarks

Example(s)


addZIP_Encrypt

This function will encrypt compressed files with the provided password. The default is not to encrypt files.

Syntax

int addZIP_Encrypt(LPSTR lpsz)

Parameters

lpsz	a password with which to encrypt the files next added to the archive.

Returns

This function returns non-zero if successful. A return value of zero indicates lack of sufficient memory.

Remarks

With the unregistered version of the addZIP Compression Libraries, lpsz is ignored, and the files are encrypted with the password Unregistered. Registered users will be provided with a registration code that will allow encryption with their own passwords.

Example(s)


addZIP_Exclude

These functions allows for the exclusion of specified files. Any files matching those specified will be excluded from any processing.

Syntax

int addZIP_Exclude(LPCSTR lpsz)

Parameters

lpsz	the pipe-delimited (|) list of files to exclude.

Returns

These functions return a non-zero value on success. A return value of zero indicates that lpsz is NULL or there is not enough memory.

Remarks

As in all file functions that accept file specifications (except addZIP_ArchiveName), wildcard characters can be specified. For large numbers of file specifications, you may want to consider using a list file (see How do I use list files?).

Example(s)


addZIP_ExcludeListFile

These functions allow the developer to specify the name of an existing file that contains a list of file specifications to exclude.

Syntax

int addZIP_ExcludeListFile(LPCSTR lpsz)

Parameters

lpsz	the name of the existing file

Returns

These functions return a non-zero value on success. A return value of zero indicates that lpsz doesn't exist, wasn't found or is spelt incorrectly.

Remarks

Please see How do I use list files? for a discussion on list files and there uses.

Example(s)


addZIP_Freshen

Allows an existing .ZIP archive to be freshened - that is, only files that currently exist in the archive will be compressed and only if they are newer that those files already in the archive.

Syntax

int addZIP_Freshen(int iFlag)

Parameter

iFlag	set to TRUE if you want to freshen the archive.

Returns

The return value will be non-zero if the archive will be freshened on the next call to addZIP(). A value of zero indicates that addZIP() will process all files.

Remarks

The .ZIP archive (specified with addZIP_ArchiveName) must exist for this function to be valid.

Example(s)


addZIP_GetLastError

This function can be used to retrieve the last error code generated by the last call to addZIP().

Syntax

int addZIP_GetLastError()

Parameters

None

Returns

This function will return a non-zero value if an error occurred during the last call to addZIP(). A value of 0 indicates that no error occurred.

Remarks

This function is useful for developers where the language can call functions in DLLs but cannot provide an interface for retrieving feedback information from the DLL.

Example(s)


addZIP_GetLastWarning

This function can be used to retrieve the last warning code generated by the last call to addZIP().

Syntax

int addZIP_GetLastWarning()

Parameters

None

Returns

This function will return a non-zero value if a warning occurred during the last call to addZIP(). A value of 0 indicates that no warning occurred.

Remarks

This function is useful for developers where the language can call functions in DLLs but cannot provide an interface for retrieving feedback information from the DLL.

Example(s)


addZIP_Include

These functions allows the developer to specify exactly which files to include during processing. The default is to include all (*.*) files excluding hidden and system files.

Syntax

int addZIP_Include(LPCSTR lpsz)

Parameters

lpsz	a delimited list file specifications (e.g. *.ini|*.grp)

Returns

These functions return a non-zero value on success. A return value of zero indicates that lpsz is NULL or there is not enough memory.

Remarks

As in all file functions that accept file specifications (except addZIP_ArchiveName), wildcard characters can be specified. For large numbers of file specifications, you may want to consider using a list file (see How do I use list files?).

Example(s)


addZIP_IncludeArchive

Allows the inclusion of files based on the existence of the archive attribute The default is to include files irrespective of the archive attribute.

Syntax

int addZIP_IncludeArchive(int iFlag)

Parameter

iFlag	has to be one of the following: azNEVER - a file must not have the archive attribute set to be included; azALWAYS - a file must have the archive attribute set to be included; azYES - a file will be included regardless of the archive attribute.

Returns

This function returns the same value that was passed as a parameter, if correct. If the function was called with an illegal value, this function returns the original value.

Example(s)


addZIP_IncludeDirectoryEntries

Allows the inclusion of directories as seperate entries in a .ZIP archive. The default is not to store directories as seperate entries.

Syntax

int addZIP_IncludeDirectoryEntries(int iFlag)

Parameter

iFlag	a boolean value (O for FALSE, 1 or -1 for TRUE) indicating whether to store directories as seperate entries.

Returns

This function returns a non-zero value indicating that directories will be stored as seperate entries, 0 to store directories as part of a normal .ZIP entry.

Remarks

Example(s)


addZIP_IncludeFilesNewer

Allows the filtering of files based on last accessed date. Files are included if they were last accessed on or after the specified date. The default is to take all files regardless of the last accessed date.

Syntax

int addZIP_IncludeFilesNewer(LPSTR szDate)

Parameter

szDate	specifies the date as a string in the format YYYY-MM-DD

Returns

This function returns a non-zero value if the user has passed a valid date, other wise a zero is returned.

Remarks

Example(s)


addZIP_IncludeFilesOlder

Allows the filtering of files based on last accessed date. Files are included if they were last accessed before the specified date. The default is to take all files regardless of the last accessed date.

Syntax

int addZIP_IncludeFilesOlder(LPSTR szDate)

Parameter

szDate	specifies the date as a string in the format YYYY-MM-DD

Returns

This function returns a non-zero value if the user has passed a valid date, other wise a zero is returned.

Remarks

Example(s)


addZIP_IncludeHidden

Allows the inclusion of files based on the existence of the hidden attribute The default is to exclude a file if it has the hidden attribute set.

Syntax

int addZIP_IncludeHidden(int iFlag)

Parameter

iFlag	has to be one of the following: azNEVER - a file must not have the hidden attribute set to be included; azALWAYS - a file must have the hidden attribute set to be included; azYES - a file will be included regardless of the hidden attribute.

Returns

This function returns the same value that was passed as a parameter, if correct. If the function was called with an illegal value, this function returns the original value.

Example(s)


addZIP_IncludeListFile

These functions allow the developer to specify the name of an existing file that contains a list of file specifications to include.

Syntax

int addZIP_IncludeListFile(LPCSTR lpsz)

Parameters

lpsz	the name of the existing file

Returns

These functions return a non-zero value on success. A return value of zero indicates lpsz doesnt exist, wasnt found or is spelt incorrectly.

Remarks

Please see How do I use list files? for a discussion on list files and there uses.

Example(s)


addZIP_IncludeReadOnly

Allows the inclusion of files based on the existence of the read-only attribute The default is to include a file regardless of the read-only attribute.

Syntax

int addZIP_IncludeReadOnly(int iFlag)

Parameter

iFlag	has to be one of the following: azNEVER - a file must not have the read-only attribute set to be included; azALWAYS - a file must have the read-only attribute set to be included; azYES - a file will be included regardless of the read-only attribute.

Returns

This function returns the same value that was passed as a parameter, if correct. If the function was called with an illegal value, this function returns the original value.

Example(s)


addZIP_IncludeSystem

Allows the inclusion of files based on the existence of the system attribute The default is to exclude a file if it has the system attribute set.

Syntax

int addZIP_IncludeSystem(int iFlag)

Parameter

iFlag	has to be one of the following: azNEVER - a file must not have the system attribute set to be included; azALWAYS - a file must have the system attribute set to be included; azYES - a file will be included regardless of the system attribute.

Returns

This function returns the same value that was passed as a parameter, if correct. If the function was called with an illegal value, this function returns the original value.

Example(s)


addZIP_Initialise

This function initialises the addZIP Compression Library and must be the first function called.

Syntax

void addZIP_Initialise(void)

Parameters

None

Returns

This function doesn ot return a value.

Remarks

If this function is omitted, the performance of the library may be erratic.

Example(s)


addZIP_InstallCallback

Allows the developer to specify an application-defined function that will be called regularly during the processing of addZIP(). The callback function can then process the passed message information as necessary.

Syntax

int addZIP_InstallCallback(CALLBACKFN cbFunction)

Parameter

cbFunction	specifies the name of the callback function

Returns

This function returns a non-zero number on success, 0 on failure.

Remarks

Please refer to the How do I get feedback from the libraries? for further information on using callback functions and message reference.

Example(s)

#include "addzip.h"

INT16 CALLBACK mycallback(INT16 iLibrary, INT16 iMessage, char *szInfo) {

switch (iMessage) {

case default:

// default handling here

case AM_SEARCHING:

...

case AM_ZIPPING:

// update user interface here

...

}

return 1;

}

int main() {

if (addZIP_InstallCallback((CALLBACKFN)mycallback) == 0) {

// error processing

}

if (addZIP_ArchiveName("full.zip") == 0) {

// error processing

}

if (addZIP_Include("c:\\*.*") == 0) {

// error processing

addZIP_SaveStructure(azSTRUCTURE_ABSOLUTE);

addZIP();

}


addZIP_Overwrite

These functions allows the developer to change how addZIP deals with files that already exist within the .ZIP archive. The default is to prompt the user to choose between overwriting the existing file or skipping the file.

Syntax

int addZIP_Overwrite(UINT fExist)

Parameters

fExist	one of OVERWRITE_QUERY, OVERWRITE_ALL or OVERWRITE_NONE. The constants are self-explanatory. The default is OVERWRITE_QUERY.

Returns

These functions returns a non-zero value on success. A return value of zero indicates an incorrect constant was given.

Remarks

If a file exists in the archive with the same name as the one being added, the default action is to display a dialog box allowing the user to choose which file to keep. If the user selects YES (or YES TO ALL) the existing file will be overwritten with the new file; if NO (or NO TO ALL) is selected the existing file is kept. Files are compared using full path information if it exists, so ctl3d.dll, system\ctl3d.dll and windows\system\ctl3d.dll are all unique files.

Example(s)


addZIP_Recurse

The addZIP_Recurse function allows the developer to specify whether any directories found should be recursed into. The default is to

not recurse into any directories i.e. take only files from the specified (or current directory) only.

Syntax

BOOL addZIP_Recurse(BOOL fAccept)

Parameters

fAccept	Set this value to TRUE to specify recursion. The default is FALSE.

Returns

This functions returns a non-zero value if recursion will be used in the next call to addZIP. A return value of zero indicates that recursion is off.

Remarks

Whilst very powerful, recursion has to be used carefully. Bear in mind that when recursion is on, addZIP will check every directory under the starting directory, all the directories under those found and so on. This can lead to a large number of files being selected and added to the archive. Also always save the directory structure when using recursion, failure to do so will result in files of the same name being excluded.

Example(s)


addZIP_Register

These functions register the addZIP Compression Libraries, allowing the use of your own passwords in the addZIP_Encrypt and addUNZIP_Decrypt functions.

Syntax

int addZIP_Register(LPCSTR lpszName, long lPassword)

Parameters

lpszName	the registered user name

lPassword	the provided registration number

Returns

These functions return a non-zero value if it is a valid registered user name and a valid registration number. A return value of zero indicates that registration has failed. If this is the case, please make sure you entered the function parameters as provided.

Remarks

Examples


addZIP_SaveAttributes

Allows the specified file attributes to be saved along with the compressed file.The default is to save the archive and read-only attributes.

Syntax

int addZIP_SaveAttributes(int iAttributes)

Parameter

iAttributes	specifies the attributes to be saved. This can be any combination of  azATTR_READONLY, azATTR_HIDDEN, azATTR_SYSTEM and azATTR_ARCHIVE. For convenience there also flags to specify no attributes are saved (azATTR_NONE) and to save all attributes (azATTR_ALL).

Returns

The return value represents the attributes that will be saved during the processing of addZIP (i.e. it should return the same value that was passed as a parameter).

Remarks

Example(s)


addZIP_SaveStructure

The addZIP_SaveStructure function registers how the files are stored in a .ZIP archive. Files may be stored with full path information (the default), with relative path information (relative to the starting directory) and with no path information.

Syntax

int addZIP_SaveStructure(int fHow)

Parameters

fHow 	either azSTRUCTURE_ABSOLUTE, azSTRUCTURE_RELATIVE or azSTRUCTURE_NONE

Returns

This functions returns a non-zero value on success. A return value of zero indicates that the specified parameter was invalid.

Remarks

Example(s)


addZIP_SetArchiveDate

Allows the last accessed date of the .ZIP archive to be specified.The default is to set the last accessed date to the current system date.

Syntax

int addZIP_SetArchiveDate(int iDate)

Parameter

iDate	specifies the date to be used. This must be one of DATE_TODAY (the current system date), DATE_ORIGINAL (the original last accessed date), DATE_OLDEST (the date of the oldest file in the archive) or DATE_NEWEST (the date of the newest file in the archive.

Returns

The return value represents the date value that will be used (i.e. it should return the same value that was passed as a parameter).

Remarks

Example(s)


addZIP_SetCompressionLevel

The addZIP_SetCompressionLevel function can be used to vary the speed and compression of the addZIP Compression Libraries. The speed and amount of compression are inversely linked, so specifying COMPRESSION_NONE is the quickest but there is no compression, whilst COMPRESSION_MAXIMUM is the slowest but will achieve the maximum possible level of compression. The default value is COMPRESSION_NORMAL which gives medium speed with medium compression.

Syntax

int addZIP_SetCompressionLevel(UINT fLevel)

Parameters

fLevel	the required compression level (COMPRESSION_NONE, COMPRESSION_MINIMUM, COMPRESSION_NORMAL or COMPRESSION_MAXIMUM).

Returns

This functions returns a non-zero value on success. A return value of zero indicates an invalid compression level was specified.

Remarks

Example(s)


addZIP_SetParentWindowHandle

These functions are required so that any dialog boxes displayed by the addZIP Compression libraries are modal to the calling application.

Syntax

int addZIP_SetParentWindowHandle(HWND hwnd)

Parameters

hwnd	the handle of the parent application

Returns

These functions return a non-zero value on success. A return value of zero indicates that hwnd does not exist.

Remarks

Although not strictly required, you are advised to always include this function call in your application.

Example(s)


addZIP_SetTempDrive

This function allows specification of an alternate drive (and directory if necessary) where addZIP can store temporary files.

Syntax

int addZIP_SetTempDrive(LPSTR lpsz)

Parameters

lpsz	the drive on which to store temporary files

Returns

These functions return a non-zero value on success. A return value of zero indicates that an error has occurred.

Remarks

When creating (or adding to) a .ZIP archive, a temporary file is used to hold the compressed files in the first instance. When compression is complete, the file is then renamed/copied to the location as specified in addZIP_ArchiveName. In many occasions the default drive for temporary files may not have enough space to hold the temporary archive, addZIP_SetTempDrive can be used to point to a drive that has sufficient space.

Example(s)


addZIP_SetWindowHandle

These functions are required if you want feedback from addZIP() and addUNZIP(). The handle passed via this function must be the window handle (hwnd) of an edit/text box.

Syntax

int addZIP_SetWindowHandle(HWND hwnd)

Parameters

hwnd	the handle of the edit/text box used for passing messages

Returns

These functions return a non-zero value on success. A return value of zero indicates that the edit/text box does not exist.

Remarks

Example(s)


addZIP_Span

This function informs the library to use span multiple diskettes if necessary.

Syntax

BOOL addZIP_Span(BOOL bFlag)

Parameters

bFlag	set this value to TRUE is you want to enable disk spanning

Returns

This function returns 0 if disk spanning is disabled, otherwise a non-zero value indicates that disk spanning is enabled.

Remarks

When disk spanning is enabled, the archive specified by the call to addZIP_ArchiveName should not previously exist, and must contain a drive specification that is a removable drive. If the archive with the same name does exist at that location it will be overwritten. If the specified drive is not a removable drive (i.e. is fixed) then the call to addZIP will fail with error code 27.

Example(s)


addZIP_Store

This function allows the developer to specify a set of file extensions that will not be compressed.

Syntax

int addZIP_Store(LPSTR lpstr)

Parameters

lpstr	a pipe-delimited list of file extensions

Returns

This function returns a non-zero value on success. A return value of zero indicates an out of memory error.

Remarks

The default value is ARC|ARJ|LZH|Z|ZIP|ZOO. Files with these extensions are typically compressed files, further compression would be minimal, therefore these files will be stored without compression. This is strictly a speed optimisation. You may choose to override these extensions by specifying a zero-length string, or by specifying COMPRESSION_MAXIMUM in a call to addZIP_SetCompressionLeveL.

Example(s)


addZIP_Update

Allows an existing .ZIP archive to be updated - that is, only files that either i) do not currently exist, or ii) currently exist in the archive but are newer, will be compressed,

Syntax

int addZIP_Update(int iFlag)

Parameter

iFlag	set to TRUE if you want to updated the archive.

Returns

The return value will be non-zero if the archive will be updated on the next call to addZIP(). A value of zero indicates that addZIP() will process all files.

Remarks

The .ZIP archive (specified with addZIP_ArchiveName) must exist for this function to be valid.

Example(s)


addZIP_UseLFN

This function may be used to allow both 16- and 32-bit libraries to use long filenames when running on Windows 95 (NT?). The default value for the 16-bit library is FALSE (use short names), and TRUE for Windows 95 (use long names).

Syntax

int addZIP_UseLFN(int fFlag)

Parameters

fFlag	TRUE to use long filenames when running under Windows 95. FALSE to use MS-DOS short names.

Returns

This function return a non-zero value on success.

Remarks

Example(s)


addZIP_View

This function allows the developer to display the contents of a .ZIP archive. Please see How do I view the contents of an archive? for more information.

Syntax

int addZIP_View(BOOL bFlag)

Parameters

bFlag	set this value to true if you want to view the contents of the .ZIP archive.

Returns

This function returns a non-zero value on success.

Remarks

The addZIP version of _View will not handle archives split over multiple diskettes. Please use addUNZIP_View.

Example(s)


addUNZIP Function Reference

* new function in this version

addUNZIP

addUNZIP_ArchiveName

addUNZIP_Decrypt

addUNZIP_DisplayComment

addUNZIP_Exclude

addUNZIP_ExcludeListFile

addUNZIP_ExtractTo

addUNZIP_GetLastError

addUNZIP_GetLastWarning

addUNZIP_Freshen *

addUNZIP_Include

addUNZIP_IncludeListFile

addUNZIP_Initialise *

addUNZIP_InstallCallback *

addUNZIP_Overwrite

addUNZIP_Register

addUNZIP_RestoreAttributes *

addUNZIP_RestoreStructure

addUNZIP_SetParentWindowHandle

addUNZIP_SetWindowHandle

addUNZIP_Test

addUNZIP_ToMemory

addUNZIP_Update

addUNZIP_View


addUNZIP

This function begins the decompression process.

Syntax

int addUNZIP()

Parameters

None.

Returns

This function returns the number of files processed. If -1 is returned, there is no .ZIP archive name specified. 0 indicates no files have been processed.

Remarks

This functions should not be called without first specifying the name of the .ZIP archive (see addUNZIP_ArchiveName)

Example(s)


addUNZIP_ArchiveName

This function specifies the name of the .ZIP archive to work with.

Syntax

int addUNZIP_ArchiveName(LPCSTR lpsz)

Parameters

lpsz	the name of the .ZIP archive

Returns

The return value is non-zero if no error occurs. If it is zero, an error has occurred (probably out of memory).

Remarks

This function is always required.

Example(s)


addUNZIP_Decrypt

This function instructs addUNZIP() to decrypt any encrypted files with the specified password. The default is not to decrypt encypted files.

Syntax

int addZIP_Decrypt(LPCSTR lpsz)

Parameters

lpsz	the password with which to decrypt the files

Returns

The return value is non-zero if successful. A return value of zero indicates lack of sufficient memory.

Remarks

With the unregistered version of the addZIP Compression Libraries, lpsz is ignored, and the files can only be decrypted with the password Unregistered. Registered users will be provided with a registration code that will allow decryption with their own passwords.

Example(s)


addUNZIP_DisplayComment

This function will cause the archive comment to be displayed in a dialogue box at the start of the processing of the call to addUNZIP.

Syntax

BOOL addUNZIP_DisplayComment(BOOL bFlag)

Parameters

bFlag	set this value to TRUE to have the comment displayed

Returns

This function returns a non-zero value if the comment will be displayed. A return value of 0 means that the comment will not be displayed.

Remarks

Any archive comment will be passed as information (i.e. like the errors etc) during the normal processing irrespective of any call to this function.

Example(s)


addUNZIP_Exclude

This function allows for the exclusion of specified files. Any files matching those specified will be excluded from any processing. The default for this function is to exclude no files.

Syntax

int addUNZIP_Exclude(LPCSTR lpsz)

Parameters

lpsz	the pipe-delimited (|) list of files to exclude.

Returns

These functions return a non-zero value on success. A return value of zero indicates that lpsz is NULL or there is not enough memory.

Remarks

As in all file functions that accept file specifications (except addZIP_ArchiveName), wildcard characters can be specified. For large numbers of file specifications, you may want to consider using a list file (see How do I use list files?).

Example(s)


addUNZIP_ExcludeListFile

This function allows the developer to specify the name of an existing file that contains a list of file specifications to exclude. The default is to not use a list file.

Syntax

int addUNZIP_ExcludeListFile(LPCSTR lpsz)

Parameters

lpsz	the name of the existing file

Returns

These functions return a non-zero value on success. A return value of zero indicates that lpsz doesn't exist, wasn't found or is spelt incorrectly.

Remarks

Please see How do I use list files? for a discussion on list files and there uses.

Example(s)


addUNZIP_ExtractTo

This function sets the drive and directory where the files are to be extracted to. This will be the root directory for any restored directory structure. The default is to extract to the current directory.

Syntax

int addUNZIP_ExtractTo(LPCSTR lpstr)

Parameters

lpstr	the name of the drive:directory to extract to

Returns

This function returns a non-zero value on success. A 0 indicates lack of memory (or lpstr is NULL).

Remarks

If the directory doesn't exist it will created in the same way as any stored directories (if addUNZIP_RestoreStructure is called).

Example(s)


addUNZIP_Freshen

Allows an existing .ZIP archive to be used to freshen the files stored on the destination drive/directory - that is, only files that currently exist on the destination drive/directory and in the archive will be decompressed, and only if the current ones are older than the archive ones.

Syntax

int addUNZIP_Freshen(int iFlag)

Parameter

iFlag	set to TRUE if you want to freshen the destination drive/directory

Returns

The return value will be non-zero if the drive/directory will be freshened on the next call to addUNZIP(). A value of zero indicates that addUNZIP() will process all files.

Remarks

Example(s)


addUNZIP_GetLastError

This function can be used to retrieve the last error code generated by the last call to addUNZIP().

Syntax

int addUNZIP_GetLastError()

Parameters

None

Returns

This function will return a non-zero value if an error occurred during the last call to addUNZIP(). A value of 0 indicates that no error occurred.

Remarks

This function is useful for developers where the language can call functions in DLLs but cannot provide an interface for retrieving feedback information from the DLL.

Example(s)


addUNZIP_GetLastWarning

This function can be used to retrieve the last warning code generated by the last call to addZIP().

Syntax

int addZIP_GetLastWarning()

Parameters

None

Returns

This function will return a non-zero value if a warning occurred during the last call to addZIP(). A value of 0 indicates that no warning occurred.

Remarks

This function is useful for developers where the language can call functions in DLLs but cannot provide an interface for retrieving feedback information from the DLL.

Example(s)


addUNZIP_Include

This function allows the developer to specify exactly which files to include during processing. The default is to include all (*.*) files.

Syntax

int addUNZIP_Include(LPCSTR lpsz)

Parameters

lpsz	a delimited list file specifications (e.g. *.ini|*.grp)

Returns

This function returns a non-zero value on success. A return value of zero indicates that lpsz is NULL or there is not enough memory.

Remarks

As in all file functions that accept file specifications (except addZIP_ArchiveName), wildcard characters can be specified. For large numbers of file specifications, you may want to consider using a list file (see How do I use list files?).

Example(s)


addUNZIP_IncludeListFile

This function allows the developer to specify the name of an existing file that contains a list of file specifications to include. The default is not to use a list file.

Syntax

int addUNZIP_IncludeListFile(LPCSTR lpsz)

Parameters

lpsz	the name of the existing file

Returns

These functions return a non-zero value on success. A return value of zero indicates lpsz doesn't exist, wasn't found or is spelt incorrectly.

Remarks

Please see How do I use list files? for a discussion on list files and there uses.

Example(s)


addUNZIP_Initialise

This function initialises the addUNZIP Compression Library and must be the first function called.

Syntax

void addUNZIP_Initialise(void)

Parameters

None

Returns

This function does not return a value.

Remarks

If this function is omitted, the performance of the library may be erratic.

Example(s)


addUNZIP_InstallCallback

Allows the developer to specify an application-defined function that will be called regularly during the processing of addUNZIP(). The callback function can then process the passed message information as necessary.

Syntax

int addUNZIP_InstallCallback(CALLBACKFN cbFunction)

Parameter

cbFunction	specifies the name of the callback function

Returns

This function returns a non-zero number on success, 0 on failure.

Remarks

Please refer to the How do I get feedback from the libraries? for further information on using callback functions.

Example(s)

#include "addunzip.h"

INT16 CALLBACK mycallback(INT16 iLibrary, INT16 iMessage, char *szInfo) {

switch (iMessage) {

case default:

// default handling here

case AM_UNZIPPING:

// update user interface here

...

}

return 1;

}

int main() {

if (addUNZIP_InstallCallback((CALLBACKFN)mycallback) == 0) {

// error processing

}

if (addUNZIP_ArchiveName("full.zip") == 0) {

// error processing

}

if (addUNZIP_Include("c:\\*.*") == 0) {

// error processing

}

addUNZIP_RestoreStructure(TRUE);

addZIP();

}


addUNZIP_Overwrite

This function allows the developer to change how addUNZIP deals with files that already exist in the directory to extract to. The default is to prompt the user to choose between overwriting the existing file or skipping the file.

Syntax

int addUNZIP_Overwrite(UINT fExist)

Parameters

fExist	one of OVERWRITE_QUERY, OVERWRITE_ALL or OVERWRITE_NONE. The constants are self-explanatory. The default is OVERWRITE_QUERY.

Returns

These functions returns a non-zero value on success. A return value of zero indicates an incorrect constant was given.

Remarks

If a file exists in the archive with the same name as the one being added, the default action is to display a dialog box allowing the user to choose which file to keep. If the user selects YES (or YES TO ALL) the existing file will be overwritten with the new file; if NO (or NO TO ALL) is selected the existing file is kept.Files are compared using full path information if it exists, so ctl3d.dll, system\ctl3d.dll and windows\system\ctl3d.dll are unique files.

Example(s)


addUNZIP_Register

This function register the addZIP Compression Libraries, allowing the use of your own passwords in the addUNZIP_Decrypt function.

Syntax

int addUNZIP_Register(LPCSTR lpszName, long lPassword)

Parameters

lpszName	the registered user name

lPassword	the provided registration number

Returns

This function returns a non-zero value on success. A return value of zero indicates that registration has failed. If this is the case, please make sure you entered the function parameters as specified in the registration pack.

Remarks

Example(s)


addUNZIP_RestoreAttributes

Allows the specified file attributes to be de-compressed along with the file.

Syntax

int addUNZIP_RestoreAttributes(int iAttributes)

Parameter

iAttributes	specifies the attributes to be restored. This can be any combination of  azATTR_READONLY, azATTR_HIDDEN, azATTR_SYSTEM and azATTR_ARCHIVE. For convenience there also flags to specify no attributes are restored (azATTR_NONE) and to restore all attributes (azATTR_ALL).

Returns

The return value represents the attributes that will be restored during the processing of addUNZIP (i.e. it should return the same value that was passed as a parameter).

Remarks

Example(s)


addUNZIP_RestoreStructure

This function recreates the directory structure stored in the .ZIP archive. The default is not to restore the directory structure.

Syntax

int addUNZIP_RestoreStructure(BOOL bFlag)

Parameters

bFlag	Set this value to TRUE to restore the stored directory structure.

Returns

This function returns a non-zero value if successful.

Remarks

Example(s)


addUNZIP_SetParentWindowHandle

This function is required so that any dialog boxes displayed by the addZIP Compression libraries are modal to the calling application.

Syntax

int addUNZIP_SetParentWindowHandle(HWND hwnd)

Parameters

hwnd	the handle of the parent application

Returns

These functions return a non-zero value on success. A return value of zero indicates that hwnd does not exist.

Remarks

Although not strictly required, you are advised to always include this function call in your application.

Example(s)


addUNZIP_SetWindowHandle

This function is required if you want feedback from addUNZIP(). The handle passed via this function must be the window handle (hwnd) of an edit/text box.

Syntax

int addUNZIP_SetWindowHandle(HWND hwnd)

Parameters

hwnd	the handle of the edit/text box used for passing messages

Returns

These functions return a non-zero value on success. A return value of zero indicates that the edit/text box does not exist.

Remarks

Example(s)


addUNZIP_Test

This function tests the integrity of a .ZIP archive.

Syntax

int addUNZIP_Test(BOOL bFlag)

Parameters

bFlag	Set this vale to TRUE to test the .ZIP archive.

Returns

This function returns the number of files contained in the archive.

Remarks

See the topic How do I check the integrity of a .ZIP archive?

Example(s)


addUNZIP_ToMemory

This function will allow the user to extract a file (or portion of a file) to memory.

Syntax

BOOL addUNZIP_ToMemory(LPSTR lpsz, long lLength)

Parameters

lpsz	the allocated buffer to hold the file contents

lLength	the length of the buffer

Returns

This function returns a non-zero version if the next call to addUNZIP will cause the file contents to be extracted to the buffer. A zero value indicates that an error has occured.

Remarks

The user will typically make a call to addUNZIP_Include to limit the extraction to one relevant file. If the uncompressed file is larger than the buffer, then the contents will be truncated at buffer length. The end of the file is indicated by the addition of a NULL (ascii value 0).

Example(s)


addUNZIP_Update

Allows an existing .ZIP archive to be used to update the files stored on the destination drive/directory - that is, only files either i) do not exist, or ii) that currently exist on the destination drive/directory and in the archive will be decompressed, and only if the current ones are older than the archive ones.

Syntax

int addUNZIP_Update(int iFlag)

Parameter

iFlag	set to TRUE if you want to update the drive/directory

Returns

The return value will be non-zero if the files will be updated on the next call to addUNZIP(). A value of zero indicates that addUNZIP() will process all files.

Remarks

Example(s)


addUNZIP_View

This function allows the developer to display the contents of a .ZIP archive. Please see How do I view the contents of an archive? for more information.

Syntax

int addUNZIP_View(BOOL bFlag)

Parameters

bFlag	set this value to true if you want to view the contents of the .ZIP archive.

Returns

This function returns a non-zero value on success.

Remarks

Example(s)


addINMEMORY Function Reference

addZIP_InMemory

addUNZIP_InMemory


addZIP_InMemory

This function allows the compression of a string in memory.

Syntax

long addZIP_InMemory(LPCSTR lpszOriginal, DWORD dwOriginal, LPSTR lpszComp, DWORD dwComp)

Parameters

lpszOriginal	character buffer to receive the original string

dwOriginal	the length of lpszOriginal

lpszComp	character buffer holding the compressed string

dwComp	the length of the compressed string

Returns

Remarks

The 16-bit version of the library is currently limited to a maximum string length of 64K - the 32-bit version does not have this limit.

Example(s)


addUNZIP_InMemory

This function allows the decompression of a string in memory.

Syntax

long addUNZIP_InMemory(LPCSTR lpszOriginal, DWORD dwOriginal, LPSTR lpszComp, DWORD dwComp)

Parameters

lpszOriginal	character buffer that holds the string to be compressed

dwOriginal	the length of string to be compressed

lpszComp	character buffer to receive the compressed string

dwComp	the number of characters in lpszComp

Returns

Remarks

The 16-bit version of the library is currently limited to a maximum string length of 64K - the 32-bit version does not have this limit.

Example(s)


Warnings and errors

All warnings and error codes will be passed as notification messages as defined under How do I get feedback from the addZIP libraries? I have tried to keep the codes the same as those generated by PKZIP/PKUNZIP - registered users of PKZIP should refer to the documentation provided with that excellent software if my descriptions are unclear. I have also provided GetLastError and GetLastWarning functions to enable the developer to retrieve feedback indirectly (please refer to the function definitions for more information).

addZIP() Errors

1	cannot create .ZIP archive

2	.ZIP archive is corrupted, or file is not a .ZIP archive

4	out of memory

5	internal error - please contact the author

12	no files found, nothing to do

13	cannot locate .ZIP archive or it is empty

14	the disk is full

15	the .ZIP archive is read-only, couldnt gain write access

16	illegal combination of function calls

17	too many files

18	couldnt open file, another user has it locked open

27	non-removable drive specified for disk-spanning

50	.ZIP archive left as

255	user aborted processing

addZIP() Warnings

2	cannot open specified file for compressing

3	cannot delete specified file - user does not have correct permissions

50	file left as specified/would be truncated if FIXED

addUNZIP() Errors

1,2,3	.ZIP archive is corrupted, or file is not a .ZIP archive

4	out of memory

9	cannot locate .ZIP archive or it is empty/cannot find list file

10	cannot open .ZIP archive

11	no files found, nothing to do

50	the disk is full

51	unexpected end of file

101	multi-disk archive (not supported)

255	user aborted processing

addUNZIP() Warnings

1,3	file has a bad table and cannot be extracted

4	.ZIP archive contains an error (needs PKZIPFIXing)

5	out of memory

8	cannot open .ZIP archive

9	cannot create file being extracted

10	invalid filename

11	unknown compression method

12	file is encrypted (and no password has been given)

13	file has an inconsistent local header

14	file is encrypted and incorrect password has been given

15	file has an incorrect CRC value

19	file is invalid and cannot be extracted

21,23	file has a bad table and cannot be extracted

24	a later version of extract software is required

25	file contains a comment that is too big - comment will be truncated

26	.ZIP archive has at least one error


License

Unregistered users should read the general and shareware licenses, registered users should read the general license and the relevant user license. By using the software, you indicate your agreement to the relevant license terms.

General license

The following apply to all users.

The addZIP Compression Libraries remain the property of the author at all times. By purchasing the software, you are purchasing a license to use the software not own it.

You may not reverse engineer, change or otherwise alter any part of the software (excluding the examples) without prior written permission from the author.

You may not produce and distribute in any way, a derived software product that may, directly or indirectly, compete with this software without prior written permission from the author.

This software is provided as-is, and no warranty of any kind (including, but not limited to, warranty for a particular purpose) is expressed or implied. The author will not be liable for any damage, data loss etc. caused by this program.

Shareware license

If you are not a registered user, the following apply to you in addition to the terms of the general license.

This is not free software. You may evaluate this software for a period of 30 days, after which you must register or delete the software from your hard disk. Use of this software beyond the 30 day evaluation period is expressly prohibited and violates national and international copyright law.

You must not distribute (free or otherwise) any software which uses the addZIP Compression Libraries without first registering this software.

Private user license

If you are registered for private use only, the following apply as additions to the general license.

The software is for your own personal use and may be used on one PC only.

You must not disclose, distribute or make known to any other user your registration number.

You may not distribute (free or otherwise) any software which uses the addZIP Compression Libraries without first upgrading to a Developer license.

You may upgrade to a developer/open license by paying for the difference between your current license and the developer/open license.

Developer/Open license

If you are registered for developer use, the following apply as additions to the general license.

You may use this software on one PC only (unless an open license has been purchased).

You must not disclose, distribute or make known to any other user your registration number.

You may distribute any software which uses the addZIP Compression Libraries as long as it does not contravene any part of this license.

You inform the author of any (commercial or otherwise) distributed software (if possible).

You may upgrade your developer license by paying the difference between your current license and the open license.


Registration

Registration brings the following benefits

a diskette with the latest version of the addZIP Compression Libraries (if requested and when available)

free upgrades to all later versions of the libraries

a registration number that allows files within an archive to be encrypted/decrypted with your own password

the right to distribute programs which make use of the addZIP Compression Libraries (developer and open licensees only)

There are three levels of registration (all prices are fully inclusive)

private user license. This is for the individual programmer who would like to use this software in his/her own programs but will not be distributing those same programs. The cost of this license is 30 UK pounds (50 US dollars).

developer license. This is for the individual programmer who will distribute programs that incorporate the addZIP libraries. The cost of this license is 50 UK pounds (80 US dollars).

open license. This is for companies where the addZIP libraries will be used by more than one programmer. There is no limit on the number of users. The cost of this license is 100 UK pounds (160 US dollars).

(N.B. To upgrade a license means only paying the difference between your current license and the new license required.)

The preferred method of registration is a sterling cheque drawn on a UK bank. Non-UK residents can obtain such a cheque (for a small charge) from any branch of Thomas Cook. Cheques should be made payable to Stephen Darlington and sent to the address in Contacting the author. (Please see the final paragraph)

Credit card registrations may be made through Public (software) Library (PsL). PsL accepts MC, Visa, Ames or Discover and can be contacted by

•	telephone on 800-242-4775 or 713-524-6394 and asking for extension 15056

•	fax on 713-524-6398, marking the number 15056 very clearly

•	email to 71355.470@compuserve.com, stating the number 15056 very clearly.

Please note the following

i) all numbers are US numbers,

ii) these number are for credit card orders only, the auther of this program cannot be contacted at these numbers,

iii) any questions about the status of the shipment of the order, refunds, registration options, product details, technical support, volume discounts, dealer pricing, site licenses, non-credit card orders, etc, must be directed to Stephen_Darlington@compuserve.com.

iv) there is a 10% surcharge for credit card orders to offset some of the extra charges

Compuserve members may register by going to the SWREG forum (GO SWREG), and entering one the number for the required license: 12138 (personal license), 12139 (developer license) or 12140 (open license). Please note tha there is a 10% surcharge for registering this way (to offset charges made by Compuserve).

Money may be sent through the post, but always send money via registered post. All denominations are accepted but please contact me first.

As a last resort, US (and other overseas) residents may wish to send a US dollar cheque (drawn on a US bank only) to Steve Fulton, 1540 First Street, Manhattan Beach, CA. 90266, USA. Please note that S.Fulton has no connection with the addZIP Compression Libraries, does not make any money from the libraries, and is acting as a US registration point as a personal favour to me. Also please do not contact S.Fulton with any enquiries before or after your registration.

When registering please provide the following information (where applicable); name, company, address, email address and registered user name. Your registration begins immediately, your registration number will be sent at a later date. (I am working hard on the next release of the libraries so there may be a short delay - please contact me if this is a problem). Irrespective of which registration method you use, please email me with your registered user name - failure to do so may delay the delivery of your registration code.


Distribution

You are actively encouraged to distribute this software amongst your friends and colleagues, upload it your favourite BBS, shareware library and ftp/WWW sites, and include it in diskette and CD-ROM software collections, provided the following conditions are met

you distribute the exact, unmodified archive

you do not charge for this software (apart from a modest handling fee when applicable)

you make it clear that this software is provided as shareware (on a try before you buy basis)

you inform the author of your actions

If you are unsure about this distribution policy, or wish to discuss any distribution channel not specifically mentioned, please feel free to contact the author.


Contacting the author

Please contact the author with your suggestions, bug reports etc. via one of the following contact points:

E-mail:	Stephen_Darlington@compuserve.com, or

sdarlington@bigfoot.com

Telephone: 	UK 0181-407-1684 (evening, answerphone during the day)

Address:	Stephen Darlington

50 Haydn Avenue

Purley

Surrey

CR8 4AE

United Kingdom


Acknowledgements

All product names mentioned in the addZIP Compression Libraries Help are trademarks or registered trademarks of their registered owners.

This software would not be where it is today without the help of far to many people to mention them all. However the following are given special thanks

PKWARE, Inc. - for producing PKZIP - the best example of why shareware works

Steve Fulton - for providing a US contact point (and for some ALARMing insights)

Greg DeBacker - for his helpful patience in solving some difficult bugs

Brad Clarke - for the Delphi translations of the sample programs

Info-ZIP - for producing the best 'internal documentation' of PKZIP and PKUNZIP. Although I have used very little code from the Info-ZIP libraries, I have borrowed many of their ideas, so I think it only fair to state the following

addZIP Compression Libraries incorporates compression code by the Info-ZIP group. There are no extra charges or costs due to the use of this code, and the original compression sources are freely available from CompuServe in the IBMPRO forum and by anonymous ftp from the Internet site ftp.uu.net:/pub/archiving/zip. I will also, upon request, mail you the full sources on a 3.5" MSDOS-format diskette for the cost of mailing.  Send 2 UK pounds to the address in Contacting the Author.


Questionnaire

I would be very grateful if you could email me the answers to the following questions

1) How did you find out about the libraries?

2) Where did you get this copy of the libraries?

3) What do like most about the libraries?

4) What do you dislike about the libraries?

5) What features would you like to see implemented in a future release?

6) What development environment are you using?

7) What platform are you developing on?


Release History

v0.61 - 16th June 1997

Corrected bug that appeared when running azip16.dll under Windows NT.

Added addZIP_GetVersion and addUNZIP_GetVersion (to be fully documented in version 0.7).

Corrected minor errors in help file.

v0.6 - 3rd June 1997

Included callback functionality.

Extended the filtering functions to include file attributes and last accessed date and time..

Added addZIP_Initialise and addUNZIP_Initialise functions.

Re-structured notification messages.


Coming Soon
The following are planned for future versions

self-extracting archives

OCX control

unzipping to a printer


Whats New?
Version 0.6 adds

callback functionality

more filtering options (based on attributes and date/time stamp)

improved notification messages (note that these are different to previous versions)

Now available

the addZIP homepage

http://ourworld.compuserve.com/homepages/Stephen_Darlington/addzip.htm

PsL registration


READ THIS NOW
The format of the notification messages provided by the libraries have changed as of version 0.6. This means that all programs that use the libraries will have to be modified slightly. See How to get feedback from the addZIP Compression Libraries? for information on the messages.

Also developers must now call the addZIP_Initialise and/or addUNZIP_Initialise function prior to calling other library functions. Failure to do so may result in unexpected behaviour.