Zip C Reference Documentation

Zip

Current Version: 9.5.0.75

Zip compression component.

Create/Dispose

HCkZip instance = CkZip_Create();
// ...
CkZip_Dispose(instance);
HCkZip CkZip_Create(void);

Creates an instance of the HCkZip object and returns a handle ("void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.

void CkZip_Dispose(HCkZip handle);

Objects created by calling CkZip_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkZip_Dispose.

Callback Functions

Callback Functions introduced in Chilkat v9.5.0.56
void CkZip_setAbortCheck(HCkZip cHandle, BOOL (*fnAbortCheck)(void));

Provides the opportunity for a method call to be aborted. If TRUE is returned, the operation in progress is aborted. Return FALSE to allow the current method call to continue. This callback function is called periodically based on the value of the HeartbeatMs property. (If HeartbeatMs is 0, then no callbacks are made.) As an example, to make 5 AbortCheck callbacks per second, set the HeartbeatMs property equal to 200.

void CkZip_setPercentDone(HCkZip cHandle, BOOL (*fnPercentDone)(int pctDone));

Provides the percentage completed for any method that involves network communications or time-consuming processing (assuming it is a method where a percentage completion can be measured). This callback is only called when it is possible to know a percentage completion, and when it makes sense to express the operation as a percentage completed. The pctDone argument will have a value from 1 to 100. For methods that complete very quickly, the number of PercentDone callbacks will vary, but the final callback should have a value of 100. For long running operations, no more than one callback per percentage point will occur (for example: 1, 2, 3, ... 98, 99, 100).

This callback counts as an AbortCheck callback, and takes the place of the AbortCheck event when it fires.

The return value indicates whether the method call should be aborted, or whether it should proceed. Return TRUE to abort, and FALSE to proceed.

void CkZip_setProgressInfo(HCkZip cHandle, void (*fnProgressInfo)(const char *name, const char *value));

This is a general callback that provides name/value information about what is happening at certain points during a method call. To see the information provided in ProgressInfo callbacks, if any, write code to handle this event and log the name/value pairs. Most are self-explanatory.

void CkZip_setTaskCompleted(HCkZip cHandle, void (*fnTaskCompleted)(HCkTask hTask));

Called in the background thread when an asynchronous task completes. (Note: When an async method is running, all callbacks are in the background thread.)

Properties

AbortCurrent
BOOL CkZip_getAbortCurrent(HCkZip cHandle);
void CkZip_putAbortCurrent(HCkZip cHandle, BOOL newVal);
Introduced in version 9.5.0.58

When set to TRUE, causes the currently running method to abort. Methods that always finish quickly (i.e.have no length file operations or network communications) are not affected. If no method is running, then this property is automatically reset to FALSE when the next method is called. When the abort occurs, this property is reset to FALSE. Both synchronous and asynchronous method calls can be aborted. (A synchronous method call could be aborted by setting this property from a separate thread.)

top
AppendFromDir
void CkZip_getAppendFromDir(HCkZip cHandle, HCkString retval);
void CkZip_putAppendFromDir(HCkZip cHandle, const char *newVal);
const char *CkZip_appendFromDir(HCkZip cHandle);

When files are added to a Zip archive, they are appended from this directory. For example, to add all the files under c:/abc/123/myAppDir, this property could be set to "c:/abc/123", and "myAppDir/*" would be passed to AppendFiles. The path that is saved in the .zip would be "myAppDir/". (The value of the AppendFromDir property does not become part of the file path saved in the .zip.)

More Information and Examples
top
AutoRun
void CkZip_getAutoRun(HCkZip cHandle, HCkString retval);
void CkZip_putAutoRun(HCkZip cHandle, const char *newVal);
const char *CkZip_autoRun(HCkZip cHandle);

(Relevant only when running on a Microsoft Windows operating system.) Optional when creating Windows-based self-extracting EXEs. This is the name of an executable contained within the to-be-created EXE that will automatically be run after extraction. (This is typically something like "setup.exe")

top
AutoRunParams
void CkZip_getAutoRunParams(HCkZip cHandle, HCkString retval);
void CkZip_putAutoRunParams(HCkZip cHandle, const char *newVal);
const char *CkZip_autoRunParams(HCkZip cHandle);

(Relevant only when running on a Microsoft Windows operating system.) Command line parameters that get passed to the AutoRun executable.

top
AutoTemp
BOOL CkZip_getAutoTemp(HCkZip cHandle);
void CkZip_putAutoTemp(HCkZip cHandle, BOOL newVal);

(Relevant only when running on a Microsoft Windows operating system.) This option applies to creating Windows-based self-extracting EXEs. If TRUE, the to-be-created EXE will automatically select and create a temporary directory for unzipping. This property is often used in conjunction with the AutoRun property to create a self-extracting EXE that automatically unzips to a temp directory and runs a setup.exe without interaction with the user.

Note: To create a self-extracting EXE with no user-interaction, set the following properties to these values:

ExeSilentProgress = FALSE
ExeNoInterface = TRUE
ExeFinishNotifier = FALSE

The default AutoTemp value is FALSE.

top
CaseSensitive
BOOL CkZip_getCaseSensitive(HCkZip cHandle);
void CkZip_putCaseSensitive(HCkZip cHandle, BOOL newVal);

If TRUE then all methods that get or search for zip entries by name will use case-sensitive filename matching. If FALSE then filename matching will be case insensitive. Methods affected by this property include GetEntryByName, UnzipMatching, FirstMatchingEntry, etc.

The default value is FALSE.

top
ClearArchiveAttribute
BOOL CkZip_getClearArchiveAttribute(HCkZip cHandle);
void CkZip_putClearArchiveAttribute(HCkZip cHandle, BOOL newVal);

Set this to TRUE to clear the FILE_ATTRIBUTE_ARCHIVE file attribute of each file during a zipping operation.

The default value is FALSE.

top
ClearReadOnlyAttr
BOOL CkZip_getClearReadOnlyAttr(HCkZip cHandle);
void CkZip_putClearReadOnlyAttr(HCkZip cHandle, BOOL newVal);

If TRUE, the read-only attribute is automatically cleared when unzipping. The default value of this property is FALSE, which leaves the read-only attribute unchanged when unzipping.

top
Comment
void CkZip_getComment(HCkZip cHandle, HCkString retval);
void CkZip_putComment(HCkZip cHandle, const char *newVal);
const char *CkZip_comment(HCkZip cHandle);

The global Zip file comment.

top
DebugLogFilePath
void CkZip_getDebugLogFilePath(HCkZip cHandle, HCkString retval);
void CkZip_putDebugLogFilePath(HCkZip cHandle, const char *newVal);
const char *CkZip_debugLogFilePath(HCkZip cHandle);

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

top
DecryptPassword
void CkZip_getDecryptPassword(HCkZip cHandle, HCkString retval);
void CkZip_putDecryptPassword(HCkZip cHandle, const char *newVal);
const char *CkZip_decryptPassword(HCkZip cHandle);

When opening a password-protected or AES encrypted Zip, this is the password to be used for decryption. Encrypted Zips may be opened without setting a password, but the contents cannot be unzipped without setting this password.

Note:The SetPassword method has the effect of setting both this property as well as the EncryptPassword property. The SetPassword method should no longer be used. It has been replaced by the DecryptPassword and EncryptPassword properties to make it possible to open an encrypted zip and re-write it with a new password.

top
DiscardPaths
BOOL CkZip_getDiscardPaths(HCkZip cHandle);
void CkZip_putDiscardPaths(HCkZip cHandle, BOOL newVal);

If TRUE, discards all file path information when zipping. The default value is FALSE.

top
Encryption
int CkZip_getEncryption(HCkZip cHandle);
void CkZip_putEncryption(HCkZip cHandle, int newVal);

Indicate whether the Zip is to be strong encrypted or not. Valid values are 0 (not encrypted) or 4 (AES encrypted). When this property is set to the value 4, WinZip AES compatible encrypted zip archives are produced.

Note: Prior to Chilkat v9.4.1, other possible values for this property were: 1 (blowfish), 2 (twofish), and 3 (rijndael). These settings originally provided a way to produce strong encrypted zips prior to when the AES encrypted Zip standard existed. Using these legacy values (1, 2, or 3) produced encrypted zips that only applications using Chilkat could read. Chilkat no longer supports these custom modes of encryption. If using an older version of Chilkat with one of these deprecated encryption modes, make sure to decrypt using the old Chilkat version and re-encrypt using mode 4 (WinZip compatible AES encryption) prior to updating to the new Chilkat version.

Important:The Encryption and PasswordProtect properties are mutually exclusive. PasswordProtect corresponds to the older Zip 2.0 encryption, commonly referred to as a "password-protected" zip. If the PasswordProtect is set to TRUE, the Encryption property should be set to 0. If the Encryption property is set to a non-zero value, then PasswordProtect should be set to FALSE. A zip cannot be both password-protected and strong-encrypted.

top
EncryptKeyLength
int CkZip_getEncryptKeyLength(HCkZip cHandle);
void CkZip_putEncryptKeyLength(HCkZip cHandle, int newVal);

The encryption key length if AES, Blowfish, Twofish, or WinZip-compatible AES encryption is used. This value must be 128, 192, or 256. The default value is 128.

top
EncryptPassword
void CkZip_getEncryptPassword(HCkZip cHandle, HCkString retval);
void CkZip_putEncryptPassword(HCkZip cHandle, const char *newVal);
const char *CkZip_encryptPassword(HCkZip cHandle);

The password used when writing a password-protected or strong-encrytped Zip.

Note:The SetPassword method has the effect of setting both this property as well as the DecryptPassword property. The SetPassword method should no longer be used. It has been replaced by the DecryptPassword and EncryptPassword properties to make it possible to open an encrypted zip and re-write it with a new password.

top
ExeDefaultDir
void CkZip_getExeDefaultDir(HCkZip cHandle, HCkString retval);
void CkZip_putExeDefaultDir(HCkZip cHandle, const char *newVal);
const char *CkZip_exeDefaultDir(HCkZip cHandle);

(Relevant only when running on a Microsoft Windows operating system.) Specifies the default unzip directory path to appear in the user-interface dialog box when the Windows-based self-extracting EXE is run.

top
ExeFinishNotifier
BOOL CkZip_getExeFinishNotifier(HCkZip cHandle);
void CkZip_putExeFinishNotifier(HCkZip cHandle, BOOL newVal);

(Relevant only when running on a Microsoft Windows operating system.) If set to TRUE, a "Finished" dialog box is displayed when the self-extracting EXE is finished extracting. The caption, title, and button text of the finish notifier dialog may be customized by calling SetExeConfigParam. The default value is FALSE.

top
ExeIconFile
void CkZip_getExeIconFile(HCkZip cHandle, HCkString retval);
void CkZip_putExeIconFile(HCkZip cHandle, const char *newVal);
const char *CkZip_exeIconFile(HCkZip cHandle);

(Relevant only when running on a Microsoft Windows operating system.) Applies to creating self-extracting EXEs. This property can be set to a pre-existing icon filename (.ico) that will be embedded within the to-be-created EXE and set as its default icon.

Note: This property is only possible for 32-bit applications. (Meaning that the application that is creating the self-extracting EXE must be a 32-bit application if an ExeIconFile is to be used.)

top
ExeNoInterface
BOOL CkZip_getExeNoInterface(HCkZip cHandle);
void CkZip_putExeNoInterface(HCkZip cHandle, BOOL newVal);

(Relevant only when running on a Microsoft Windows operating system.) Applies to creating Windows-based self-extracting EXEs. When set to TRUE, the to-be-created EXE will run without a user-interface. The default value is FALSE.

Note: The ExeSilentProgress property needs to be set to TRUE for the extract to be truly silent.

Important: If the AutoTemp property = TRUE and there is no AutoRun EXE, and there is no ExeUnzipDir set, then the self-extracting EXE will always display a dialog to get the unzip directory. The reason is that it makes no sense to silently unzip to an auto-selected (and unknown) temp directory without anything happening afterwards.

Important: If the self-extracting EXE is encrypted, a password dialog will be displayed. The password dialog may be suppressed if the password is provided on the command line via the -pwd command-line option.

top
ExeSilentProgress
BOOL CkZip_getExeSilentProgress(HCkZip cHandle);
void CkZip_putExeSilentProgress(HCkZip cHandle, BOOL newVal);

(Relevant only when running on a Microsoft Windows operating system.) Determines whether a progress dialog is displayed when the self-extracting EXE is run. If ExeNoInterface = FALSE (i.e. there is a main dialog with the ability to select the unzip directory), then the progress dialog is (by default) shown as a progress bar within the main dialog -- and this property has no effect. If ExeNoInterface = TRUE, then a progress-only dialog is displayed if ExeSilentProgress = FALSE. The default value of ExeSilentProgress is TRUE.

top
ExeTitle
void CkZip_getExeTitle(HCkZip cHandle, HCkString retval);
void CkZip_putExeTitle(HCkZip cHandle, const char *newVal);
const char *CkZip_exeTitle(HCkZip cHandle);

(Relevant only when running on a Microsoft Windows operating system.) Applies to creating Windows-based self-extracting EXEs. Sets the title of the main user-interface dialog that appears when the self-extracting EXE runs.

top
ExeUnzipCaption
void CkZip_getExeUnzipCaption(HCkZip cHandle, HCkString retval);
void CkZip_putExeUnzipCaption(HCkZip cHandle, const char *newVal);
const char *CkZip_exeUnzipCaption(HCkZip cHandle);

(Relevant only when running on a Microsoft Windows operating system.) Applies to creating MS Windows-based self-extracting EXEs. Sets the unzipping caption of the main user-interface dialog that appears when the self-extracting EXE runs.

top
ExeUnzipDir
void CkZip_getExeUnzipDir(HCkZip cHandle, HCkString retval);
void CkZip_putExeUnzipDir(HCkZip cHandle, const char *newVal);
const char *CkZip_exeUnzipDir(HCkZip cHandle);

(Relevant only when running on a Microsoft Windows operating system.) Applies to creating MS Windows self-extracting EXEs. Stores a pre-defined unzip directory within the self-extracting EXE so that it automatically unzips to this directory without user-intervention.

Environment variables may be included if surrounded by percent characters. For example: %TEMP%. Environment variables are expanded (i.e. resolved) when the self-extracting EXE runs.

Note: To create a self-extracting EXE with no user-interaction, set the following properties to these values:

ExeSilentProgress = FALSE
ExeNoInterface = TRUE
ExeFinishNotifier = FALSE

top
ExeWaitForSetup
BOOL CkZip_getExeWaitForSetup(HCkZip cHandle);
void CkZip_putExeWaitForSetup(HCkZip cHandle, BOOL newVal);

(Relevant only when running on a Microsoft Windows operating system.) If TRUE, the self-extracting EXE will wait for the AutoRun EXE to complete before it exits. If FALSE, the self-extracting EXE dialog (or process if running silently with no user-interface), is allowed to exit prior to the completion of the AutoRun EXE. The default value is TRUE.

top
ExeXmlConfig
void CkZip_getExeXmlConfig(HCkZip cHandle, HCkString retval);
void CkZip_putExeXmlConfig(HCkZip cHandle, const char *newVal);
const char *CkZip_exeXmlConfig(HCkZip cHandle);

(Relevant only when running on a Microsoft Windows operating system.) Allows for an XML config document to be used to specify all possible options for self-extracting EXEs. This property is a string containing the XML config document.

The XML should have this format:

<SfxConfig>
	<ErrPwdTitle>Title for incorrect password dialog</ErrPwdTitle>
	<ErrPwdCaption>Caption for incorrect password dialog</ErrPwdCaption>
	<FinOkBtn>Text on finish notifier button</FinOkBtn>
	<PwdOkBtn>Text on password challenge dialog's "OK" button.</PwdOkBtn>
	<PwdCancelBtn>Text on password challenge dialog's Cancel button.</PwdCancelBtn>
	<ErrInvalidPassword>Incorrect password error message.</ErrInvalidPassword>
	<MainUnzipBtn>Text on main dialog's unzip button</MainUnzipBtn>
	<MainCloseBtn>Text on main dialog's quit/exit button</MainCloseBtn>
	<MainBrowseBtn>Text on main dialog's browse-for-directory button.</MainBrowseBtn>
	<MainUnzipLabel>Caption displayed in main dialog.</MainUnzipLabel>
	<AutoTemp>"1|0 (Maps to the AutoTemp property)"</AutoTemp>
	<Cleanup>"1|0 (Deletes extracted files after the SetupExe is run.)"</Cleanup>
	<Debug>"1|0  (If 1, the EXE will not extract any files.)"</Debug>
	<Verbose>"1|0 (If 1, then verbose information is sent to the log.)"</Verbose>
	<ShowFin>"1|0" Maps to ExeFinishNotifier property.</ShowFin>
	<ShowMain>"1|0" Maps to ExeNoInterface property.</ShowMain>
	<ShowProgress>"1|0" Maps to ExeSilentProgress property.</ShowProgress>
	<WaitForSetup>"1|0" Maps to ExeWaitForSetup property.</WaitForSetup>
	<Encryption>"1|0"  1=Yes, 0=No</Encryption>
	<KeyLength>128|192|256</KeyLength>
	<SetupExe>EXE to run after extracting. (Maps to AutoRun property)</SetupExe>
	<UnzipDir>Pre-defined unzip directory. (Maps to ExeUnzipDir property)>
	<DefaultDir>Default unzip directory to appear in the main dialog. 
                                                (Maps to ExeDefaultDir property)</DefaultDir>
	<IconFile>Icon file to be used (Maps to ExeIconFile property)</IconFile>
	<Url>Maps to ExeSourceUrl property.</Url>
	<MainTitle>Maps to ExeTitle property.</MainTitle>
	<MainCaption>Maps to ExeUnzipCaption property.</MainCaption>
	<FinTitle>Title for the finish notifier dialog.</FinTitle>
	<FinCaption>Caption for the finish notifier dialog.</FinTitle>
	<ProgressTitle>Title for the progress dialog.</ProgressTitle>
	<ProgressCaption>Caption for the progress dialog.</ProgressCaption>
	<PwTitle>Title for the password challenge dialog.</PwTitle>
	<PwCaption>Caption for the password challenge dialog.</PwCaption>
</SfxConfig>

A self-extracting EXE can be run from the command line with the "-log {logFilePath}" option to create a log with information for debugging.

top
FileCount
int CkZip_getFileCount(HCkZip cHandle);

The number of files (excluding directories) contained within the Zip.

top
FileName
void CkZip_getFileName(HCkZip cHandle, HCkString retval);
void CkZip_putFileName(HCkZip cHandle, const char *newVal);
const char *CkZip_fileName(HCkZip cHandle);

The path (absolute or relative) of the Zip archive. This is the path of the file that is created or overwritten when the zip is saved.

top
HasZipFormatErrors
BOOL CkZip_getHasZipFormatErrors(HCkZip cHandle);

TRUE if the opened zip contained file format errors (that were not severe enough to prevent the zip from being opened and parsed).

top
HeartbeatMs
int CkZip_getHeartbeatMs(HCkZip cHandle);
void CkZip_putHeartbeatMs(HCkZip cHandle, int newVal);

The number of milliseconds between each AbortCheck event callback. The AbortCheck callback allows an application to abort any method call prior to completion. If HeartbeatMs is 0 (the default), no AbortCheck event callbacks will fire.

top
IgnoreAccessDenied
BOOL CkZip_getIgnoreAccessDenied(HCkZip cHandle);
void CkZip_putIgnoreAccessDenied(HCkZip cHandle, BOOL newVal);

If TRUE, then files that cannot be read due to "access denied" (i.e. a file permission error) will be ignored and the call to WriteZip, WriteZipAndClose, WriteExe, etc. will return a success status. If FALSE, then the "access denied" filesystem errors are not ignored and any occurrence will cause the zip writing to fail. The default value is TRUE.

top
LastErrorHtml
void CkZip_getLastErrorHtml(HCkZip cHandle, HCkString retval);
const char *CkZip_lastErrorHtml(HCkZip cHandle);

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorText
void CkZip_getLastErrorText(HCkZip cHandle, HCkString retval);
const char *CkZip_lastErrorText(HCkZip cHandle);

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorXml
void CkZip_getLastErrorXml(HCkZip cHandle, HCkString retval);
const char *CkZip_lastErrorXml(HCkZip cHandle);

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastMethodSuccess
BOOL CkZip_getLastMethodSuccess(HCkZip cHandle);
void CkZip_putLastMethodSuccess(HCkZip cHandle, BOOL newVal);
Introduced in version 9.5.0.52

Indicate whether the last method call succeeded or failed. A value of TRUE indicates success, a value of FALSE indicates failure. This property is automatically set for method calls. It is not modified by property accesses. The property is automatically set to indicate success for the following types of method calls:

  • Any method that returns a string.
  • Any method returning a Chilkat object, binary bytes, or a date/time.
  • Any method returning a standard boolean status value where success = TRUE and failure = FALSE.
  • Any method returning an integer where failure is defined by a return value less than zero.

Note: Methods that do not fit the above requirements will always set this property equal to TRUE. For example, a method that returns no value (such as a "void" in C++) will technically always succeed.

top
NumEntries
int CkZip_getNumEntries(HCkZip cHandle);

The number of entries in the Zip, including both files and directories.

top
OemCodePage
int CkZip_getOemCodePage(HCkZip cHandle);
void CkZip_putOemCodePage(HCkZip cHandle, int newVal);

Sets the OEM code page to be used for Unicode filenames. This property defaults to the OEM code page of the computer.

top
OverwriteExisting
BOOL CkZip_getOverwriteExisting(HCkZip cHandle);
void CkZip_putOverwriteExisting(HCkZip cHandle, BOOL newVal);

Determines whether existing files are overwritten during unzipping. The default is TRUE, which means that already-existing files will be overwritten. Set this property = FALSE to prevent existing files from being overwritten when unzipping.

top
PasswordProtect
BOOL CkZip_getPasswordProtect(HCkZip cHandle);
void CkZip_putPasswordProtect(HCkZip cHandle, BOOL newVal);

TRUE if the Zip should be password-protected using older Zip 2.0 encryption, commonly referred to as "password-protection".

This property is set when a zip archive is opened by any of the Open* methods, such as OpenZip, OpenFromMemory, etc.

top
PathPrefix
void CkZip_getPathPrefix(HCkZip cHandle, HCkString retval);
void CkZip_putPathPrefix(HCkZip cHandle, const char *newVal);
const char *CkZip_pathPrefix(HCkZip cHandle);

A prefix that is added to each filename when zipping. One might set the PathPrefix to "subdir/" so that files are unzipped to a specified subdirectory when unzipping.

top
PercentDoneScale
int CkZip_getPercentDoneScale(HCkZip cHandle);
void CkZip_putPercentDoneScale(HCkZip cHandle, int newVal);
Introduced in version 9.5.0.49

This property is only valid in programming environment and languages that allow for event callbacks.

Sets the value to be defined as 100% complete for the purpose of PercentDone event callbacks. The defaut value of 100 means that at most 100 event PercentDone callbacks will occur in a method that (1) is event enabled and (2) is such that it is possible to measure progress as a percentage completed. This property may be set to larger numbers to get more fine-grained PercentDone callbacks. For example, setting this property equal to 1000 will provide callbacks with .1 percent granularity. For example, a value of 453 would indicate 45.3% competed. This property is clamped to a minimum value of 10, and a maximum value of 100000.

top
PwdProtCharset
void CkZip_getPwdProtCharset(HCkZip cHandle, HCkString retval);
void CkZip_putPwdProtCharset(HCkZip cHandle, const char *newVal);
const char *CkZip_pwdProtCharset(HCkZip cHandle);
Introduced in version 9.5.0.73

For older password-protected Zip archives (Zip 2.0 encryption), specifies the charset used for the binary representation of the decrypt password. The default value is "ansi". Other possible choices are cp850, cp437, or any of the code pages listed at the link below.

top
TempDir
void CkZip_getTempDir(HCkZip cHandle, HCkString retval);
void CkZip_putTempDir(HCkZip cHandle, const char *newVal);
const char *CkZip_tempDir(HCkZip cHandle);

The temporary directory to use when unzipping files. When running in ASP or ASP.NET, the default value of TempDir is set to the directory where the .zip is being written. Set this property to override the default.

top
TextFlag
BOOL CkZip_getTextFlag(HCkZip cHandle);
void CkZip_putTextFlag(HCkZip cHandle, BOOL newVal);

If set to TRUE, the component will set the "text flag" for each file having these filename extensions: .txt, .xml, .htm, and .html. It will also preserve the "text flag" for existing zips that are opened and rewritten. By default, this property is set to FALSE.

It is generally not necessary to set the text flag for a zip entry.

top
Utf8
BOOL CkZip_getUtf8(HCkZip cHandle);
void CkZip_putUtf8(HCkZip cHandle, BOOL newVal);

When set to TRUE, all "const char *" arguments are interpreted as utf-8 strings. If set to FALSE (the default), then "const char *" arguments are interpreted as ANSI strings. Also, when set to TRUE, and Chilkat method returning a "const char *" is returning the utf-8 representation. If set to FALSE, all "const char *" return values are ANSI strings.

top
VerboseLogging
BOOL CkZip_getVerboseLogging(HCkZip cHandle);
void CkZip_putVerboseLogging(HCkZip cHandle, BOOL newVal);

If set to TRUE, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is FALSE. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
void CkZip_getVersion(HCkZip cHandle, HCkString retval);
const char *CkZip_version(HCkZip cHandle);

Version of the component/library, such as "9.5.0.63"

top
Zipx
BOOL CkZip_getZipx(HCkZip cHandle);
void CkZip_putZipx(HCkZip cHandle, BOOL newVal);

Starting in v9.4.1, Chilkat Zip will automatically unzip ZIPX files using any of the following compression methods: BZIP2, PPMd, LZMA, and Deflate64 ("Deflate64" is a trademark of PKWare, Inc.)

This property, however, controls whether or not a ZipX is automatically produced where the best compression algorithm for each file is automatically chosen based on file type. This property is for writing zip archives. It does not apply to when unzipping ZIPX archives, Chilkat Zip automatically handles the various compression algorithms when unzipping.

top
ZipxDefaultAlg
void CkZip_getZipxDefaultAlg(HCkZip cHandle, HCkString retval);
void CkZip_putZipxDefaultAlg(HCkZip cHandle, const char *newVal);
const char *CkZip_zipxDefaultAlg(HCkZip cHandle);

The default compression algorithm to be used when creating ZIPX archives. The default value is "deflate". Other possible values are "ppmd", "lzma", "bzip2" and "deflate64". When writing a ZIPX archive, if the file extension does not indicate an obvious choice for the appropriate compression algorithm, then the ZipxDefaultAlg is used.

top

Methods

AddEmbedded
BOOL CkZip_AddEmbedded(HCkZip cHandle, const char *exeFilename, const char *resourceName, const char *zipFilename);

(Relevant only when running on a Microsoft Windows operating system.) Embeds a Zip file into an EXE as a custom resource. This resource can be opened by the EXE containing it at runtime by using the OpenMyEmbedded method.

Important: In Visual Studio 2010, the linker has a property "Randomized Base Address" (Project Properties/Linker) that defaults to "YES", but the default is "NO" in Visual Studio 2008. (The property is nonexistent in Visual Studio 2005 and earlier.) This enables ASLR ( Address Space Layout Randomization) in Vista and up, and prevents the proper code injection in the executable address space. To successfully embed a .zip as a resource within an EXE, this Visual Studio property must be set to "NO".

Returns TRUE for success, FALSE for failure.

top
AddNoCompressExtension
void CkZip_AddNoCompressExtension(HCkZip cHandle, const char *fileExtension);

Attempting to compress already-compressed data is usually a waste of CPU cycles with little or no benefit. In fact, it is possible that attempting to compress already-compressed data results in a slightly increased size. The Zip file format allows for files to be "stored" rather than compressed. This allows the file data to be streamed directly into a .zip without compression.

An instance of the Zip object has an internal list of "no compress" extensions. A filename with a "no compress" extension is "stored" rather than compressed. Additional "no compress" extensions may be added by calling this method (once per file extension). You should pass the file extension, such as ".xyz" in fileExtension.

"no compress" extensions may be removed by calling RemoveNoCompressExtension.

The default "no compress" extensions are: .zip, .gif, .jpg, .gz, .rar, .jar, .tgz, .bz2, .z, .rpm, .msi, .png

top
AppendBase64
HCkZipEntry CkZip_AppendBase64(HCkZip cHandle, const char *fileName, const char *encodedCompressedData);

Creates a new Zip entry and initializes it with already-compressed data that is Base64 encoded. (The ZipEntry.CopyBase64 method can be used to retrieve the compressed data in Base64 format.)

Note 1: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Note 2: It is assumed that the compressed data is unencrypted deflated data. (Meaning data compressed using the "deflate" compression algorithm.)

Returns NULL on failure

top
AppendBd
HCkZipEntry CkZip_AppendBd(HCkZip cHandle, const char *pathInZip, HCkBinData byteData);
Introduced in version 9.5.0.70

Appends the contents of byteData as a new entry to this zip object. The zip entry object containing the data is returned.

Returns NULL on failure

top
AppendCompressed
HCkZipEntry CkZip_AppendCompressed(HCkZip cHandle, const char *filename, HCkByteData inData);

Append memory data that is already Zip-compressed to the Zip object. The ZipEntry object containing the compressed data is returned. Note: This method appends the compressed data for a single zip entry. To load an entire in-memory .zip, call OpenFromMemory instead.

Note 1: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Note 2: It is assumed that the compressed data is unencrypted deflated data. (Meaning data compressed using the "deflate" compression algorithm.)

Returns NULL on failure

top
AppendData
HCkZipEntry CkZip_AppendData(HCkZip cHandle, const char *fileName, HCkByteData inData);

Appends in-memory data as a new entry to a Zip object. The ZipEntry object containing the data is returned.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns NULL on failure

More Information and Examples
top
AppendDataEncoded
HCkZipEntry CkZip_AppendDataEncoded(HCkZip cHandle, const char *filename, const char *encoding, const char *data);
Introduced in version 9.5.0.59

Appends in-memory data as a new entry to a Zip object. The filename is the filename of the entry as it will appear within the zip. The encoding is the encoding of the data, such as "base64", "hex", etc. The full list of encodings is listed at the web page linked below.

Returns the zip entry object.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns NULL on failure

More Information and Examples
top
AppendFiles
BOOL CkZip_AppendFiles(HCkZip cHandle, const char *filePattern, BOOL recurse);

Appends one or more files to the Zip object. The filePattern can use the "*" wildcard character for 0 or more of any characterSet recurse equal to True to recursively add all subdirectories, or False to only add files in the current directory.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
AppendFilesAsync (1)
HCkTask CkZip_AppendFilesAsync(HCkZip cHandle, const char *filePattern, BOOL recurse);

Creates an asynchronous task to call the AppendFiles method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
AppendFilesEx
BOOL CkZip_AppendFilesEx(HCkZip cHandle, const char *filePattern, BOOL recurse, BOOL saveExtraPath, BOOL archiveOnly, BOOL includeHidden, BOOL includeSystem);

Appends one or more files to the Zip object. The filePattern can use the "*" and "?" wildcard characters where "*" means 0 or more of any character and "?" means any single character. The recurse controls whether directories are recursively traversed. Set recurse equal to TRUE to append files and subdirectories in the directory tree. Set recurse equal to FALSE to add files only from the indicated directory.

The saveExtraPath only applies when the filePattern is an absolute path pattern, such as "C:/temp/abc/*.txt". If saveExtraPath is TRUE, then the absolute path will be included in the zip entry filenames as relative paths. For example, "temp/abc/xyz.txt".

The archiveOnly, includeHidden, and includeSystem flags only apply when on the Windows operating system. If archiveOnly is TRUE, then only files that have the archive bit set will be included in the zip. If includeHidden is FALSE, then hidden files are not included. If includeSystem is FALSE, then files having the System attribute are not included.

Note: This method does not write the zip archive. It simply adds references to the files that will be included in the .zip when the WriteZip or WriteZipAndClose methods are eventually called. Files and/or data may be added to the zip object by calling any combination of the Append* methods before finally writing the zip via one of the Write* methods.

Returns TRUE for success, FALSE for failure.

top
AppendFilesExAsync (1)
HCkTask CkZip_AppendFilesExAsync(HCkZip cHandle, const char *filePattern, BOOL recurse, BOOL saveExtraPath, BOOL archiveOnly, BOOL includeHidden, BOOL includeSystem);

Creates an asynchronous task to call the AppendFilesEx method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
AppendHex
HCkZipEntry CkZip_AppendHex(HCkZip cHandle, const char *fileName, const char *encodedCompressedData);

Creates a new Zip entry and initializes it with already-compressed data that is hexidecimal encoded. (The ZipEntry.CopyHex method can be used to retrieve the compressed data in Hex format.)

Note 1: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Note 2: It is assumed that the compressed data is unencrypted deflated data. (Meaning data compressed using the "deflate" compression algorithm.)

Returns NULL on failure

top
AppendMultiple
BOOL CkZip_AppendMultiple(HCkZip cHandle, HCkStringArray fileSpecs, BOOL recurse);

This method is the same as calling AppendFiles multiple times - once for each file pattern in fileSpecs

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns TRUE for success, FALSE for failure.

top
AppendMultipleAsync (1)
HCkTask CkZip_AppendMultipleAsync(HCkZip cHandle, HCkStringArray fileSpecs, BOOL recurse);

Creates an asynchronous task to call the AppendMultiple method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
AppendNew
HCkZipEntry CkZip_AppendNew(HCkZip cHandle, const char *fileName);

Appends a new and empty entry to the Zip object and returns the ZipEntry object. Data can be appended to the entry by calling ZipEntry.AppendData.

Important: To append an already-existing file, call the AppendOneFileOrDir method. The AppendNew method inserts a new and empty file entry within the Zip object. The purpose of AppendNew is to either create an empty file within the Zip, or to create a new file entry which can then be filled with data by calling the entry's AppendData method.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns NULL on failure

top
AppendNewDir
HCkZipEntry CkZip_AppendNewDir(HCkZip cHandle, const char *dirName);

Adds an entry to the zip so that when it unzips, a new directory (with no files) is created. The directory does not need to exist on the local filesystem when calling this method. The dirName is simply a string that is used as the directory path for the entry added to the zip. The zip entry object is returned.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns NULL on failure

top
AppendOneFileOrDir
BOOL CkZip_AppendOneFileOrDir(HCkZip cHandle, const char *fileOrDirPath, BOOL saveExtraPath);

Appends a single file or directory to the Zip object. The saveExtraPath applies when fileOrDirPath is an absolute (non-relative) path. If saveExtraPath is TRUE, then the absolute path is made relative and saved in the zip. For example, if the fileOrDirPath is "C:/temp/xyz/test.txt" and saveExtraPath is TRUE, then the path in the zip will be "./temp/xyz/test.txt". If however, fileOrDirPath contains a relative path, then saveExtraPath has no effect.

Returns TRUE for success, FALSE for failure.

top
AppendOneFileOrDirAsync (1)
HCkTask CkZip_AppendOneFileOrDirAsync(HCkZip cHandle, const char *fileOrDirPath, BOOL saveExtraPath);

Creates an asynchronous task to call the AppendOneFileOrDir method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
AppendString
HCkZipEntry CkZip_AppendString(HCkZip cHandle, const char *internalZipFilepath, const char *textData);

Adds an in-memory string to the Zip object. The textData argument is converted to the ANSI charset before being added to the Zip. If the Zip were written to disk by calling WriteZip, and later unzipped, the entry would unzip to an ANSI text file.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns NULL on failure

top
AppendString2
HCkZipEntry CkZip_AppendString2(HCkZip cHandle, const char *internalZipFilepath, const char *textData, const char *charset);

Same as AppendString, but allows the charset to be specified. The textData is converted to charset before being added to the zip. The internalZipFilepath is the path of the file that will be stored within the zip.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns NULL on failure

More Information and Examples
top
AppendZip
BOOL CkZip_AppendZip(HCkZip cHandle, const char *zipFileName);

Adds the contents of another existing Zip file to this Zip object.

Returns TRUE for success, FALSE for failure.

top
CloseZip
void CkZip_CloseZip(HCkZip cHandle);

Closes an open Zip file. This is identical to calling NewZip. (NewZip closes the current Zip file, if open, and initializes the Zip object to be empty. Zip files are only created when WriteZip is called.)

top
DeleteEntry
BOOL CkZip_DeleteEntry(HCkZip cHandle, HCkZipEntry entry);

Removes a Zip entry from the calling Zip object.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
ExcludeDir
void CkZip_ExcludeDir(HCkZip cHandle, const char *dirName);

Adds a directory name to be excluded when AppendFiles is called to add an entire directory tree. All directories having a name equal to an excluded directory will not be included when AppendFiles (or AppendFileEx) is called. Multiple directories can be excluded by calling ExcludeDir multiple times. The name comparison is case-insensitive.

top
Extract
BOOL CkZip_Extract(HCkZip cHandle, const char *dirPath);

Unzip all the files into the specified directory. Subdirectories are automatically created as needed.

Returns TRUE for success, FALSE for failure.

top
ExtractAsync (1)
HCkTask CkZip_ExtractAsync(HCkZip cHandle, const char *dirPath);

Creates an asynchronous task to call the Extract method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
ExtractExe
BOOL CkZip_ExtractExe(HCkZip cHandle, const char *exePath, const char *dirPath);
Introduced in version 9.5.0.44

Extracts files from a Chilkat produced self-extracting EXE into the specified directory. Subdirectories are automatically created as needed. If the self-extracting EXE is encrypted, be sure to set the DecryptPassword property prior to calling this method.

Returns TRUE for success, FALSE for failure.

top
ExtractExeAsync (1)
HCkTask CkZip_ExtractExeAsync(HCkZip cHandle, const char *exePath, const char *dirPath);
Introduced in version 9.5.0.44

Creates an asynchronous task to call the ExtractExe method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
ExtractInto
BOOL CkZip_ExtractInto(HCkZip cHandle, const char *dirPath);

Unzips all the files in a Zip into a single directory regardless of the path stored in the Zip

Returns TRUE for success, FALSE for failure.

top
ExtractMatching
BOOL CkZip_ExtractMatching(HCkZip cHandle, const char *dirPath, const char *pattern);

Unzip all files matching a wildcard pattern.

Returns TRUE for success, FALSE for failure.

top
ExtractNewer
BOOL CkZip_ExtractNewer(HCkZip cHandle, const char *dirPath);

Extracts only the files that have more recent last-modified-times than the files on disk. This allows you to easily refresh only the files that have been updated.

Returns TRUE for success, FALSE for failure.

top
FirstEntry
HCkZipEntry CkZip_FirstEntry(HCkZip cHandle);

Return the first entry in the Zip. Call ZipEntry.NextEntry to iterate over the entries in a Zip until a NULL is returned.

Returns NULL on failure

top
FirstMatchingEntry
HCkZipEntry CkZip_FirstMatchingEntry(HCkZip cHandle, const char *pattern);

Returns the first entry having a filename matching a pattern. The "*" characters matches 0 or more of any character. The full filename, including path, is used when matching against the pattern. A NULL is returned if nothing matches.

Returns NULL on failure

More Information and Examples
top
GetDirectoryAsXML
BOOL CkZip_GetDirectoryAsXML(HCkZip cHandle, HCkString outXml);
const char *CkZip_getDirectoryAsXML(HCkZip cHandle);

Return the contents of the Zip file directory in an XML formatted string

Returns TRUE for success, FALSE for failure.

top
GetEntryByID
HCkZipEntry CkZip_GetEntryByID(HCkZip cHandle, int entryID);

Retrieves a ZipEntry by ID. Chilkat Zip.NET automatically assigns a unique ID to each ZipEntry in the Zip. This feature makes it easy to associate an item in a UI control with a ZipEntry.

Returns NULL on failure

top
GetEntryByIndex
HCkZipEntry CkZip_GetEntryByIndex(HCkZip cHandle, int index);

Retrieves a ZipEntry by index. The first entry is at index 0. This will return directory entries as well as files.

Returns NULL on failure

top
GetEntryByName
HCkZipEntry CkZip_GetEntryByName(HCkZip cHandle, const char *entryName);

Returns a ZipEntry by filename. If a full or partial path is part of the filename, this must be included in the filename parameter.

Returns NULL on failure

top
GetExclusions
HCkStringArray CkZip_GetExclusions(HCkZip cHandle);

Returns the current collection of exclusion patterns that have been set by SetExclusions.

Returns NULL on failure

top
GetExeConfigParam
BOOL CkZip_GetExeConfigParam(HCkZip cHandle, const char *name, HCkString outStr);
const char *CkZip_getExeConfigParam(HCkZip cHandle, const char *name);

(Relevant only when running on a Microsoft Windows operating system.) Gets the value of an EXE config param as described in the ExeXmlConfig property.

Returns TRUE for success, FALSE for failure.

top
InsertNew
HCkZipEntry CkZip_InsertNew(HCkZip cHandle, const char *fileName, int beforeIndex);

Inserts a new and empty entry into the Zip object. To insert at the beginning of the Zip, beforeIndex should be 0. The ZipEntry's FileName property is initialized to fileName parameter.

Returns NULL on failure

top
IsNoCompressExtension
BOOL CkZip_IsNoCompressExtension(HCkZip cHandle, const char *fileExtension);

Returns TRUE if the fileExtension is contained in the set of "no compress" extensions, otherwise returns FALSE. (See the documentation for the AddNoCompressExtension method.) The fileExtension may be passed with or without the ".". For example, both ".jpg" and "jpg" are acceptable.

top
IsPasswordProtected
BOOL CkZip_IsPasswordProtected(HCkZip cHandle, const char *zipFilename);

Return True if a Zip file is password protected

top
IsUnlocked
BOOL CkZip_IsUnlocked(HCkZip cHandle);

Returns True if the class is already unlocked, otherwise returns False.

top
NewZip
BOOL CkZip_NewZip(HCkZip cHandle, const char *zipFilePath);

Clears and initializes the contents of the Zip object. If a Zip file was open, it is closed and all entries are removed from the object. The FileName property is set to the zipFilePath argument.

More Information and Examples
top
OpenBd
BOOL CkZip_OpenBd(HCkZip cHandle, HCkBinData binData);
Introduced in version 9.5.0.66

Open a Zip contained in binData.

When a zip is opened, the PasswordProtect and Encryption properties will be appropriately set. If the zip is password protected (i.e. uses older Zip 2.0 encrypion), then the PasswordProtect property will be set to TRUE. If the zip is strong encrypted, the Encryption property will be set to a value 1 through 4, where 4 indicates WinZip compatible AES encryption.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
OpenEmbedded
BOOL CkZip_OpenEmbedded(HCkZip cHandle, const char *exeFilename, const char *resourceName);

(Relevant only when running on a Microsoft Windows operating system.) Opens a Zip embedded in an MS Windows EXE

Returns TRUE for success, FALSE for failure.

top
OpenFromByteData
BOOL CkZip_OpenFromByteData(HCkZip cHandle, HCkByteData byteData);

Same as OpenFromMemory.

When a zip is opened, the PasswordProtect and Encryption properties will be appropriately set. If the zip is password protected (i.e. uses older Zip 2.0 encrypion), then the PasswordProtect property will be set to TRUE. If the zip is strong encrypted, the Encryption property will be set to a value 1 through 4, where 4 indicates WinZip compatible AES encryption.

Returns TRUE for success, FALSE for failure.

top
OpenFromMemory
BOOL CkZip_OpenFromMemory(HCkZip cHandle, HCkByteData inData);

Open a Zip that is completely in-memory. This allows for Zip files to be opened from non-filesystem sources, such as a database.

When a zip is opened, the PasswordProtect and Encryption properties will be appropriately set. If the zip is password protected (i.e. uses older Zip 2.0 encrypion), then the PasswordProtect property will be set to TRUE. If the zip is strong encrypted, the Encryption property will be set to a value 1 through 4, where 4 indicates WinZip compatible AES encryption.

Returns TRUE for success, FALSE for failure.

top
OpenMyEmbedded
BOOL CkZip_OpenMyEmbedded(HCkZip cHandle, const char *resourceName);

(Relevant only when running on a Microsoft Windows operating system.) Opens a Zip embedded within the caller's MS Windows EXE.

Returns TRUE for success, FALSE for failure.

top
OpenZip
BOOL CkZip_OpenZip(HCkZip cHandle, const char *zipPath);

Opens a Zip archive. Encrypted and password-protected zips may be opened without providing the password, but their contents may not be unzipped unless the correct password is provided via the DecryptPassword proprety, or the SetPassword method.

When a zip is opened, the PasswordProtect and Encryption properties will be appropriately set. If the zip is password protected (i.e. uses older Zip 2.0 encrypion), then the PasswordProtect property will be set to TRUE. If the zip is strong encrypted, the Encryption property will be set to a value 1 through 4, where 4 indicates WinZip compatible AES encryption.

Returns TRUE for success, FALSE for failure.

top
OpenZipAsync (1)
HCkTask CkZip_OpenZipAsync(HCkZip cHandle, const char *zipPath);

Creates an asynchronous task to call the OpenZip method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
QuickAppend
BOOL CkZip_QuickAppend(HCkZip cHandle, const char *ZipFileName);

Efficiently appends additional files to an existing zip archive. QuickAppend leaves all entries in the existing .zip untouched. It operates by appending new files and updating the internal "central directory" of the zip archive.

Returns TRUE for success, FALSE for failure.

top
QuickAppendAsync (1)
HCkTask CkZip_QuickAppendAsync(HCkZip cHandle, const char *ZipFileName);

Creates an asynchronous task to call the QuickAppend method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
RemoveEmbedded
BOOL CkZip_RemoveEmbedded(HCkZip cHandle, const char *exeFilename, const char *resourceName);

(Relevant only when running on a Microsoft Windows operating system.) Removes an embedded Zip from an MS-Windows EXE

Returns TRUE for success, FALSE for failure.

top
RemoveNoCompressExtension
void CkZip_RemoveNoCompressExtension(HCkZip cHandle, const char *fileExtension);

Removes a file extension from the zip object's internal list of "no compress" extensions. (For more information, see AddNoCompressExtension.)

top
ReplaceEmbedded
BOOL CkZip_ReplaceEmbedded(HCkZip cHandle, const char *exeFilename, const char *resourceName, const char *zipFilename);

(Relevant only when running on a Microsoft Windows operating system.) Replace a Zip embedded in an MS-Windows EXE with another Zip file.

Returns TRUE for success, FALSE for failure.

top
SaveLastError
BOOL CkZip_SaveLastError(HCkZip cHandle, const char *path);

Saves the last-error information (the contents of LastErrorXml) to an XML formatted file.

Returns TRUE for success, FALSE for failure.

top
SetCompressionLevel
void CkZip_SetCompressionLevel(HCkZip cHandle, int level);

Sets the compression level for all file and data entries. The compression level for a mapped entry (i.e. an entry that is contained within an opened .zip, cannot be changed.) The default compression level is 6. A compression level of 0 is equivalent to no compression. The maximum compression level is 9.

The zip.SetCompressionLevel method must be called after appending the files (i.e. after the calls to AppendFile*, AppendData, or AppendOneFileOrDir).

A single call to SetCompressionLevel will set the compression level for all existing file and data entries.

top
SetExclusions
void CkZip_SetExclusions(HCkZip cHandle, HCkStringArray excludePatterns);

Specify a collection of exclusion patterns to be used when adding files to a Zip. Each pattern in the collection can use the "*" wildcard character, where "*" indicates 0 or more occurrences of any character.

top
SetExeConfigParam
void CkZip_SetExeConfigParam(HCkZip cHandle, const char *paramName, const char *paramValue);

Sets a self-extractor property that is embedded in the resultant EXE created by the WriteExe or WriteExe2 methods. The paramName is one of the XML tags listed in the ExeXmlConfig property.

For example, to specify the text for the self-extractor's main dialog unzip button, paramName would be "MainUnzipBtn".

top
SetPassword
void CkZip_SetPassword(HCkZip cHandle, const char *password);

Set the password for an encrypted or password-protected Zip.

top
UnlockComponent
BOOL CkZip_UnlockComponent(HCkZip cHandle, const char *regCode);

Unlocks the component allowing for the full functionality to be used. If a purchased unlock code is passed, there is no expiration. Any other string automatically begins a fully-functional 30-day trial the first time UnlockComponent is called.

Returns TRUE for success, FALSE for failure.

top
Unzip
int CkZip_Unzip(HCkZip cHandle, const char *dirPath);

Unzips and returns the number of files unzipped, or -1 if a failure occurs. Subdirectories are automatically created during the unzipping process.

top
UnzipAsync (1)
HCkTask CkZip_UnzipAsync(HCkZip cHandle, const char *dirPath);

Creates an asynchronous task to call the Unzip method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
UnzipInto
int CkZip_UnzipInto(HCkZip cHandle, const char *dirPath);

Unzips and returns the number of files unzipped, or -1 if a failure occurs. All files in the Zip are unzipped into the specfied dirPath regardless of the directory path information contained in the Zip. This has the effect of collapsing all files into a single directory. If several files in the Zip have the same name, the files unzipped last will overwrite the files already unzipped.

top
UnzipIntoAsync (1)
HCkTask CkZip_UnzipIntoAsync(HCkZip cHandle, const char *dirPath);

Creates an asynchronous task to call the UnzipInto method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
UnzipMatching
int CkZip_UnzipMatching(HCkZip cHandle, const char *dirPath, const char *pattern, BOOL verbose);

Same as Unzip, but only unzips files matching a pattern. If no wildcard characters ('*') are used, then only files that exactly match the pattern will be unzipped. The "*" characters matches 0 or more of any character.

More Information and Examples
top
UnzipMatchingAsync (1)
HCkTask CkZip_UnzipMatchingAsync(HCkZip cHandle, const char *dirPath, const char *pattern, BOOL verbose);

Creates an asynchronous task to call the UnzipMatching method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
UnzipMatchingInto
int CkZip_UnzipMatchingInto(HCkZip cHandle, const char *dirPath, const char *pattern, BOOL verbose);

Unzips matching files into a single directory, ignoring all path information stored in the Zip.

top
UnzipMatchingIntoAsync (1)
HCkTask CkZip_UnzipMatchingIntoAsync(HCkZip cHandle, const char *dirPath, const char *pattern, BOOL verbose);

Creates an asynchronous task to call the UnzipMatchingInto method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
UnzipNewer
int CkZip_UnzipNewer(HCkZip cHandle, const char *dirPath);

Same as Unzip, but only files that don't already exist on disk, or have later file modification dates are unzipped.

top
UnzipNewerAsync (1)
HCkTask CkZip_UnzipNewerAsync(HCkZip cHandle, const char *dirPath);

Creates an asynchronous task to call the UnzipNewer method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
VerifyPassword
BOOL CkZip_VerifyPassword(HCkZip cHandle);

Tests the current DecryptPassword setting against the currently opened zip. Returns TRUE if the password is valid, otherwise returns FALSE.

More Information and Examples
top
WriteBd
BOOL CkZip_WriteBd(HCkZip cHandle, HCkBinData binData);
Introduced in version 9.5.0.66

Same as WriteZip, but instead of writing the Zip to a file, it writes to binData. Zips that are written to binData can be opened by calling OpenBd. Note: Both WriteBd and OpenBd are added in Chilkat v9.5.0.66

Returns TRUE for success, FALSE for failure.

top
WriteBdAsync (1)
HCkTask CkZip_WriteBdAsync(HCkZip cHandle, HCkBinData binData);
Introduced in version 9.5.0.66

Creates an asynchronous task to call the WriteBd method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
WriteExe
BOOL CkZip_WriteExe(HCkZip cHandle, const char *exeFilename);

(Relevant only when running on a Microsoft Windows operating system.) Writes an MS-Windows self-extracting executable. There are no limitations on the total size, individual file size, or number of files that can be added to a self-extracting EXE.

If the resultant EXE will automatically accept these command-line arguments when run:

-log logFileName
Creates a log file that lists the settings embedded within the EXE and logs the errors, warnings, and other information about the self-extraction.
-unzipDir unzipDirectoryPath
Unzips to this directory path without user intervention.
-pwd password
Specifies the password for an encrypted EXE
-ap autoRunParams
Specifies the command line parameters to be passed to the AutoRun executable (embedded within the EXE).

Returns TRUE for success, FALSE for failure.

top
WriteExeToMemory
BOOL CkZip_WriteExeToMemory(HCkZip cHandle, HCkByteData outBytes);

(Relevant only when running on a Microsoft Windows operating system.) Same as WriteExe, but instead of writing a file, the MS-Windows EXE is written to memory.

Returns TRUE for success, FALSE for failure.

top
WriteToMemory
BOOL CkZip_WriteToMemory(HCkZip cHandle, HCkByteData outData);

Same as WriteZip, but instead of writing the Zip to a file, it writes to memory. Zips that are written to memory can also be opened from memory by calling OpenFromMemory.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
WriteToMemoryAsync (1)
HCkTask CkZip_WriteToMemoryAsync(HCkZip cHandle);

Creates an asynchronous task to call the WriteToMemory method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
WriteZip
BOOL CkZip_WriteZip(HCkZip cHandle);

Saves the Zip to a file and implictly re-opens it so further operations can continue. Use WriteZipAndClose to write and close the Zip. There is no limitation on the size of files that may be contained within a .zip, the total number of files in a .zip, or the total size of a .zip. If necessary, WriteZip will use the ZIP64 file format extensions when 4GB or file count limitations of the old zip file format are exceeded.

Returns TRUE for success, FALSE for failure.

top
WriteZipAsync (1)
HCkTask CkZip_WriteZipAsync(HCkZip cHandle);

Creates an asynchronous task to call the WriteZip method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top
WriteZipAndClose
BOOL CkZip_WriteZipAndClose(HCkZip cHandle);

Saves the Zip to a file and closes it. On return, the Zip object will be in the state as if NewZip had been called. There is no limitation on the size of files that may be contained within a .zip, the total number of files in a .zip, or the total size of a .zip. If necessary, WriteZip will use the ZIP64 file format extensions when 4GB or file count limitations of the old zip file format are exceeded.

Returns TRUE for success, FALSE for failure.

top
WriteZipAndCloseAsync (1)
HCkTask CkZip_WriteZipAndCloseAsync(HCkZip cHandle);

Creates an asynchronous task to call the WriteZipAndClose method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns NULL on failure

top