ZipArchive library documentation

General Information

The ZipArchive library
Copyright © 2000 - 2004 Tadeusz Dracz

Version: 2.4.1
Date: 19-June-2004

This library adds zip compression and decompression functionality to your program, allowing you to create and modify ZIP files in the compatible way with WinZip, PKZIP and other popular archivers. Its easy and practical interface makes the library suitable for the beginners as well as for the advanced users.

See what's new in this version.
To be notified about the future library updates, sign up for the ZipArchive Newsletter.

Platforms supported:

  • Windows 9x\Me\NT\2000\XP (MFC and STL)
    Microsoft Visual C++ 6.0 (.NET compatible ), Borland C++

  • Linux (STL)

Author:
Tadeusz Dracz
E-Mail: tdracz@artpol-software.com
Web Site: http://www.artpol-software.com
This library uses the zlib library by Jean-loup Gailly and Mark Adler to perform inflate and deflate operations.

Features Summary:

  • work in a compatible way with PKZIP and WinZip (apart from TD disk spanning mode which is specific to this library)
  • create, modify, extract and test zip archives
  • create and extract multi-disk archives (on non-removable disks as well)
  • add file to the archive from another archive without decompressing the file (copy compressed data) (see CZipArchive::GetFromArchive)
  • highly optimized deleting multiple files from the archive
  • optimized replacing and renaming files in the archive
  • compression from and decompression to memory, create the whole archive in memory, extract the archive from memory (see Creating and extracting archives from/in memory)
  • password encryption and decryption supported
  • possibility to create or extract self-extracting archives
  • smart compression, if enabled, prevents the file in the archive to be larger after compression (see CZipArchive::Smartness)
  • safe compression with CZipArchive::Flush function
  • using functional objects as callback
    • to provide easy disk change in a multi-disk archives
    • for the progress control when adding, extracting, testing or deleting files or saving archive's central directory
  • extracting and deleting using wildcard pattern matching (see CZipArchive::FindMatches)
  • UNC and Windows Unicode paths recognized (still, due to the zip format specification, the filnames in the archive are stored using OEM-defined character set)
  • wide characters supported
  • support for the Java TM Archive (jar) File Format (see CZipArchive::SetIgnoreCRC)
  • can be used as a static library or DLL (necessary VC++ projects included)
  • possibility to integrate help system with MSDN (see Integrating with MSDN)
  • easy interface
  • easy transfer to other system platforms
  • speedy
  • well documented
  • full source code provided
  • sample applications provided (for the STL version located in stl/zippie, the MFC version (multithreaded) is available separately)

No software product is entirely bugless and neither is this library. If you find a bug (or suspect one), please mail me. The bugs are usually corrected within few days. Many thanks to the people that already tracked them down and submitted.

The Introduction

All you need to know about the licensing: Licensing information .

It's a good start to read these pages first (prior to reading the raw documentation):

  • Compilation & Integration
  • General Information
  • FAQ.

Revision history not only shows how the development of the library went so far, but also you may find here an interesting library feature without digging through the documentation.

If you wish to be notified about the future library updates, sign up for the ZipArchive Newsletter .

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipArchive.h File Reference

Interface for the CZipArchive class. More...

Go to the source code of this file.

Namespaces

namespace | ziparchv

Classes

struct | CZipAddNewFileInfo
Structure used as a parameter in CZipArchive::AddNewFile(CZipAddNewFileInfo& ); Use one of constructors provided and then adjust the member variables that are set to default values by Defaults method. More...

class | CZipArchive
The representation of the zip archive file. More...

class | CZipArchive::CWildcard
A class used in wildcard pattern matching. More...

struct | CZipArchive::CZipClbckStrg
Storage for callback functors. More...

struct | CZipArchive::CZipDeleteInfo
Holds map of holes and areas to remain when deleting files from the archive. More...

struct | CZipArchive::CZipInternalInfo
The purpose of this structure is to hold the data that allow communication with the zlib library. More...

struct | CZipArchive::CZipSmClrPass
A structure for the internal use only. More...

Detailed Description

Interface for the CZipArchive class.

Definition in file ZipArchive.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipAutoBuffer.h File Reference

Interface for the CZipAutoBuffer class. More...

Go to the source code of this file.

Classes

class CZipAutoBuffer
A smart buffer freeing its contents on destruction. More...

Detailed Description

Interface for the CZipAutoBuffer class.

Definition in file ZipAutoBuffer.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipCentralDir.h File Reference

Interface for the CZipCentralDir class. More...

Go to the source code of this file.

Classes

class | CZipCentralDir
A class representing the central directory record in the archive. More...

struct | CZipCentralDir::CZipFindFast
Used in fast finding files by the filename. More...

struct | CZipCentralDir::Info
Stores general information about the central directory record. More...

Detailed Description

Interface for the CZipCentralDir class.

Definition in file ZipCentralDir.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipCompatibility.h File Reference

ZipCompatibility namespace declaration. More...

Go to the source code of this file.

Namespaces

namespace ZipCompatibility

Detailed Description

ZipCompatibility namespace declaration.

Definition in file ZipCompatibility.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipException.h File Reference

Interface for the CZipException class. More...

Go to the source code of this file.

Classes

class CZipException
A class representing exceptions specific to the ZipArchive library. More...

Detailed Description

Interface for the CZipException class.

Definition in file ZipException.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipFileHeader.h File Reference

Interface for the CZipFileHeader class. More...

Go to the source code of this file.

Classes

class CZipFileHeader
Representation of a single file stored in the zip archive. More...

Detailed Description

Interface for the CZipFileHeader class.

Definition in file ZipFileHeader.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipMemFile.h File Reference

Interface for the CZipMemFile class. More...

Go to the source code of this file.

Classes

class CZipMemFile
A memory buffer which behaves like a physical file. More...

Detailed Description

Interface for the CZipMemFile class.

Definition in file ZipMemFile.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipPathComponent.h File Reference

Interface for the CZipPathComponent class. More...

Go to the source code of this file.

Classes

class CZipPathComponent
A class splitting a file path into components. More...

Detailed Description

Interface for the CZipPathComponent class.

Definition in file ZipPathComponent.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipPlatform.h File Reference

ZipPlatform namespace declaration. More...

Go to the source code of this file.

Namespaces

namespace ZipPlatform

Detailed Description

ZipPlatform namespace declaration.

Definition in file ZipPlatform.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipStorage.h File Reference

Interface for the CZipStorage class. More...

Go to the source code of this file.

Classes

struct | CZipActionCallback
Derive from this a class to be used as a callback functors when adding, extracting, deleting, testing a file or saving central directory. More...

struct | CZipCallback
A base class for functional objects (functors) that are used as a callbacks during various actions. More...

struct | CZipSpanCallback
Derive from this a class to be used as a callback functor for the disk change callback. More...

class | CZipStorage
A low-level class - operates physically on archive (CZipArchive operates logically). More...

Detailed Description

Interface for the CZipStorage class.

Definition in file ZipStorage.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


CZipActionCallback Struct Reference

Derive from this a class to be used as a callback functors when adding, extracting, deleting, testing a file or saving central directory. More...

#include <ZipStorage.h>

Inheritance diagram for CZipActionCallback:

[legend]
List of all members.

Public Member Functions

virtual void | Init (LPCTSTR lpszFileInZip=NULL, LPCTSTR lpszExternalFile=NULL)
Used by the ZipArchive library to init the callback function with the filenames.

virtual void | SetTotal (DWORD uTotalToDo)
Called by the ZipArchive functions that use the callback feature after calculating total data to process.

DWORD | LeftToDo ()
virtual void | CallbackEnd ()
Called after the action finishes (it is not called in case of an exception, but it is called before throwing CZipException::abortedAction or CZipException::abortedSafely).

virtual bool | operator() (int iProgress)
Used internally to call Callback and increase m_uTotalSoFar by iProgress.

int | GetStep ()
Used internally to return m_iStep value but not 0 (return 1 in this case).

Public Attributes

int | m_iType
The type of the callback.

DWORD | m_uTotalToDo
Total number of data to process.

DWORD | m_uTotalSoFar
total number of bytes processed so far

CZipString | m_szFileInZip
file in zip archive being currently processed

Static Public Attributes

int | m_iStep
Used only when creating map before deletion (see CZipArchive::cbDeleteCnt) or saving the central directory record.

Detailed Description

Derive from this a class to be used as a callback functors when adding, extracting, deleting, testing a file or saving central directory.

You need to override member function CZipCallback::Callback. The meaning of iProgress parameter is the count of data just processed. It is a smallest number of bytes after which the callback method is called and it depends on the value of nBufSize in the CZipArchive methods that uses the callback feature. In case of saving the central directory action it is the count of file headers just written (see CZipArchive::cbSave)

See also:
CZipCallback::Callback

CZipArchive::SetCallback

Definition at line 101 of file ZipStorage.h.

Member Function Documentation

int CZipActionCallback::GetStep ( ) [inline]

Used internally to return m_iStep value but not 0 (return 1 in this case).

Definition at line 194 of file ZipStorage.h.

virtual void CZipActionCallback::Init | ( | LPCTSTR | lpszFileInZip = NULL,
 |  | LPCTSTR | lpszExternalFile = NULL
 | ) | [inline, virtual]

Used by the ZipArchive library to init the callback function with the filenames.

Resets m_uTotalToDo and m_uTotalSoFar variables to 0. m_iType variable is already set to the proper value. Called at the beginning of the action.

Definition at line 120 of file ZipStorage.h.

DWORD CZipActionCallback::LeftToDo ( ) [inline]

Returns:
the number of bytes left to process

Definition at line 159 of file ZipStorage.h.

virtual void CZipActionCallback::SetTotal ( DWORD uTotalToDo ) [inline, virtual]

Called by the ZipArchive functions that use the callback feature after calculating total data to process.

Parameters:
uTotalToDo total data to process; set m_uTotalToDo to this value

Definition at line 133 of file ZipStorage.h.

Member Data Documentation

int CZipActionCallback::m_iStep [static]

Used only when creating map before deletion (see CZipArchive::cbDeleteCnt) or saving the central directory record.

You'll be notified every nth step (n is m_iStep value) with iProgress set to m_iStep . Do not set it to low values or you can have a long waiting on archives with huge number of files.

Default: 256.

Definition at line 188 of file ZipStorage.h.

int CZipActionCallback::m_iType

The type of the callback.

It is set to one of CZipArchive::CallbackType values when the action begins. It's useful if you have more than one callback assigned to the same functor.

Definition at line 114 of file ZipStorage.h.

DWORD CZipActionCallback::m_uTotalToDo

Total number of data to process.

The value of this variable is set after calling by the library SetTotal method (it is 0 before). Depending on the action it is set then to:

  • adding file: the size the external file being added (or if callback is CZipArchive::cbAddTmp, the size of compressed data: CZipFileHeader::m_uComprSize)
  • extracting file: the size of uncompressed data (CZipFileHeader::m_uUncomprSize)
  • testing file: the same as above
  • deleting file: the count of bytes to move - the size of all files to remain above the first file to delete (calculated from offsets CZipFileHeader::m_uOffset
  • saving central directory: the number of files in the archive

Definition at line 151 of file ZipStorage.h.

The documentation for this struct was generated from the following file:
  • ZipStorage.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:00 2004.


CZipAddNewFileInfo Struct Reference

Structure used as a parameter in CZipArchive::AddNewFile(CZipAddNewFileInfo& ); Use one of constructors provided and then adjust the member variables that are set to default values by Defaults method. More...

#include <ZipArchive.h>

List of all members.

Public Member Functions

CZipAddNewFileInfo (LPCTSTR lpszFilePath, bool bFullPath=true)
CZipAddNewFileInfo (LPCTSTR lpszFilePath, LPCTSTR lpszFileNameInZip)
CZipAddNewFileInfo (CZipAbstractFile *pFile, LPCTSTR lpszFileNameInZip)
void | Defaults ()
Set default values for m_iSmartLevel, m_iReplaceIndex, m_nBufSize and m_iComprLevel.

Public Attributes

CZipString | m_szFilePath
the full path to the file to be added; if it is empty you need to set m_pFile

CZipString | m_szFileNameInZip
the file name that will be stored in the archive (if the file is a directory, there is a path separator automatically added at the end); #SetRootPath function has no effect on this parameter

bool | m_bFullPath
It has only the meaning when m_szFileNameInZip is not specified and m_szFilePath is not empty.

int | m_iComprLevel
the compression level, see #OpenNewFile

int | m_iSmartLevel
the smartness level of of the library; can be one or more #Smartness values (you can OR them);
if zipsmCheckForEff is specified and due to it the file needs to be reinserted into the archive without a compression and the callback functor is specified, the callback functor's method Callback is called with the first argument set to DWORD (-1) (you need to remember the last argument if you need the size of the file)

int | m_iReplaceIndex
the index of the existing file in the archive to be replaced by the file being added (the new file goes into the same physical place as the old file - the archive may of course grow or shrink as a result)

unsigned long | m_nBufSize
the size of the buffer used while file operations

CZipAbstractFile * | m_pFile
instead of from a physical file, the data for compression is taken from the CZipAbstractFile object (e.g.

Detailed Description

Structure used as a parameter in CZipArchive::AddNewFile(CZipAddNewFileInfo& ); Use one of constructors provided and then adjust the member variables that are set to default values by Defaults method.

Definition at line 102 of file ZipArchive.h.

Member Data Documentation

bool CZipAddNewFileInfo::m_bFullPath

It has only the meaning when m_szFileNameInZip is not specified and m_szFilePath is not empty.

  • if true, include full path of the file inside the archive (even if #m_szRootPath is set)

  • if false only the filename without a path is stored in the archive

in this case if #m_szRootPath is set previously with #SetRootPath and if the beginning of m_szFilePath equals #m_szRootPath then the filename is set to the remaining part of m_szFilePath (you can say to m_lpszFilePath minus #m_szRootPath)

Definition at line 145 of file ZipArchive.h.

int CZipAddNewFileInfo::m_iReplaceIndex

the index of the existing file in the archive to be replaced by the file being added (the new file goes into the same physical place as the old file - the archive may of course grow or shrink as a result)

  • >= 0 the index of the file to be replaced
  • -1 do not replace any file and add the new file at the end of the archive (default)
  • -2 if the new file has the same name as a file already in the archive then replace it or add at the end of the archive if it's filename is unique; it uses CZipArchive::FindFile with the arguments iCaseSensitive and bFileNameOnly set to default values

Note:
  • you replace files in disk-spanning archives (i.e. use a value different from -1)
  • if the space size taken by the old file is different from the space size needed by the new file, the callback is called while moving data (see CZipArchive::cbReplace)
  • this replaces the file physically, so no information from the file being replaced is retained (such as attributes, modification time, etc.)
  • if you use an invalid index, the function will fail; if you specify the last file in the archive to be replaced, it'll be removed and the usual action taken
  • the new file encryption does not depend on the old file encryption but only on the current password settings (see CZipArchive::SetPassword)
  • if m_iComprLevel is not 0 then a temporary archive is created in the temporary directory (see CZipArchive::SetTempPath) or in the memory (if you use CZipArchive::zipsmMemoryFlag in m_iSmartLevel)
  • the most complicated scenario is when you try to replace the file and use CZipArchive::zipsmCheckForEff flag in m_iSmartLevel and the file compression proves to be inefficient (you can use the sample application ZipArc to observe the following process):
    • first you get CZipArchive::cbAdd callback - the file is being compressed to a temporary archive,
    • then the file compression proves to be inefficient and the file needs to be stored instead of compressed, but first the space inside archive must be adjusted to fit the file being added in the place of file being replaced - you get CZipArchive::cbReplace,
    • then, at the end, the file is being stored - you get CZipArchive::cbAddStore callback
See also:
SetAdvanced

CZipArchive::WillBeDuplicated

Definition at line 189 of file ZipArchive.h.

CZipAbstractFile* CZipAddNewFileInfo::m_pFile

instead of from a physical file, the data for compression is taken from the CZipAbstractFile object (e.g.

from CZipMemFile)

Note:
  • you have to leave m_szFilePath empty if you set m_pFile to not NULL
  • the time of the file in zip is set to the current time, and the attributes to the default file attributes (depending on the system)
  • you cannot add directories this way

Definition at line 205 of file ZipArchive.h.

The documentation for this struct was generated from the following file:
  • ZipArchive.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipArchive Class Reference

The representation of the zip archive file. More...

#include <ZipArchive.h>

List of all members.

Public Types

enum CallbackType {
cbNothing = 0x0000, cbAdd = 0x0001, cbAddTmp = 0x0002, cbAddStore = 0x0004,
cbExtract = 0x0008, cbDeleteCnt = 0x0010, cbDelete = 0x0020, cbTest = 0x0040,
cbSave = 0x0080, cbGetFromArchive = 0x0100, cbRename = 0x0200, cbReplace = 0x0400,
cbNextValue = 0x0800, cbSubActions = cbAddTmp | cbAddStore | cbDeleteCnt | cbReplace, cbActions = cbAdd | cbExtract | cbDelete | cbTest | cbSave | cbGetFromArchive | cbRename, cbAll = cbActions | cbSubActions
}
Enum values used as iWhich parameter in SetCallback function. More...

enum | OpenMode { zipOpen, zipOpenReadOnly, zipCreate, zipCreateSpan }
Archive open modes used in Open(LPCTSTR , int , int ) and #Open(CZipMemFile, int ) . More...

enum Smartness {
zipsmLazy = 0x0000, zipsmCPassDir = 0x0001, zipsmCPFile0 = 0x0002, zipsmNotCompSmall = 0x0004,
zipsmCheckForEff = 0x0008, zipsmMemoryFlag = 0x0010, zipsmCheckForEffInMem = zipsmMemoryFlag | zipsmCheckForEff, zipsmSmartPass = zipsmCPassDir | zipsmCPFile0,
zipsmSmartAdd = zipsmNotCompSmall | zipsmCheckForEff, zipsmSafeSmart = zipsmSmartPass | zipsmNotCompSmall, zipsmSmartest = zipsmSmartPass | zipsmSmartAdd, zipsmInternal01 = 0xf000
}
The levels of smartness of the adding files action (see AddNewFile). More...

enum | FFCaseSens { ffDefault, ffCaseSens, ffNoCaseSens }
case-sensitivity values used as argument iCaseSensitive in FindFile More...

enum | CloseAfterException { afNoException, afAfterException, afWriteDir }
values used in Close function as parameter iAfterException More...

enum | Predict { prDir, prFile, prAuto }
enum values used in PredictFileNameInZip More...

Public Member Functions

bool | SetPassword (LPCTSTR lpszPassword=NULL)
Set the password for the file to be opened or created.

CZipString | GetPassword () const
void | SetAdvanced (int iWriteBuffer=65536, int iGeneralBuffer=65536, int iSearchBuffer=32768)
Set the buffer sizes.

void | GetAdvanced (int *piWriteBuffer=NULL, int *piGeneralBuffer=NULL, int *piSearchBuffer=NULL)
retreive buffer size as set by SetAdvanced

void | SetCallback (CZipActionCallback *pCallback=NULL, int iWhich=cbAll)
Set callback functors for the following operations on the zip archive: adding, extracting, testing or deleting files.

CZipActionCallback * | GetCallback (CallbackType iWhich)
void | SetSpanCallback (CZipSpanCallback *pCallback=NULL)
Set the callback functor used during operations on a PKZIP compatible disk spanning archive to change disks.

void | Open (LPCTSTR szPathName, int iMode=zipOpen, int iVolumeSize=0)
Open or create a zip archive.

void | Open (CZipMemFile &mf, int iMode=zipOpen)
Open or create the archive in memory.

void | SetRootPath (LPCTSTR szPath=NULL)
Set m_szRootPath to a specified value.

CZipString | GetRootPath () const
Return the current value of m_szRootPath.

bool | AddNewFile (CZipAddNewFileInfo &info)
Add a new file to the archive.

bool | AddNewFile (LPCTSTR lpszFilePath, int iComprLevel=-1, bool bFullPath=true, int iSmartLevel=zipsmSafeSmart, unsigned long nBufSize=65536)
bool | AddNewFile (LPCTSTR lpszFilePath, LPCTSTR lpszFileNameInZip, int iComprLevel=-1, int iSmartLevel=zipsmSafeSmart, unsigned long nBufSize=65536)
bool | AddNewFile (CZipMemFile &mf, LPCTSTR lpszFileNameInZip, int iComprLevel=-1, int iSmartLevel=zipsmSafeSmart, unsigned long nBufSize=65536)
bool | OpenNewFile (CZipFileHeader &header, int iLevel=Z_DEFAULT_COMPRESSION, LPCTSTR lpszFilePath=NULL, DWORD uInternal=0)
Add a new file to the opened zip archive.

bool | WriteNewFile (const void *pBuf, DWORD iSize)
Compress the contents of the buffer and write it to a new file.

void | SetExtraField (const char *pBuf, WORD iSize)
Set the extra field in the central directory of the currently opened file.

bool | CloseNewFile (bool bAfterException=false)
Close the new file in the archive.

bool | GetFromArchive (CZipArchive &zip, WORD uIndex, int iReplaceIndex=-1, bool bKeepSystComp=false)
Acquire a file with the given index from another archive.

bool | GetFromArchive (CZipArchive &zip, CZipWordArray &aIndexes, bool bKeepSystComp=false)
Acquire files with the given indexes from another archive.

bool | GetFromArchive (CZipArchive &zip, CZipStringArray &aNames, bool bKeepSystComp=false)
Acquire files with the given indexes from another archive.

void | GetIndexes (const CZipStringArray &aNames, CZipWordArray &aIndexes)
Get indexes of the files stored int aNames array and put them into aIndexes.

bool | ExtractFile (WORD uIndex, LPCTSTR lpszPath, bool bFullPath=true, LPCTSTR lpszNewName=NULL, DWORD nBufSize=65536)
Extract the file from the archive.

bool | ExtractFile (WORD uIndex, CZipMemFile &mf, bool bRewind=true, DWORD nBufSize=65536)
The same as ExtractFile(WORD , LPCTSTR , bool , LPCTSTR , DWORD ) but instead to a physical file, this function decompress the data into CZipMemFile object.

bool | OpenFile (WORD uIndex)
Open the file with the given index in the archive for extracting.

DWORD | ReadFile (void *pBuf, DWORD iSize)
Decompress currently opened file to the buffer.

bool | TestFile (WORD uIndex, DWORD uBufSize=65536)
Test the file with the given index for the integrity.

void | CloseFileWithNoUpdate ()
Perform the necessary cleanup after an exception was thrown while testing or extracting the archive so that next files in the archive can be tested or extracted.

int | GetLocalExtraField (char *pBuf, int iSize) const
Get the local extra filed of the currently opened for extraction file in the archive.

int | CloseFile (CZipFile &file)
The same as CZipArchive::CloseFile(LPCTSTR), but additionally closes file.

int | CloseFile (LPCTSTR lpszFilePath=NULL, bool bAfterException=false)
Close the file opened for extraction in the archive and copy its date and attributes to the file pointed by lpszFilePath.

void | DeleteFile (WORD uIndex)
Delete the file from the archive with the given index.

void | DeleteFiles (CZipWordArray &aIndexes)
Delete files from the archive.

void | DeleteFiles (const CZipStringArray &aNames)
Delete files from the archive.

bool | SetGlobalComment (LPCTSTR lpszComment)
Set the global comment in the archive.

CZipString | GetGlobalComment () const
bool | SetFileComment (WORD uIndex, LPCTSTR lpszComment)
Set the comment of the file with the given index inside the archive.

CZipString | GetArchivePath () const
int | GetCurrentDisk () const
int | GetSpanMode () const
Return the disk spanning mode of the current archive.

int | FindFile (LPCTSTR lpszFileName, int iCaseSensitive=ffDefault, bool bFileNameOnly=false)
Find the file in the archive.

bool | GetFileInfo (CZipFileHeader &fhInfo, WORD uIndex) const
Get the info of the file with the given index.

int | GetCount (bool bOnlyFiles=false) const
void | Close (int iAfterException=afNoException, bool bUpdateTimeStamp=false)
Close the archive.

bool | IsClosed (bool bArchive=true) const
Test if the archive is closed (a whole or the current volume only).

void | Flush ()
Write the central directory to the archive and flushes the internal buffers to the disk, so that the archive is finalized on the disk, but you can still modify it.

void | SetAutoFlush (bool bAutoFlush=true)
Set the CZipArchive object to call Flush after each operation that modifies the archive (adding a new file, deleting file(s), modifying the global or a file comment).

bool | GetAutoFlush () const
return the current m_bAutoFlush value

int | GetSystemCompatibility () const
Return the system compatibility of the current archive.

bool | SetSystemCompatibility (int iSystemComp)
Set the system compatibility of the archive.

void | SetFileHeaderAttr (CZipFileHeader &header, DWORD uAttr)
Set the attributes for CZipFileHeader structure to be used in OpenNewFile method as an argument.

CZipStorage * GetStorage ()
Return the underlying archive storage medium.

void | SetDetectZlibMemoryLeaks (bool bDetect)
Set m_bDetectZlibMemoryLeaks value.

void | SetConvertAfterOpen (bool bConvertAfterOpen)
Set CZipCentralDir::m_bConvertAfterOpen value.

void | EnableFindFast (bool bEnable=true)
Enable fast finding by the file name of the files inside the archive.

int | GetFindFastIndex (int iFindFastIndex) const
After you enable FindFast feature with EnableFindFast, you can retrieve how the files are sorted in CZipCentralDir::m_findarray (you can use it in your own program if you need to display the sorted list and do not want to duplicate data).

void | SetTempPath (LPCTSTR lpszPath=NULL, bool bForce=true)
Set a temporary path used when compressing files and zipsmCheckForEff is specified as an argument in AddNewFile and the disk spanning archive is in creation.

CZipString | PredictFileNameInZip (LPCTSTR lpszFilePath, bool bFullPath, int iWhat=prAuto, bool bExactly=false) const
Given the file path in the form it would be passed to AddNewFile as lpszFilePath argument, the function returns the file name as it would be stored in the archive.

int | WillBeDuplicated (LPCTSTR lpszFilePath, bool bFullPath, bool bFileNameOnly=false, int iWhat=prAuto)
Check if the filename will be duplicted in the archive, if added to the archive in the given form.

CZipString | PredictExtractedFileName (LPCTSTR lpszFileNameInZip, LPCTSTR lpszPath, bool bFullPath, LPCTSTR lpszNewName=NULL) const
Predict the full filename with path after extraction.

CZipString | GetTempPath () const
Return the current value of m_szTempPath.

CZipString | TrimRootPath (CZipPathComponent &zpc) const
Function used in conjunction with m_szRootPath to trim paths in AddNewFile and ExtractFile.

void | SetCaseSensitivity (bool bCaseSensitive)
Set the default archive case-sensitivity.

void | GetCentralDirInfo (CZipCentralDir::Info &info) const
Return the central directory information.

DWORD | GetCentralDirSize (bool bWhole=true) const
Get the central directory size.

bool | IsReadOnly ()
return true if the archive cannot be modified, because it is an existing disk spanning archive or it was opened with zipOpenReadOnly

void | SetIgnoreCRC (bool bIgnore=true)
If you set bIgnore to true, CRC is not checked for the files being tested or extracted.

void | FindMatches (LPCTSTR lpszPattern, CZipWordArray &ar, bool bFullPath=true) const
This function finds the indexes of the files, which filenames match the specified pattern and stores these indexes in the array.

bool | RenameFile (WORD uIndex, LPCTSTR lpszNewName)
Change the name of the file with the given index.

Static Public Member Functions

int | SingleToWide (const CZipAutoBuffer &szSingle, CZipString &szWide)
In non-UNICODE version just copy szSingle to szWide.

int | WideToSingle (LPCTSTR lpWide, CZipAutoBuffer &szSingle)
In non-UNICODE version just copy lpWide to szSingle.

const DWORD * | GetCRCTable ()
A helper for a various purposes (needed e.g.

bool | RemovePathBeginning (LPCTSTR lpszBeginning, CZipString &szPath, ZIPSTRINGCOMPARE pCompareFunction)
Remove lpszBeginning from the beginning of the szPath.

Public Attributes

bool | m_bRemoveDriveLetter
If true, the drive letter is removed from the filename stored inside the archive when adding a new file to the archive.

Protected Types

typedef CZipPtrList< void
* >::iterator 		CZipPtrListIter
enum | OpenFileType { extract = -1, nothing, compress }
The open mode of the current file inside archive. More...

Protected Member Functions

void | MakeSpaceForReplace (int iReplaceIndex, DWORD uTotal, LPCTSTR lpszFileName)
void | WriteCentralDirectory (bool bFlush=true)
Write central directory calling a callback functor if available.

void | OpenInternal (int iMode)
Open the archive in the given mode.

void | EmptyPtrList ()
Free the memory allocated by the zlib library that hasn't been freed due to an error in the zlib library (usually never happens).

void | MovePackedFiles (DWORD uStartOffset, DWORD uEndOffset, DWORD uMoveBy, CZipActionCallback *pCallback, bool bForward=false)
Move the range of data in the archive specified by the uStartOffset and uEndOffset by uToMove.

bool | RemoveLast (bool bRemoveAnyway=false)
Remove recently added file (used by AddNewFile) if compressed is larger than uncompressed or if callback method return false.

bool | GetFromArchive (CZipArchive &zip, WORD uIndex, int iReplaceIndex, bool bKeepSystComp, CZipActionCallback *pCallback)
It is used in GetFromArchive public functions and in AddNewFile and the callback parameter is needed.

bool | UpdateReplaceIndex (int &iReplaceIndex, LPCTSTR lpszNewFileName)
CZipFileHeader * CurrentFile ()
void | CheckForError (int iErr)
If the parameter iErr signalizes a zlib library error, throw CZipException.

void | ThrowError (int err, bool bZlib=false)
Throw a CZipException error.

void | CryptDecodeBuffer (DWORD uCount)
Decode uCount bytes from the internal buffer.

void | CryptEncodeBuffer ()
Encode the internal buffer.

void | CryptEncode (char &c)
Encode the character c and update encryption keys .

void | CryptCryptHeader (long iCrc, CZipAutoBuffer &buf)
Create an encryption header for the new file in the archive.

DWORD | CryptCRC32 (DWORD l, char c)
void | CryptDecode (char &c)
Decode the character c and update encryption keys .

char | CryptDecryptByte ()
bool | CryptCheck ()
Decrypt the encryption header and check its control value.

void | CryptUpdateKeys (char c)
Update encryption keys with the given value.

void | CryptInitKeys ()
Initialize encryption keys .

Static Protected Member Functions

void * | _zliballoc (void *opaque, UINT items, UINT size)
memory allocator called by the zlib library

void | _zlibfree (void *opaque, void *address)
memory deallocator called by the zlib library

Protected Attributes

CZipClbckStrg m_callbacks
bool | m_bCaseSensitive
Default archive case-sensitivity.

ZIPSTRINGCOMPARE | m_pZipCompare
a pointer to the function in CZipString structure, used to compare elements; can point to Compare, CompareNoCase, Collate or CollateNoCase function address in CZipString structure ZIPSTRINGCOMPARE is defined as follows:
typedef int (CZipString::*ZIPSTRINGCOMPARE)( LPCTSTR ) const;

CZipInternalInfo m_info
Internal data.

CZipStorage m_storage
Physical layer of the archive.

CZipCentralDir m_centralDir
A central directory object.

char | m_iFileOpened
Takes one of the OpenFileType enum values.

bool | m_bAutoFlush
The current AutoFlush value.

bool | m_bIgnoreCRC
The value set with SetIgnoreCRC.

CZipString | m_szRootPath
The root path to be omitted in AddNewFile and ExtractFile functions from the beginning of the full file path.

CZipString | m_szTempPath
A temporary path set with SetTempPath function.

int | m_iArchiveSystCompatib
The system code of the current archive.

CZipPtrList< void * > | m_list
a list holding pointers to the memory areas allocated by the zlib library

bool | m_bDetectZlibMemoryLeaks
Specify whether to control memory allocation and freeing by the zlib library.

CZipAutoBuffer m_pszPassword
The archive password.

DWORD | m_keys [3]
Encryption keys.

Static Protected Attributes

const TCHAR | m_gszCopyright []
Copyright string.

Detailed Description

The representation of the zip archive file.

This class provides all the operations on the zip archive.

Definition at line 219 of file ZipArchive.h.

Member Enumeration Documentation

enum CZipArchive::CallbackType

Enum values used as iWhich parameter in SetCallback function.

You can assign several values to the same functor (OR them)

See also:
CZipActionCallback
Enumeration values:
cbNothing | you can use it for your own purposes
cbAdd | called when adding a file with one of AddNewFile functions
cbAddTmp | and if just compressed file is being moved from a temporary place (file or memory) to the archive
cbAddStore | smartness level must contain CZipArchive::zipsmCheckForEff or CZipArchive::zipsmCheckForEffInMem; the archive can be disk-spanning or not
cbExtract | called when extracting a file with one of ExtractFile functions
cbDeleteCnt | called before the actual deletion takes place and the map of holes and continuous areas is being created (it safe to break it by returning false from the callback method)
cbDelete | called when moving data while deleting file(s) with function DeleteFile or one of DeleteFiles functions
cbTest | called when testing a file with TestFile function
cbSave | the central directory will be removed from disk
cbGetFromArchive | called when using one of GetFromArchive methods
cbRename | called when during the renaming a file there is a need to make less or more space for the new filename
cbReplace | called when moving data while replacing files to make less or more space for the new file
cbNextValue | for CZipActionCallback overrides and user defined callbacks
cbSubActions | sub actions - they are part of bigger actions (cbAddTmp | cbAddStore | cbDeleteCnt | cbReplace)
cbActions | main actions (cbAdd | cbExtract | cbDelete | cbTest | cbSave | cbGetFromArchive | cbRename)
cbAll | assign all callbacks to the same functor

Definition at line 345 of file ZipArchive.h.

enum CZipArchive::CloseAfterException

values used in Close function as parameter iAfterException

Enumeration values:
afNoException | normal close, no exception was thrown before by CZipArchive object
afAfterException | an exception has been thrown, don't write any data but perform necessary cleaning to reuse CZipArchive object for another archive
afWriteDir | been added properly and maybe try to repair the archive later

Definition at line 1132 of file ZipArchive.h.

enum CZipArchive::FFCaseSens

case-sensitivity values used as argument iCaseSensitive in FindFile

Enumeration values:
ffDefault | if CZipCentralDir::m_findarray was build before with a different case-sensitivity, it is rebuild again, if it hasn't been build so far, it is build now with the default case-sensitivity
ffCaseSens | a less effective search is perfomed); does not rebuild CZipCentralDir::m_findarray, but if the array hasn't been built yet, it is build now as non-case-sensitive (you can use SetCaseSensitivity(true) and then ffDefault to build it as case-sensitive)
ffNoCaseSens | (you can use SetCaseSensitivity(false) and then ffDefault to build it as non-case-sensitive)

Definition at line 1055 of file ZipArchive.h.

enum CZipArchive::OpenFileType [protected]

The open mode of the current file inside archive.

Enumeration values:
extract | current file opened for extraction
nothing | no file inside archive opened
compress | a new file opened for compression

Definition at line 1821 of file ZipArchive.h.

enum CZipArchive::OpenMode

Archive open modes used in Open(LPCTSTR , int , int ) and #Open(CZipMemFile, int ) .

Enumeration values:
zipOpen | open an existing archive
zipOpenReadOnly Open an existing archive as a read only file.

This mode is intended to use in a self extract code or opening archive on storage without write access (e.g. CD-ROMS), If you try to modify the archive in this mode, an exception will be thrown.

zipCreate | create a new archive
zipCreateSpan | create a disk spanning archive

Definition at line 424 of file ZipArchive.h.

enum CZipArchive::Predict

enum values used in PredictFileNameInZip

Enumeration values:
prDir | if an argument is a directory, add a separator at the end
prFile | treat the argument as a common file
prAuto | treat the argument as a directory only if it has a path separator at the end

Definition at line 1385 of file ZipArchive.h.

enum CZipArchive::Smartness

The levels of smartness of the adding files action (see AddNewFile).

Note:
If you wish to use zipsmCheckForEff, you should use zipsmNotCompSmall as well, because it will save you the time ( the small file will be surely larger after compression, so that we can add it not compressed straight away);the compression level is always ignored for a directory and set to 0
Enumeration values:
zipsmLazy | do not bother (you know what you're doing after all)
zipsmCPassDir | clear password for directories
zipsmCPFile0 | clear password for files of 0 size
zipsmNotCompSmall | do not compress files smaller than 5 bytes (they are always stored larger than uncompressed)
zipsmCheckForEff | in the disk spanning mode, the temporary file is used for that: if the file compression is efficient, the data is not compressed again, but moved from the temporary file to the archive; you can use SetTempPath() to set the path where the file will be created or you can let the library figure it out (the library tries first the system default temporary directory, if it is not present or there is not enough space there, it tries the current directory, if it fails, no temporary file is created and the compression goes the usual way
zipsmMemoryFlag | combine it with zipsmCheckForEff or use zipsmCheckForEffInMem, you can also use this when replacing files see note at CZipAddNewFileInfo::m_iReplaceIndex
zipsmCheckForEffInMem | non-disk spanning archives don't need a temporary file
zipsmSmartPass | smart password policy (a combination of zipsmCPassDir and zipsmCPFile0)
zipsmSmartAdd | smart adding (a combination of zipsmNotCompSmall and zipsmCheckForEff)
zipsmSafeSmart | safe smart (smartest without checking for efficiency)
zipsmSmartest | smart at its best
zipsmInternal01 | for internal use only

Definition at line 529 of file ZipArchive.h.

Member Function Documentation

bool CZipArchive::AddNewFile | ( | CZipMemFile & | mf,
 |  | LPCTSTR | lpszFileNameInZip,
 |  | int | iComprLevel = -1,
 |  | int | iSmartLevel = zipsmSafeSmart,
 |  | unsigned long | nBufSize = 65536
 | ) |

See also:
AddNewFile(CZipAddNewFileInfo& ); the parameters are equivalent to CZipAddNewFileInfo member variables

bool CZipArchive::AddNewFile | ( | LPCTSTR | lpszFilePath,
 |  | LPCTSTR | lpszFileNameInZip,
 |  | int | iComprLevel = -1,
 |  | int | iSmartLevel = zipsmSafeSmart,
 |  | unsigned long | nBufSize = 65536
 | ) |

See also:
AddNewFile(CZipAddNewFileInfo& ); the parameters are equivalent to CZipAddNewFileInfo member variables

bool CZipArchive::AddNewFile | ( | LPCTSTR | lpszFilePath,
 |  | int | iComprLevel = -1,
 |  | bool | bFullPath = true,
 |  | int | iSmartLevel = zipsmSafeSmart,
 |  | unsigned long | nBufSize = 65536
 | ) |

See also:
AddNewFile(CZipAddNewFileInfo& ); the parameters are equivalent to CZipAddNewFileInfo member variables

bool CZipArchive::AddNewFile ( CZipAddNewFileInfo & info )

Add a new file to the archive.

You can set the callback functor with SetCallback.

Parameters:
info see CZipAddNewFileInfo
Returns:
if it returns false then the file was not added, but the internal state allows you to add other files (which is not possible after throwing an exception)
Note:
  • If you abort while adding a file in a non-disk-spanning archive, the added data will be removed from the archive
  • Throws exceptions.
See also:
SetCallback

AddNewFile(LPCTSTR, LPCTSTR, int, int, unsigned long)

AddNewFile(LPCTSTR, int, bool, int, unsigned long)

AddNewFile(CZipMemFile&, LPCTSTR, int, int, unsigned long)

void CZipArchive::CheckForError ( int iErr ) [protected]

If the parameter iErr signalizes a zlib library error, throw CZipException.

Parameters:
iErr a zlib library error to check
Note:
Throws exceptions.

void CZipArchive::Close | ( | int | iAfterException = afNoException,
 |  | bool | bUpdateTimeStamp = false
 | ) |

Close the archive.

Parameters:
iAfterException | one of CloseAfterException enum values
bUpdateTimeStamp | if true, set the modification date of the zip file to the date of the newest file in the archive; in disk-spanning mode only the last archive file will have the time stamp updated; you can use this option even without performing any additional processing on the archive, just open and close it
Note:
Throws exceptions if iAfterException is different from afAfterException

int CZipArchive::CloseFile | ( | LPCTSTR | lpszFilePath = NULL,
 |  | bool | bAfterException = false
 | ) |

Close the file opened for extraction in the archive and copy its date and attributes to the file pointed by lpszFilePath.

Parameters:
lpszFilePath | Points to the path of the file to have the date and attributes information updated.
bAfterException | Set to true to close the file inside archive after an exception has been thrown, to allow futher operations on the archive.
Warning:
Close the file pointed by lpszFilePath before using this method, because the system may not be able to retrieve information from it.
Returns:

  • "1" = ok
  • "-1" = some bytes left to uncompress - probably due to a bad password or corrupted archive
  • "-2" = setting extracted file date and attributes was not successful
Note:
Throws exceptions.

int CZipArchive::CloseFile ( CZipFile & file )

The same as CZipArchive::CloseFile(LPCTSTR), but additionally closes file.

Parameters:
file OPENED CZipFile structure of the extracted file
Returns:
Note:
Throws exceptions.
See also:
CZipArchive::CloseFile(LPCTSTR)

void CZipArchive::CloseFileWithNoUpdate ( )

Perform the necessary cleanup after an exception was thrown while testing or extracting the archive so that next files in the archive can be tested or extracted.

Called by TestFile. Does not remove the file headers information from the central directory. You can use this method after you have extracted only part of the file (not entire file) and you wish to close it.

See also:
TestFile

CZipCentralDir::Clear

bool CZipArchive::CloseNewFile ( bool bAfterException = false )

Close the new file in the archive.

Returns:
false if there is no new file opened
Parameters:
bAfterException it will close the new file without writing anything (call it also with this parameter set to true after an exception other than CZipException::abortedSafely was thrown from one of AddNewFile functions)
Note:
Throws exceptions.
See also:
OpenNewFile

CZipFileHeader* CZipArchive::CurrentFile ( ) [protected]

Returns:
the currently opened for compression or decompression file inside the archive NULL if there is no file opened

void CZipArchive::DeleteFile ( WORD uIndex )

Delete the file from the archive with the given index.

You can set the callback functor with SetCallback. If you plan to delete more than one file, use one of DeleteFiles functions rather than calling DeleteFile successively, because these functions are optimized for deleting multiple files

Parameters:
uIndex a zero-based index
Note:
Throws exceptions.
See also:
SetCallback

DeleteFiles(CZipWordArray&)

DeleteFiles(const CZipStringArray&)

FindMatches

void CZipArchive::DeleteFiles ( const CZipStringArray & aNames )

Delete files from the archive.

You can set the callback functor with SetCallback.

Parameters:
aNames an array of filenames inside the archive;
Note:
  • Set the case-sensitivity with SetCaseSensitivity
  • Enables FindFast if not enabled
  • Throws exceptions.
See also:
SetCallback

DeleteFile

DeleteFiles(CZipWordArray&)

EnableFindFast

void CZipArchive::DeleteFiles ( CZipWordArray & aIndexes )

Delete files from the archive.

You can set the callback functor with SetCallback. Sorts aIndexes array in an ascending order.

Parameters:
aIndexes an array of zero-based indexes of the files inside the archive
Note:
  • To remove files which filenames match a specified pattern, use FindMatches function
  • Throws exceptions.
See also:
SetCallback

DeleteFile

DeleteFiles(const CZipStringArray& )

FindMatches

void CZipArchive::EnableFindFast ( bool bEnable = true )

Enable fast finding by the file name of the files inside the archive.

Set CZipCentralDir::m_bFindFastEnabled to true, which is required by FindFile. #FindFileIt is called by #FindFileif necessary. It builds CZipCentralDir::m_findarray with the default case-sensitivity (set with SetCaseSensitivity)

Note:
Call it only after opening the archive.
Parameters:
bEnable
See also:
CZipCentralDir::m_bFindFastEnabled

FindFile

bool CZipArchive::ExtractFile | ( | WORD | uIndex,
 |  | CZipMemFile & | mf,
 |  | bool | bRewind = true,
 |  | DWORD | nBufSize = 65536
 | ) |

The same as ExtractFile(WORD , LPCTSTR , bool , LPCTSTR , DWORD ) but instead to a physical file, this function decompress the data into CZipMemFile object.

Parameters:
uIndex | the index of the file to extract
mf | the memory file to receive decompressed data
bRewind | if true, the current memory file pointer is positioned at the beginning of the compressed data after compression (even if it was aborted, but not if other exception than CZipException::abortedAction or CZipException::abortedSafely was thrown in the meantime)
Note:
  • if you pass CZipMemFile object already with data, its contents are NOT overwirtten, but the decompressed data is appended at the end
  • if you try to extract a directory, the function will return false

bool CZipArchive::ExtractFile | ( | WORD | uIndex,
 |  | LPCTSTR | lpszPath,
 |  | bool | bFullPath = true,
 |  | LPCTSTR | lpszNewName = NULL,
 |  | DWORD | nBufSize = 65536
 | ) |

Extract the file from the archive.

You can set the callback functor with SetCallback. The argument lpszNewName may point to the full path and is influenced by bFullPath argument (if lpszNewName contains drive specification then it is removed)

Parameters:
uIndex | the index of the file to extract
lpszPath
        The PATH only to extract the file to. May not be NULL. If you wish to
        use UNC path you need to replace \\\\ at the beginning of UNC path with \\\\?\UNC\ .
bFullPath
  • if true, then extract with the full path - in this case the resulting file path is lpszPath plus the path stored in the archive or plus lpszNewName if lpszNewName is not NULL.
  • if false, the destination file path is lpszPath + the filename only extracted from the path stored in the archive or from lpszNewName if lpszNewName is specified;
    if m_szRootPath is set previously with SetRootPath then to lpszPath is added the path stored in the archive (or lpszNewName if lpszNewName is specified) that has removed the beginning that equals m_szRootPath (if there is no common beginning then is behaves like m_szRootPath was empty)
lpszNewName | The new name of the file after extraction. If NULL the original filename stored in the archive is used. May point to the full path but, if bFullPath is false, only the filename is extracted from this argument,
nBufSize | the size of the buffer used while file operations
Returns:
true if successful
Note:
  • To extract files which filenames match a specified pattern, use FindMatches function
  • Throws exceptions.
See also:
SetCallback

ExtractFile(WORD, CZipMemFile&, DWORD)

FindMatches

int CZipArchive::FindFile | ( | LPCTSTR | lpszFileName,
 |  | int | iCaseSensitive = ffDefault,
 |  | bool | bFileNameOnly = false
 | ) |

Find the file in the archive.

If the archive wasn't opened with CZipCentralDir::m_bConvertAfterOpen set to true, this function automatically convert all the filenames with the function CZipCentralDir::ConvertAll and set CZipCentralDir::m_bConvertAfterOpen to true. This function requires FindFast feature enabled.

Parameters:
lpszFileName | the name of the file to be found in the archive; must be with path unless you set bFileNameOnly to true. Use path separators the same as they are for your system ("\" for Windows and "/" for Unix/Linux)
iCaseSensitive | can be one of FFCaseSens values
bFileNameOnly | if true, the function tries to find a filename without a path (a less effective search is performed); if you wish to find a directory name, do not end it with the path separator, which is required if you set bFileName to false
Returns:

  • the index of the file found
  • -1 if there is no such a file in the archive
See also:
CZipCentralDir::FindFileNameIndex

EnableFindFast

CZipCentralDir::ConvertAll

SetConvertAfterOpen

void CZipArchive::FindMatches | ( | LPCTSTR | lpszPattern,
 |  | CZipWordArray & | ar,
 |  | bool | bFullPath = true
 | ) | const

This function finds the indexes of the files, which filenames match the specified pattern and stores these indexes in the array.

The indexes can be used then e.g. in deleting (CZipArchive::DeleteFiles) or extracting files (CZipArchive::ExtractFile).

Parameters:
lpszPattern | the pattern to match (see CWildcard::SetPattern on how to build the pattern). The case-sensitivity of the pattern is set to the global archive case-sensitivity (set with SetCaseSensitivity)
ar | the array which will contain the indexes of the files which filenames match the pattern; the contents of the array are NOT clearead, but the indexes are appended to it
bFullPath
  • if true, match the filename with path (if present) of the file (if the file is a directory, end it with the path separator or use a pattern that will recognize it)
  • otherwise match only the name of the file (if the file is a directory, do not end it with the path separator)

void CZipArchive::Flush ( )

Write the central directory to the archive and flushes the internal buffers to the disk, so that the archive is finalized on the disk, but you can still modify it.

Use it after opening (or creating) and modifying the archive if you want to prevent the loss of the data you've compressed so far in case of the program crash.
If you use it on a disk spanning archive in creation it will not be closed, but its state will be changed from "archive in creation" to "an existing span archive". Use it when you finish adding files to the disk-spanning archive and want to begin extracting or testing it. It follows that you can call it only once in this case. However, if after finalizing the disk spanning archive it turns out that it is one disk only, it is converted to a normal archive and you can use it as such. If you want to know what is the state of the archive after using this function call GetSpanMode.

Note:
  • Cannot be used on existing disk spanning archives (they are not modifable anyway)
  • If you have an archive with a huge central directory, it'll influence the perfomance calling this function without a reason.
  • Throws exceptions.
See also:
GetSpanMode

SetAutoFlush

GetAutoFlush

CZipString CZipArchive::GetArchivePath ( ) const

Returns:
the path of the currently opened archive volume

bool CZipArchive::GetAutoFlush ( ) const [inline]

return the current m_bAutoFlush value

See also:
Flush

SetAutoFlush

Definition at line 1205 of file ZipArchive.h.

CZipActionCallback* CZipArchive::GetCallback ( CallbackType iWhich ) [inline]

Returns:
the callback iWhich set with SetCallback

Definition at line 395 of file ZipArchive.h.

void CZipArchive::GetCentralDirInfo ( CZipCentralDir::Info & info ) const

Return the central directory information.

See also:
GetCentralDirSize

DWORD CZipArchive::GetCentralDirSize ( bool bWhole = true ) const [inline]

Get the central directory size.

See also:
CZipCentralDir::GetSize

GetCentralDirInfo

Definition at line 1510 of file ZipArchive.h.

int CZipArchive::GetCount ( bool bOnlyFiles = false ) const [inline]

Parameters:
bOnlyFiles if true, the directories are not inluded in a total count; default is false
Returns:
the number of files in the archive

Definition at line 1114 of file ZipArchive.h.

const DWORD* CZipArchive::GetCRCTable ( ) [inline, static]

A helper for a various purposes (needed e.g.

by the program that cracks the zip archives password)

Returns:
the pointer to the static CRC table in the zlib library

Definition at line 1266 of file ZipArchive.h.

int CZipArchive::GetCurrentDisk ( ) const

Returns:

  • a one-based number of the current disk
  • 0 if there is no current disk (the archive is closed)
Note:
Useful mostly while working with the disk-spanning archive in creation to find out how many disks were already created. To find out how many disks are in an existing disk-spanning archive, use the function GetCentralDirInfo

bool CZipArchive::GetFileInfo | ( | CZipFileHeader & | fhInfo,
 |  | WORD | uIndex
 | ) | const

Get the info of the file with the given index.

Parameters:
fhInfo | the structure to receive info
uIndex | a zero-based index of the file inside the archive
Returns:
true if successful

int CZipArchive::GetFindFastIndex ( int iFindFastIndex ) const [inline]

After you enable FindFast feature with EnableFindFast, you can retrieve how the files are sorted in CZipCentralDir::m_findarray (you can use it in your own program if you need to display the sorted list and do not want to duplicate data).

Parameters:
iFindFastIndex index in CZipCentralDir::m_findarray (not necessary the same as the one you'd pass to GetFileInfo); the number of items in this array is the same as the number of files in the archive (you can retrieve it with GetCount)
Returns:
index of the file in central directory (now you can call GetFileInfo to get the information); if the value is -1 then you have not called EnableFindFast before or the archive is closed or the iFindFastIndex is out of range)

Definition at line 1353 of file ZipArchive.h.

bool CZipArchive::GetFromArchive | ( | CZipArchive & | zip,
 |  | CZipStringArray & | aNames,
 |  | bool | bKeepSystComp = false
 | ) | [inline]

Acquire files with the given indexes from another archive.

Parameters:
aNames an array of filenames inside the zip archive;
See also:
GetFromArchive(CZipArchive& , WORD, int, bool)

EnableFindFast

Note:
  • Set the case-sensitivity with SetCaseSensitivity
  • Enables FindFast if not enabled

Definition at line 770 of file ZipArchive.h.

References GetIndexes().

bool CZipArchive::GetFromArchive | ( | CZipArchive & | zip,
 |  | CZipWordArray & | aIndexes,
 |  | bool | bKeepSystComp = false
 | ) |

Acquire files with the given indexes from another archive.

Parameters:
aIndexes an array of zero-based indexes of the files inside the zip archive
See also:
GetFromArchive(CZipArchive& , WORD, int, bool)
Note:
  • To get files which filenames match a specified pattern, use FindMatches function

bool CZipArchive::GetFromArchive | ( | CZipArchive & | zip,
 |  | WORD | uIndex,
 |  | int | iReplaceIndex = -1,
 |  | bool | bKeepSystComp = false
 | ) | [inline]

Acquire a file with the given index from another archive.

The compressed data of the file from another archive are copied without decompressing to the current archive. You can set the callback functor with SetCallback.

Parameters:
zip | an opened archive to get the file from (must not be multi-disk)
uIndex | a zero-based index of the file to get from the zip archive
iReplaceIndex | the same as CZipAddNewFileInfo::m_iReplaceIndex
bKeepSystComp | if false, which is default, then the file from zip archive system compatibility is converted to the current archive system compatibility (if they differ)
Returns:
false if the operation could not be performed (either of archives is closed, a file inside either of archives is opened, zip archive is multi-disk or the current archive is an existing multi-disk archive)
Note:
Throws exceptions
(when an exception is thrown, you may need to call CloseNewFile with bAfterException set to true, to make the archive reusable).

it is safe to abort the action (by returning false from the callback call) in non-disk spanning archive and when no replacing is taking place (the file not entirely added is removed from the archive)

See also:
SetCallback

GetFromArchive(CZipArchive& , CZipWordArray &, bool)

GetFromArchive(CZipArchive& , CZipStringArray &, bool)

FindMatches

SetAdvanced

Definition at line 722 of file ZipArchive.h.

CZipString CZipArchive::GetGlobalComment ( ) const

Returns:
the global comment or an empty string if the archive is closed

void CZipArchive::GetIndexes | ( | const CZipStringArray & | aNames,
 |  | CZipWordArray & | aIndexes
 | ) |

Get indexes of the files stored int aNames array and put them into aIndexes.

Parameters:
aNames | an array of filenames inside the archive;
aIndexes | an array of indexes to be build
Note:
  • Set the case-sensitivity with SetCaseSensitivity
  • Enables FindFast if not enabled

Referenced by GetFromArchive().

int CZipArchive::GetLocalExtraField | ( | char * | pBuf,
 |  | int | iSize
 | ) | const

Get the local extra filed of the currently opened for extraction file in the archive.

Parameters:
pBuf | the buffer to receive the data
iSize | the size of the buffer
Returns:
If pBuf is NULL or iSize is 0, returns the size of the local extra field. Returns -1 if there is no file opened for the extraction.

CZipString CZipArchive::GetPassword ( ) const

Returns:
the current archive password or an empty string if there is no password

CZipString CZipArchive::GetRootPath ( ) const [inline]

Return the current value of m_szRootPath.

Returns:
CZipString

Definition at line 515 of file ZipArchive.h.

int CZipArchive::GetSpanMode ( ) const [inline]

Return the disk spanning mode of the current archive.

Returns:

  • -2 - existing TD mode compatible disk spanning archive
  • -1 - existing PKZIP compatible
  • 0 - no disk spanning
  • 1 - PKZIP compatible in creation
  • 2 - TD compatible in creation
See also:
PKSpan, TDSpan

Definition at line 1047 of file ZipArchive.h.

CZipStorage* CZipArchive::GetStorage ( ) [inline]

Return the underlying archive storage medium.

Warning:
A method for a very advanced use - you normally never need it.
Returns:
the pointer to m_storage
See also:
CZipStorage

Definition at line 1277 of file ZipArchive.h.

int CZipArchive::GetSystemCompatibility ( ) const [inline]

Return the system compatibility of the current archive.

System compatibility value for the single file in the archive (represented by CZipFileHeader) influences file attributes conversion (the file attributes are defined differently across the platforms). When opening an existing archive CZipArchive assumes the system compatibility of the whole archive to be the same as of the first file in the archive (if present). In other cases the current system value is assumed which is taken from ZipPlatform::GetSystemID during creating or opening an archive

Remarks:
If the existing archive during opening is empty, ZipPlatform::GetSystemID is assumed to be the default system for the files that will be added to the archive.
Returns:
one of the enum values defined in ZipCompatibility.h
See also:
ZipCompatibility::ZipPlatforms

ZipPlatform::GetSystemID

CZipFileHeader::GetSystemCompatibility

Definition at line 1227 of file ZipArchive.h.

CZipString CZipArchive::GetTempPath ( ) const [inline]

Return the current value of m_szTempPath.

Returns:
CZipString

Definition at line 1447 of file ZipArchive.h.

bool CZipArchive::IsClosed ( bool bArchive = true ) const

Test if the archive is closed (a whole or the current volume only).

Parameters:
bArchive
  • true: test for the whole archive
  • false: test for the volume file only
Returns:
true if closed

void CZipArchive::MakeSpaceForReplace | ( | int | iReplaceIndex,
 |  | DWORD | uTotal,
 |  | LPCTSTR | lpszFileName
 | ) | [protected]

Parameters:
iReplaceIndex | index of file to be replaced
uTotal | the size of the new file to replace existing
lpszFileName | the filename for callback initialization

void CZipArchive::Open | ( | CZipMemFile & | mf,
 |  | int | iMode = zipOpen
 | ) |

Open or create the archive in memory.

The CZipMemFile object is not closed after closing the archive, so that is it possible to work with it afterwards.

Parameters:
mf CZipMemFile structure to create archive in or extract from
Note:
This is important: you shouldn't destroy CZipMemFile object before closing the archive, because you'll get an error;
Parameters:
iMode Open mode. The following modes are valid: zipOpen, zipOpenReadOnly, zipCreate
Note:
Throws exceptions.
See also:
Open(LPCTSTR, int, int);

void CZipArchive::Open | ( | LPCTSTR | szPathName,
 |  | int | iMode = zipOpen,
 |  | int | iVolumeSize = 0
 | ) |

Open or create a zip archive.

The archive creation mode depends on iMode and iVolumesSize values:

  • if iMode == zipCreateSpan and iVolumeSize <= 0 then create disk spanning archive in PKZIP compatible mode (pkzipSpan)
  • if iMode == zipCreateSpan and iVolumeSize > 0 then create disk spanning archive in TD compatible mode (tdSpan)
  • if iMode == zipOpen and the existing archive is a spanned archive then pkzipSpan mode is assumed if the archive is on a removable device or tdSpan otherwise;
    if you want to open tdSpan archive on a removable device, set iVolumeSize to a value different from 0
  • if iMode == zipCreate then iVolumeSize doesn't matter

Parameters:
szPathName | the path to the archive
iMode | one of the OpenMode values
iVolumeSize | the volume size in the disk spanning archive; the size of the volume may be from 1 to INT_MAX , and the bigger - the faster is creation and extraction (no file changes between volumes) - but the size of the whole archive is the same. If you're creating disk-spanning archive in TD span compatible mode and plan later to convert it to PKZIP compatible mode (see Multi-disk archives), it is good to set this this value to about the size of the diskette (a little less just in case).
Note:
Throws exceptions.
See also:
Open(CZipMemFile&, int);

GetSpanMode

bool CZipArchive::OpenFile ( WORD uIndex )

Open the file with the given index in the archive for extracting.

Not successful opening the file doesn't lock the whole archive, so you can try to open another one (after catching an exception if it was thrown). Throw exception CZipException::badPassword if the password was not set for the encrypted file.

Parameters:
uIndex the index of the file
Returns:
true if successful
Note:
Throws exceptions.

void CZipArchive::OpenInternal ( int iMode ) [protected]

Open the archive in the given mode.

Called by Open(LPCTSTR, int, int) and Open(CZipMemFile&, int).

Parameters:
iMode an opening mode
Note:
Throws exceptions.

bool CZipArchive::OpenNewFile | ( | CZipFileHeader & | header,
 |  | int | iLevel = Z_DEFAULT_COMPRESSION,
 |  | LPCTSTR | lpszFilePath = NULL,
 |  | DWORD | uInternal = 0
 | ) |

Add a new file to the opened zip archive.

The zip archive cannot be an existing disk spanning archive (existing at the moment of opening archive), because modifying such an archive is not possible (at least not with this version ).

Parameters:
header The structure that provides additional information about the added file. The following fields are valid:
  • m_uMethod - file compression method; can be 0 (storing) or Z_DEFLATE (deflating) otherwise Z_DEFLATE is assumed
  • m_uModDate, m_uModTime - Use CZipFileHeader::SetTime to set them. If lpszFilePath is not NULL this fields are overwritten and updated automatically. See CZipFileHeader::SetTime
  • m_uExternalAttr - Attributes of the file. If lpszFilePath is not NULL this field is overwritten and updated automatically. Use SetFileHeaderAttr to set them. See SetFileHeaderAttr.
  • m_szFileName - A filename (may be with path) to be stored inside archive to represent this file. See CZipFileHeader::SetFileName
  • m_szComment - A file comment. See CZipFileHeader::SetComment
  • m_pExtraField - LOCAL extra field, use SetExtraField after opening a new file, but before closing it to set the not local extra field in the header in the central directory. See SetExtraField
    Other fields are ignored - they are updated automatically. If the function returns true, system compatibility for this object is set to the correct value (the same as m_iArchiveSystCompatib), additionally if lpszFilePath was not NULL, the attributes and the time fields are filled with information retrieved from the file pointed by lpszFilePath.
iLevel The level of compression (-1, 0 - 9). The are several preset values for the compression level:
  • Z_DEFAULT_COMPRESSION : -1 (equals 6)
  • Z_NO_COMPRESSION : 0
  • Z_BEST_SPEED : 1
  • Z_BEST_COMPRESSION : 9
lpszFilePath | The path to the file to retrieve date stamp and attributes from. These values are stored inside the archive.
uInternal | for internal use only
Returns:
false in the following cases:
  • the lpszFilePath is not NULL and the file attributes and data was not correctly retrieved
  • a file is already opened for extraction or compression
  • archive is an existing disk span archive
  • maximum file count inside archive already reached (65536)
Note:
Throws exceptions.

CZipString CZipArchive::PredictExtractedFileName | ( | LPCTSTR | lpszFileNameInZip,
 |  | LPCTSTR | lpszPath,
 |  | bool | bFullPath,
 |  | LPCTSTR | lpszNewName = NULL
 | ) | const

Predict the full filename with path after extraction.

The parameters (except for the first) are in the form you'd pass to the ExtractFile(WORD , LPCTSTR , bool , LPCTSTR , DWORD ) function. The function takes into account the root path set with SetRootPath.

Parameters:
lpszFileNameInZip the filename of the file inside the archive (may be NULL if lpszNewName is not NULL)
lpszPath
bFullPath
lpszNewName
Returns:
a predicted file path

CZipString CZipArchive::PredictFileNameInZip | ( | LPCTSTR | lpszFilePath,
 |  | bool | bFullPath,
 |  | int | iWhat = prAuto,
 |  | bool | bExactly = false
 | ) | const

Given the file path in the form it would be passed to AddNewFile as lpszFilePath argument, the function returns the file name as it would be stored in the archive.

The function takes into account the root path set with SetRootPath. You can use this function to eliminate duplicates before adding a list of files.

Parameters:
lpszFilePath | the file path as it would be passed to AddNewFile function
bFullPath | the same as bFullPath in AddNewFile
iWhat | one of Predict values to treat lpszFilePath correctly
bExactly | if true, return the filename exactly as it would look inside the archive i.e. convert slash to backslash, and perform ANSI->OEM conversion; otherwise return the filename with the path separators that are used by default in the system
Returns:
a modified file path

DWORD CZipArchive::ReadFile | ( | void * | pBuf,
 |  | DWORD | iSize
 | ) |

Decompress currently opened file to the buffer.

Parameters:
pBuf | buffer to receive data
iSize | the size of the buffer
Returns:
the number of bytes read
See also:
OpenFile
Note:
Throws exceptions.

bool CZipArchive::RemoveLast ( bool bRemoveAnyway = false ) [protected]

Remove recently added file (used by AddNewFile) if compressed is larger than uncompressed or if callback method return false.

Parameters:
bRemoveAnyway if true, do not check for the efficiency, but remove the file

bool CZipArchive::RemovePathBeginning | ( | LPCTSTR | lpszBeginning,
 |  | CZipString & | szPath,
 |  | ZIPSTRINGCOMPARE | pCompareFunction
 | ) | [static]

Remove lpszBeginning from the beginning of the szPath.

Both argument are considered to be paths so they matches up to the path separator.

Parameters:
lpszBeginning
szPath
pCompareFunction (see: m_pZipCompare)
Returns:
true if the path beginning was removed

bool CZipArchive::RenameFile | ( | WORD | uIndex,
 |  | LPCTSTR | lpszNewName
 | ) |

Change the name of the file with the given index.

Parameters:
uIndex | zero-based index of the file
lpszNewName | new name for the file
Returns:
Note:
Throws exceptions.
See also:
SetAdvanced

void CZipArchive::SetAdvanced | ( | int | iWriteBuffer = 65536,
 |  | int | iGeneralBuffer = 65536,
 |  | int | iSearchBuffer = 32768
 | ) |

Set the buffer sizes.

No buffer can be set smaller than 1024. Use this method before opening the archive. The optimal size for the write buffer in the disk spanning archive is the size of the volume.

Parameters:
iWriteBuffer the write cache size used
See also:
CZipStorage::m_iWriteBufferSize
Parameters:
iGeneralBuffer buffer used in extracting, compressing, deleting, getting (GetFromArchive) files, renaming and replacing
See also:
CZipInternalInfo::m_iBufferSize
Parameters:
iSearchBuffer the buffer used in searching for the central dir
See also:
CZipCentralDir::m_iBufferSize

GetAdvanced

void CZipArchive::SetAutoFlush ( bool bAutoFlush = true )

Set the CZipArchive object to call Flush after each operation that modifies the archive (adding a new file, deleting file(s), modifying the global or a file comment).

It is useful when we want to prevent the loss of data in case of the program crash - the zip file will be then finalized on the disk. Use it after opening the archive.

Note:
  • You can set AutoFlush only for non-disk spanning archives, however you can call Flush once for a disk-spanning archive in creation.
  • If you have an archive with a huge central directory, setting Auto-Flush will influence the performance.
See also:
Flush

GetAutoFlush

void CZipArchive::SetCallback | ( | CZipActionCallback * | pCallback = NULL,
 |  | int | iWhich = cbAll
 | ) |

Set callback functors for the following operations on the zip archive: adding, extracting, testing or deleting files.

See Action progress notifications (callbacks) information on how to use functors.

Parameters:
pCallback | the address of the functional object which class is derived from CZipActionCallback (you need to override member function CZipCallback::Callback in the derived class) Set it to NULL to clear callback for the selected actions.
iWhich | can be one or more (use logical OR) CallbackType values.
See also:
CZipActionCallback

GetCallback

void CZipArchive::SetCaseSensitivity ( bool bCaseSensitive ) [inline]

Set the default archive case-sensitivity.

Affects the following functions:

  • FindFile
  • FindMatches
  • EnableFindFast
  • TrimRootPath
  • DeleteFiles

Parameters:
bCaseSensitive the default CZipArchive case-sensitivity depends on the system and is set as follows:
  • on Windows: false
  • on Linux: true
Note:
Set it before using one of the functions above or leave it as it is by default;

Definition at line 1492 of file ZipArchive.h.

void CZipArchive::SetConvertAfterOpen ( bool bConvertAfterOpen ) [inline]

Set CZipCentralDir::m_bConvertAfterOpen value.

The default value is true. Setting this value to false is generally not effective and is intended only for quick and short operations on archives with lots of files inside (e.g. open archive, make an operation on a file which index you already know and close the archive - using FindFile function already makes setting this value to false inefficient)

Parameters:
bConvertAfterOpen
Note:
Use before opening the archive.
See also:
CZipCentralDir::m_bConvertAfterOpen

Definition at line 1311 of file ZipArchive.h.

void CZipArchive::SetDetectZlibMemoryLeaks ( bool bDetect ) [inline]

Set m_bDetectZlibMemoryLeaks value.

Parameters:
bDetect
Note:
Use before opening a file in the archive.
See also:
m_bDetectZlibMemoryLeaks

Definition at line 1287 of file ZipArchive.h.

void CZipArchive::SetExtraField | ( | const char * | pBuf,
 |  | WORD | iSize
 | ) |

Set the extra field in the central directory of the currently opened file.

Must be used after opening a new file in the archive, but before closing it To set the local extra field, set it in the CZipFileHeader structure passed as the argument to the OpenNewFile

Parameters:
pBuf | the bufer with the data to be copied
iSize | the size of the extra field in the buffer
See also:
OpenNewFile

bool CZipArchive::SetFileComment | ( | WORD | uIndex,
 |  | LPCTSTR | lpszComment
 | ) |

Set the comment of the file with the given index inside the archive.

Parameters:
uIndex | zero-based index of the file in the archive
lpszComment | a comment to add
Returns:
false if the comment change is impossible
Note:
Throws exceptions.

void CZipArchive::SetFileHeaderAttr | ( | CZipFileHeader & | header,
 |  | DWORD | uAttr
 | ) |

Set the attributes for CZipFileHeader structure to be used in OpenNewFile method as an argument.

This special procedure is taken, because the system compatibility must be set for CZipFileHeader prior to the value, which must be identical to the return value of GetSystemCompatibility method.

Parameters:
header | the structure to have attributes set
uAttr | attributes to set
Note:
Throws exceptions if the archive system or the current system is not supported by the ZipArchive library.
See also:
GetSystemCompatibility

bool CZipArchive::SetGlobalComment ( LPCTSTR lpszComment )

Set the global comment in the archive.

Parameters:
lpszComment the file comment
Returns:
false if the archive is closed or if it is an existing disk spanning archive
Note:
Throws exceptions.

void CZipArchive::SetIgnoreCRC ( bool bIgnore = true ) [inline]

If you set bIgnore to true, CRC is not checked for the files being tested or extracted.

This method is useful when working with Java TM Archives (jar). The CRC is checked by default. You can use this function on an opened or closed archive.

Definition at line 1529 of file ZipArchive.h.

bool CZipArchive::SetPassword ( LPCTSTR lpszPassword = NULL )

Set the password for the file to be opened or created.

Use this method BEFORE opening or adding a file, but AFTER opening an archive

Parameters:
lpszPassword set it to NULL to clear password
Returns:
false if the password contains ASCII characters with values 128 or higher or the file inside archive is opened

void CZipArchive::SetRootPath ( LPCTSTR szPath = NULL )

Set m_szRootPath to a specified value.

Use it if you don't want to set bFullPath argument in AddNewFile or ExtractFile to true and you don't want to strip the whole path neither, but only a specific beginning. Use it AFTER opening the archive and before using AddNewFile or ExtractFile. See the FAQ for the example of use.

Parameters:
szPath Set it to the string that you want to be omitted from the beginning of the path of the file in the archive
if NULL - clears the m_szRootPath and no path beginning will be matched against it
Note:
Set the case-sensitivity with SetCaseSensitivity
See also:
AddNewFile

ExtractFile

GetRootPath

void CZipArchive::SetSpanCallback ( CZipSpanCallback * pCallback = NULL ) [inline]

Set the callback functor used during operations on a PKZIP compatible disk spanning archive to change disks.

Set it before opening the archive. If you open the archive in the PKZIP compatible mode and don't set the callback functor, the exception CZipException::noCallback will be thrown.

Callback functor's method CZipSpanCallback::Callback is called when there is a need for a disk change. Calling CZipArchive methods from inside this method may result in an unexpected behavior.

Parameters:
pCallback the address of the functional object which class is derived from CZipSpanCallback (you need to override member function CZipCallback::Callback in the derived class) Set it to NULL to clear the callback.
See also:
CZipSpanCallback

Definition at line 416 of file ZipArchive.h.

bool CZipArchive::SetSystemCompatibility ( int iSystemComp )

Set the system compatibility of the archive.

By default it is set to the current system value (the one returned by ZipPlatform::GetSystemID() function). Use it after opening the archive, but before adding a new file or using SetFileHeaderAttr() function

Parameters:
iSystemComp can be one of ZipCompatibility::ZipPlatforms values
Returns:
return false if the value iSystemComp is not supported (ZipCompatibility::IsPlatformSupported returns false for the value) or it is not possible to set it right now

void CZipArchive::SetTempPath | ( | LPCTSTR | lpszPath = NULL,
 |  | bool | bForce = true
 | ) |

Set a temporary path used when compressing files and zipsmCheckForEff is specified as an argument in AddNewFile and the disk spanning archive is in creation.

Parameters:
lpszPath | set it to NULL to clear the temporary path and let the library figure it out (it uses the system temporary directory if possible)
bForce | if lpszPath is not NULL and this parameter set to true the directory is created if it doesn't exists (if the given directory does not exists , the temporary file will not be created)
See also:
AddNewFile

Smartness

GetTempPath

int CZipArchive::SingleToWide | ( | const CZipAutoBuffer & | szSingle,
 |  | CZipString & | szWide
 | ) | [static]

In non-UNICODE version just copy szSingle to szWide.

In UNICODE version works the same way as ZipPlatform::SingleToWide

Parameters:
szSingle
szWide
Returns:
(in non-UNICODE version the number of characters copied)
See also:
ZipPlatform::SingleToWide

bool CZipArchive::TestFile | ( | WORD | uIndex,
 |  | DWORD | uBufSize = 65536
 | ) |

Test the file with the given index for the integrity.

You can set the callback functor with SetCallback. The method throws exceptions but performs all the necessary cleanup before, so that the next file can be tested after catching the exception.

Parameters:
uIndex | index of the file to test
uBufSize | the size of the buffer used during extraction
Returns:
false if the incorrect action has been taken by the user or the programmer (it is when OpenFile or GetFileInfo returned false or uBufSize is 0). If the file didn't passed the test or there was a disk I/O error or the password supplied was incorrect, an exception is thrown.
Note:
Throws exceptions.
See also:
SetCallback

void CZipArchive::ThrowError | ( | int | err,
 |  | bool | bZlib = false
 | ) | [protected]

Throw a CZipException error.

Parameters:
err the error code
See also:
CZipException::ZipErrors
Parameters:
bZlib if true, treat err as a zlib error code and perform the conversion to the one of CZipException codes.
See also:
CZipException::Throw

CZipString CZipArchive::TrimRootPath ( CZipPathComponent & zpc ) const

Function used in conjunction with m_szRootPath to trim paths in AddNewFile and ExtractFile.

Parameters:
zpc
See also:
SetRootPath

bool CZipArchive::UpdateReplaceIndex | ( | int & | iReplaceIndex,
 |  | LPCTSTR | lpszNewFileName
 | ) | [protected]

Returns:
whether the code should continue or not

int CZipArchive::WideToSingle | ( | LPCTSTR | lpWide,
 |  | CZipAutoBuffer & | szSingle
 | ) | [static]

In non-UNICODE version just copy lpWide to szSingle.

In UNICODE version works the same way as ZipPlatform::WideToSingle

Parameters:
lpWide
szSingle
Returns:
(in non-UNICODE version the number of characters copied)
See also:
ZipPlatform::WideToSingle

int CZipArchive::WillBeDuplicated | ( | LPCTSTR | lpszFilePath,
 |  | bool | bFullPath,
 |  | bool | bFileNameOnly = false,
 |  | int | iWhat = prAuto
 | ) |

Check if the filename will be duplicted in the archive, if added to the archive in the given form.

Parameters:
bFileNameOnly if true, assume that the filename is duplicated if only the filename (no path) is the same (bFullPath is ignored), otherwise the whole filename with path is taken into account.
Default: false

The rest of the parameters have the same meaning as in PredictFileNameInZip.

Returns:
the zero-based index of the file in the archive that the filename would be duplicated, or -1, if the filename is unique

bool CZipArchive::WriteNewFile | ( | const void * | pBuf,
 |  | DWORD | iSize
 | ) |

Compress the contents of the buffer and write it to a new file.

Parameters:
pBuf | the buffer containing the data to be compressed and written
iSize | the number of bytes to be written from the buffer
Returns:
false if the new file hasn't been opened yet
Note:
Throws exceptions.
See also:
OpenNewFile

Member Data Documentation

bool CZipArchive::m_bAutoFlush [protected]

The current AutoFlush value.

See also:
Flush

SetAutoFlush

GetAutoFlush

Definition at line 1839 of file ZipArchive.h.

bool CZipArchive::m_bCaseSensitive [protected]

Default archive case-sensitivity.

See also:
SetCaseSensitivity

Definition at line 1789 of file ZipArchive.h.

bool CZipArchive::m_bDetectZlibMemoryLeaks [protected]

Specify whether to control memory allocation and freeing by the zlib library.

Default: true

Note:
Set it before opening a file (new or existing) in the archive.
See also:
SetDetectZlibMemoryLeaks

Definition at line 1958 of file ZipArchive.h.

bool CZipArchive::m_bRemoveDriveLetter

If true, the drive letter is removed from the filename stored inside the archive when adding a new file to the archive.

It affects AddNewFile, ExtractFile, PredictFileNameInZip, PredictExtractedFileName, WillBeDuplicated methods.

Default: true

Definition at line 1698 of file ZipArchive.h.

CZipClbckStrg CZipArchive::m_callbacks [protected]

See also:
CZipClbckStrg

Definition at line 1777 of file ZipArchive.h.

CZipCentralDir CZipArchive::m_centralDir [protected]

A central directory object.

See also:
CZipCentralDir

Definition at line 1816 of file ZipArchive.h.

const TCHAR CZipArchive::m_gszCopyright[] [static, protected]

Copyright string.

Definition at line 1964 of file ZipArchive.h.

int CZipArchive::m_iArchiveSystCompatib [protected]

The system code of the current archive.

All new files in the archive will be created regarding this value. Can be one of the enum values defined in ZipCompatibility.h

See also:
GetSystemCompatibility

Definition at line 1881 of file ZipArchive.h.

char CZipArchive::m_iFileOpened [protected]

Takes one of the OpenFileType enum values.

Definition at line 1831 of file ZipArchive.h.

CZipInternalInfo CZipArchive::m_info [protected]

Internal data.

See also:
CZipInternalInfo

Definition at line 1803 of file ZipArchive.h.

CZipStorage CZipArchive::m_storage [protected]

Physical layer of the archive.

See also:
CZipStorage

Definition at line 1810 of file ZipArchive.h.

CZipString CZipArchive::m_szRootPath [protected]

The root path to be omitted in AddNewFile and ExtractFile functions from the beginning of the full file path.

Set by SetRootPath

See also:
TrimRootPath

SetRootPath

Definition at line 1854 of file ZipArchive.h.

CZipString CZipArchive::m_szTempPath [protected]

A temporary path set with SetTempPath function.

See also:
SetTempPath

AddNewFile

Smartness

Definition at line 1862 of file ZipArchive.h.

The documentation for this class was generated from the following file:
  • ZipArchive.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipArchive::CWildcard Class Reference

A class used in wildcard pattern matching. More...

#include <ZipArchive.h>

List of all members.

Public Types

enum Match {
matchNone, matchValid, matchEnd, matchAbort,
matchRange, matchLiteral, matchPattern
}
enum Pattern {
patternEmpty = -4, patternClose, patternRange, patternEsc,
patternValid
}

Public Member Functions

bool | IsMatch (LPCTSTR lpszText, int *iRetCode=NULL)
Match the pattern against the string lpszText A match means the entire string lpszText is used up in matching.

CWildcard (LPCTSTR lpszPattern, bool bCaseSensitive)
Initialize the pattern.

void | SetPattern (LPCTSTR lpszPattern, bool bCaseSensitive)
Set the pattern to lpszPattern.

operator LPCTSTR ()

Static Public Member Functions

bool | IsPattern (LPCTSTR lpszPattern)
bool | IsPatternValid (LPCTSTR lpszPattern, int *iErrorType=NULL)
Test the pattern for validity.

int | Match (LPCTSTR lpszPattern, LPCTSTR lpszText)
Match the pattern lpszPattern against the string lpszText A match means the entire string lpszText is used up in matching.

Static Protected Member Functions

int | MatchAfterStar (LPCTSTR p, LPCTSTR t)

Protected Attributes

bool | m_bCaseSensitive
CZipString | m_szPattern

Detailed Description

A class used in wildcard pattern matching.

This class is based on code by J. Kercheval, created 01/05/1991 and available as a public domain at http://www.snippets.org.

Definition at line 1536 of file ZipArchive.h.

Member Enumeration Documentation

enum CZipArchive::CWildcard::Match

Enumeration values:
matchNone | for internal use
matchValid | valid match
matchEnd | premature end of pattern string
matchAbort | premature end of text string
matchRange | match failure on [..] construct
matchLiteral | match failure on literal match
matchPattern | bad pattern

Definition at line 1541 of file ZipArchive.h.

enum CZipArchive::CWildcard::Pattern

Enumeration values:
patternEmpty | [..] construct is empty
patternClose | no end bracket in [..] construct
patternRange | malformed range in [..] construct
patternEsc | literal escape at end of pattern
patternValid | valid pattern

Definition at line 1552 of file ZipArchive.h.

Constructor & Destructor Documentation

CZipArchive::CWildcard::CWildcard | ( | LPCTSTR | lpszPattern,
 |  | bool | bCaseSensitive
 | ) | [inline]

Initialize the pattern.

See also:
SetPattern

Definition at line 1615 of file ZipArchive.h.

Member Function Documentation

bool CZipArchive::CWildcard::IsMatch | ( | LPCTSTR | lpszText,
 |  | int * | iRetCode = NULL
 | ) |

Match the pattern against the string lpszText A match means the entire string lpszText is used up in matching.

Parameters:
lpszText | the string to match against
iRetCode | if not NULL, set to one of Match values indicating the return code
Returns:
true if lpszText matches the pattern.
See also:
SetPattern

bool CZipArchive::CWildcard::IsPattern ( LPCTSTR lpszPattern ) [static]

Parameters:
lpszPattern
Returns:
true if lpszPattern has any special wildcard characters.

bool CZipArchive::CWildcard::IsPatternValid | ( | LPCTSTR | lpszPattern,
 |  | int * | iErrorType = NULL
 | ) | [static]

Test the pattern for validity.

Parameters:
lpszPattern | the pattern to test
iErrorType | if not NULL, set to one of Pattern values indicating the return code
Returns:
true if lpszPattern is a well formed regular expression according to the CWildcard class syntax (see SetPattern)

int CZipArchive::CWildcard::Match | ( | LPCTSTR | lpszPattern,
 |  | LPCTSTR | lpszText
 | ) | [static]

Match the pattern lpszPattern against the string lpszText A match means the entire string lpszText is used up in matching.

Parameters:
lpszPattern | see SetPattern
lpszText | the string to match against
Returns:
one of Match values

void CZipArchive::CWildcard::SetPattern | ( | LPCTSTR | lpszPattern,
 |  | bool | bCaseSensitive
 | ) | [inline]

Set the pattern to lpszPattern.

Parameters:
lpszPattern In the pattern string:
  • * matches any sequence of characters(zero or more)
  • ? matches any character
  • [SET] matches any character in the specified set,
  • [!SET] or[^SET] matches any character not in the specified set.
A set is composed of characters or ranges; a range looks like character hyphen character(as in 0 - 9 or A - Z).[0 - 9a - zA - Z_] is the minimal set of characters allowed in the[..] pattern construct. Other characters are allowed(ie. 8 bit characters) if your system will support them.

Note:
To suppress the special syntactic significance of any of []*?!^-\, and match the character exactly, precede it with a \

Definition at line 1640 of file ZipArchive.h.

The documentation for this class was generated from the following file:
  • ZipArchive.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipArchive::CZipClbckStrg Struct Reference

Storage for callback functors. More...

#include <ZipArchive.h>

List of all members.

Public Member Functions

void | Set (CZipActionCallback *pCallback, CallbackType iType)
CZipActionCallback * | Get (CallbackType iType)

Detailed Description

Storage for callback functors.

A structure for the internal use only.

See also:
SetCallback

Definition at line 1748 of file ZipArchive.h.

The documentation for this struct was generated from the following file:
  • ZipArchive.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipArchive::CZipDeleteInfo Struct Reference

Holds map of holes and areas to remain when deleting files from the archive. More...

#include <ZipArchive.h>

List of all members.

Public Member Functions

CZipDeleteInfo (CZipFileHeader *pHeader, bool bDelete)

Public Attributes

CZipFileHeader * | m_pHeader
bool | m_bDelete

Detailed Description

Holds map of holes and areas to remain when deleting files from the archive.

A structure for the internal use only.

Definition at line 1734 of file ZipArchive.h.

The documentation for this struct was generated from the following file:
  • ZipArchive.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipArchive::CZipInternalInfo Struct Reference

The purpose of this structure is to hold the data that allow communication with the zlib library. More...

#include <ZipArchive.h>

List of all members.

Public Member Functions

void | Init ()
Allocate internal buffer of m_iBufferSize size.

void | ReleaseBuf ()

Public Attributes

z_stream | m_stream
zlib library data stream

DWORD | m_uUncomprLeft
bytes left to uncompress

DWORD | m_uComprLeft
bytes left to decompress

DWORD | m_uCrc32
crc32 file control value

DWORD | m_iBufferSize
The size of the buffer used in decompressing data.

CZipAutoBuffer m_pBuffer
This buffer caches data during compression and decompression.

Detailed Description

The purpose of this structure is to hold the data that allow communication with the zlib library.

Definition at line 227 of file ZipArchive.h.

Member Data Documentation

DWORD CZipArchive::CZipInternalInfo::m_iBufferSize

The size of the buffer used in decompressing data.

Set before opening the archive. It is usually set with CZipArchive::SetAdvanced (specify this value as the second argument).

See also:
CZipArchive::SetAdvanced

Definition at line 259 of file ZipArchive.h.

CZipAutoBuffer CZipArchive::CZipInternalInfo::m_pBuffer

This buffer caches data during compression and decompression.

Definition at line 264 of file ZipArchive.h.

The documentation for this struct was generated from the following file:
  • ZipArchive.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipArchive::CZipSmClrPass Struct Reference

A structure for the internal use only. More...

#include <ZipArchive.h>

List of all members.

Public Member Functions

void | ClearPasswordSmartly (CZipArchive *pZip)

Public Attributes

CZipString | m_szPass
CZipArchive * | m_pZip

Detailed Description

A structure for the internal use only.

Clears the password if necessary and restores it later (also in case of an exception).

Definition at line 1712 of file ZipArchive.h.

The documentation for this struct was generated from the following file:
  • ZipArchive.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipAutoBuffer Class Reference

A smart buffer freeing its contents on destruction. More...

#include <ZipAutoBuffer.h>

List of all members.

Public Member Functions

operator char * ()
operator const char * () const
const char * | GetBuffer () const
char * | Allocate (DWORD iSize, bool bZeroMemory=false)
void | Release ()
DWORD | GetSize () const
bool | IsAllocated () const
CZipAutoBuffer (DWORD iSize, bool bZeroMemory=false)
CZipAutoBuffer (const CZipAutoBuffer &buffer)
CZipAutoBuffer & | operator= (const CZipAutoBuffer &buffer)

Protected Attributes

char * | m_pBuffer
DWORD | m_iSize

Detailed Description

A smart buffer freeing its contents on destruction.

Definition at line 34 of file ZipAutoBuffer.h.

The documentation for this class was generated from the following file:
  • ZipAutoBuffer.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipCallback Struct Reference

A base class for functional objects (functors) that are used as a callbacks during various actions. More...

#include <ZipStorage.h>

Inheritance diagram for CZipCallback:

[legend]
List of all members.

Public Member Functions

virtual bool | Callback (int iProgress)=0
Method called as a callback.

Public Attributes

CZipString | m_szExternalFile
if the action (adding, extracting or disk-spanning) uses an external file, its filename is stored here

Detailed Description

A base class for functional objects (functors) that are used as a callbacks during various actions.

You need to derive your own class and overload Callback method to use it. Do not derive from CZipCallback directly but from CZipSpanCallback (as a callback when there is a need for a disk change in a disk-spanning archive) or from CZipActionCallback for other actions.

Definition at line 44 of file ZipStorage.h.

Member Function Documentation

virtual bool CZipCallback::Callback ( int iProgress ) [pure virtual]

Method called as a callback.

Return false from inside the method to abort the current operation. If it is a span callback functor, a CZipException with CZipException::aborted code will be thrown, otherwise the code will be CZipException::abortedAction or CZipException::abortedSafely. The following actions can be safely aborted (without having the archive corrupted):

  • counting bytes before deleting files
  • testing
  • saving central directory on non-disk-spanning archive (saved data is removed in case of break and you can save it again); it the archive is disk-spanning and if saving is aborted, the archive will not be damaged, but saved part of the central directory will be not removed and the new central directory will have to be saved after it

Note:
Overrride this method in the derived class. If you define this method inside the class declaration, it should be inlined by the compiler making the action progress faster.

Referenced by CZipActionCallback::operator()().

The documentation for this struct was generated from the following file:
  • ZipStorage.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipCentralDir Class Reference

A class representing the central directory record in the archive. More...

#include <ZipCentralDir.h>

List of all members.

Public Member Functions

void | Init ()
Called by CZipArchive::OpenInternal.

void | Read ()
Read the central directory from the archive.

void | OpenFile (WORD uIndex)
Open the file.

bool | IsValidIndex (int uIndex) const
Test if the given file header index is valid.

void | RemoveFile (CZipFileHeader *pHeader, int iIndex=-1, bool bShift=true)
Remove the file header from the central directory.

void | RemoveLastFile (CZipFileHeader *pHeader=NULL, int iIndex=-1)
Remove last file from the central directory.

void | RemoveAll ()
Remove all files.

void | Clear (bool bEverything=true)
Cleanup the structure.

CZipFileHeader * | AddNewFile (const CZipFileHeader &header, int iReplaceIndex=-1)
Add a new file to the central directory.

CZipString | GetProperHeaderFileName (const CZipFileHeader *pHeader) const
return the header filename, converted if needed

void | RemoveFromDisk ()
Remove physically the central directory from the archive.

DWORD | GetSize (bool bWhole=false) const
Get the central directory size.

void | CloseFile (bool bAfterException=false)
Close a file inside archive opened for reading.

void | CloseNewFile ()
Close a file inside archive opened for reading.

void | Write (CZipActionCallback *pCallback)
Write the central directory to the archive.

void | EnableFindFast (bool bEnable, bool bCaseSensitive)
int | FindFile (LPCTSTR lpszFileName, bool bCaseSensitive, bool bSporadically, bool bFileNameOnly)
int | GetFindFastIndex (int iFindFastIndex) const
CZipFileHeader * | operator[] (int iIndex)
const CZipFileHeader * | operator[] (int iIndex) const
void | ConvertFileName (bool bFromZip, bool bAfterOpen, CZipFileHeader *pHeader=NULL) const
Convert the filename of the CZipFileHeader depending on the current system and the system the zip file was created on (change slash to backslash or vice versa, perform ANSI-OEM conversion if necessary).

void | ConvertAll ()
Convert all the filenames to the system form.

int | FindFileNameIndex (LPCTSTR lpszFileName) const
DWORD | GetBytesBefore () const
void | GetInfo (Info &info) const
Get the information about the central directory.

bool | IsFindFastEnabled ()
void | RenameFile (WORD uIndex, LPCTSTR lpszNewName)
Called by CZipArchive::RenameFile.

Public Attributes

char | m_szSignature [4]
end of central dir signature (must be 0x06054b50)

CZipAutoBuffer m_pszComment
the archive comment

CZipAutoBuffer m_pLocalExtraField
a local extra field

CZipFileHeader * m_pOpenedFile
points to a currently opened file or NULL if no file is opened

CZipStorage * m_pStorage
Points to CZipArchive::m_storage.

int | m_iBufferSize
The size of the buffer used in searching for the central dir.

CZipArray< CZipFileHeader * > | m_headers
Holds all the files inside archive info.

bool | m_bConvertAfterOpen
  • If true, the conversion of the filenames takes place after opening the archive (after reading the central directory from the file), and before writing the central directory back to the archive.

Static Public Attributes

char | m_gszSignature []
central dir signature

Protected Member Functions

void | SortHeaders ()
Sort the files inside the archive headers by the order in the archive.

void | BuildFindFastArray (bool bCaseSensitive)
Build m_findarray.

int | CompareElement (LPCTSTR lpszFileName, WORD uIndex) const
The lpszFileName and bCaseSensitive arguments are the same as in the FindFileNameIndex.

void | InsertFindFastElement (CZipFileHeader *pHeader, WORD uIndex)
Insert a new CZipFindFast element to the m_findarray.

DWORD | Locate ()
void | ReadHeaders ()
Read the file headers from the file.

void | RemoveHeaders ()
Free the memory allocated for the CZipFileHeader structures.

bool | RemoveDataDescr (bool bFromBuffer)
Remove data descriptors from the write buffer in the disk spanning volume that turned out to be one-disk only.

void | WriteHeaders (CZipActionCallback *pCallback, bool bOneDisk)
Write the file headers to the archive.

DWORD | WriteCentralEnd ()
Write the central directory end record.

void | ThrowError (int err) const
Throw an exception with the given code.

Static Protected Member Functions

int | CompareHeaders (const void *pArg1, const void *pArg2)

Protected Attributes

CZipArray< CZipFindFast > | m_findarray
Used in fast finding files by the filename.

bool | m_bFindFastEnabled
If true, the there is an additional array build, to speed up the finding process CZipArchive::FindFile uses this array to perform a binary search.

ZIPSTRINGCOMPARE | m_pCompare
A compare function (Collate or CollateNoCase) set once so as not to check every time which one to use
ZIPSTRINGCOMPARE is defined in CZipString.h as:
typedef int (CZipString::*ZIPSTRINGCOMPARE)( LPCTSTR ) const; .

bool | m_bCaseSensitive
The way the m_findarray is sorted.

Info m_info

Detailed Description

A class representing the central directory record in the archive.

Definition at line 45 of file ZipCentralDir.h.

Member Function Documentation

CZipFileHeader* CZipCentralDir::AddNewFile | ( | const CZipFileHeader & | header,
 |  | int | iReplaceIndex = -1
 | ) |

Add a new file to the central directory.

Parameters:
header | copy data from it to the new file header
iReplaceIndex | if different from -1, the index of the file to be replaced
Returns:
the pointer to the new header
Note:
Throws exceptions.

void CZipCentralDir::Clear ( bool bEverything = true )

Cleanup the structure.

Parameters:
bEverything
  • true - clear some attributes and remove all the file headers from memory
  • false - do not remove the file headers. It is called in that manner from CZipArchive::CloseFileWithNoUpdate so that the next file can be tested for the integrity
See also:
CZipArchive::CloseFileWithNoUpdate

void CZipCentralDir::CloseFile ( bool bAfterException = false )

Close a file inside archive opened for reading.

Parameters:
bAfterException true if closing after exception
Note:
Throws exceptions.

void CZipCentralDir::CloseNewFile ( )

Close a file inside archive opened for reading.

Note:
Throws exceptions.

int CZipCentralDir::CompareElement | ( | LPCTSTR | lpszFileName,
 |  | WORD | uIndex
 | ) | const [inline, protected]

The lpszFileName and bCaseSensitive arguments are the same as in the FindFileNameIndex.

The function get CZipFindFast structure pointed by uIndex and compares the filename of CZipFileHeader class stored in this structure with lpszFileName.

Parameters:
lpszFileName
uIndex the index from m_findarray
Returns:
  • 0 if the filenames are the same
  • < 0 if the filename stored in the array is less than lpszFileName
  • > 0 if the filename stored in the array is greater than lpszFileName

Definition at line 472 of file ZipCentralDir.h.

void CZipCentralDir::ConvertAll ( )

Convert all the filenames to the system form.

Called by CZipArchive::FindFile

See also:
CZipArchive::FindFile

void CZipCentralDir::ConvertFileName | ( | bool | bFromZip,
 |  | bool | bAfterOpen,
 |  | CZipFileHeader * | pHeader = NULL
 | ) | const [inline]

Convert the filename of the CZipFileHeader depending on the current system and the system the zip file was created on (change slash to backslash or vice versa, perform ANSI-OEM conversion if necessary).

Parameters:
bFromZip | if true, convert from archive format
bAfterOpen | if true, called after opening the archive or before closing
pHeader | the header to have filename converted; if NULL convert the currently opened file
See also:
ZipCompatibility::FileNameUpdate

m_bConvertAfterOpen

Definition at line 365 of file ZipCentralDir.h.

References ZipCompatibility::FileNameUpdate().

void CZipCentralDir::EnableFindFast | ( | bool | bEnable,
 |  | bool | bCaseSensitive
 | ) |

See also:
CZipArchive::EnableFindFast

int CZipCentralDir::FindFile | ( | LPCTSTR | lpszFileName,
 |  | bool | bCaseSensitive,
 |  | bool | bSporadically,
 |  | bool | bFileNameOnly
 | ) |

See also:
CZipArchive::FindFile
Note:
bSporadically set to false rebuilds m_findarray if necessary

int CZipCentralDir::FindFileNameIndex ( LPCTSTR lpszFileName ) const

Parameters:
lpszFileName the name of the file to find, must be exactly the same (apart from case) as it appears in the archive
Returns:
the index in m_findarray with the appropriate CZipFindFast structure or -1 if there is no file with the given name
See also:
CZipArchive::FindFile

int CZipCentralDir::GetFindFastIndex ( int iFindFastIndex ) const [inline]

See also:
CZipArchive::GetFindFastIndex

Definition at line 286 of file ZipCentralDir.h.

DWORD CZipCentralDir::GetSize ( bool bWhole = false ) const

Get the central directory size.

Parameters:
bWhole if true, include the size of the file headers
Returns:
the size of the central directory
See also:
CZipArchive::GetCentralDirSize

void CZipCentralDir::Init ( )

Called by CZipArchive::OpenInternal.

void CZipCentralDir::InsertFindFastElement | ( | CZipFileHeader * | pHeader,
 |  | WORD | uIndex
 | ) | [protected]

Insert a new CZipFindFast element to the m_findarray.

Initialize CZipFindFast object with pHeader and uIndex values.

bool CZipCentralDir::IsFindFastEnabled ( ) [inline]

Returns:
the value of m_bFindFastEnabled

Definition at line 402 of file ZipCentralDir.h.

bool CZipCentralDir::IsValidIndex ( int uIndex ) const

Test if the given file header index is valid.

Parameters:
uIndex a zero-based index
Returns:
true if the file with the given index exists inside the archive; otherwise false;

DWORD CZipCentralDir::Locate ( ) [protected]

Returns:
the location of the beginning of the central dir end record in the archive
Note:
Throws exceptions.

void CZipCentralDir::OpenFile ( WORD uIndex )

Open the file.

Parameters:
uIndex zero-based index of the file to open
Note:
Throws exceptions.

void CZipCentralDir::Read ( )

Read the central directory from the archive.

Note:
Throws exceptions.

void CZipCentralDir::ReadHeaders ( ) [protected]

Read the file headers from the file.

Note:
Throws exceptions.

void CZipCentralDir::RemoveAll ( )

Remove all files.

Note:
Throws exceptions.

bool CZipCentralDir::RemoveDataDescr ( bool bFromBuffer ) [protected]

Remove data descriptors from the write buffer in the disk spanning volume that turned out to be one-disk only.

We do not remove them from password encrypted files.

Parameters:
bFromBuffer if true, remove from the buffer in memory otherwise from the file on a disk
Returns:
false if the file mapping to memory was not successful Can happen only when bFormBuffer is false.
Note:
Throws exceptions.

void CZipCentralDir::RemoveFile | ( | CZipFileHeader * | pHeader,
 |  | int | iIndex = -1,
 |  | bool | bShift = true
 | ) |

Remove the file header from the central directory.

Parameters:
pHeader | the header to remove
iIndex | if index is not known set it to -1
bShift
Note:
Throws exceptions.

void CZipCentralDir::RemoveFromDisk ( )

Remove physically the central directory from the archive.

Called during adding or deleting files.

Note:
Throws exceptions.

void CZipCentralDir::RemoveHeaders ( ) [protected]

Free the memory allocated for the CZipFileHeader structures.

void CZipCentralDir::SortHeaders ( ) [protected]

Sort the files inside the archive headers by the order in the archive.

void CZipCentralDir::ThrowError ( int err ) const [protected]

Throw an exception with the given code.

Parameters:
err
See also:
CZipException::Throw

void CZipCentralDir::Write ( CZipActionCallback * pCallback )

Write the central directory to the archive.

Note:
Throws exceptions.

DWORD CZipCentralDir::WriteCentralEnd ( ) [protected]

Write the central directory end record.

Returns:
the size of the record
Note:
Throws exceptions.

void CZipCentralDir::WriteHeaders | ( | CZipActionCallback * | pCallback,
 |  | bool | bOneDisk
 | ) | [protected]

Write the file headers to the archive.

Note:
Throws exceptions.

Member Data Documentation

bool CZipCentralDir::m_bConvertAfterOpen

  • If true, the conversion of the filenames takes place after opening the archive (after reading the central directory from the file), and before writing the central directory back to the archive.

  • If false, the conversion takes place on each call to CZipArchive::GetFileInfo

Change is value with CZipArchive::SetConvertAfterOpen.

Set it to true when you plan to use CZipArchive::FindFile or get the stored files information.
Set it to false when you plan mostly to modify the archive.

Default: true

Note:
Set it before opening the archive.
See also:
CZipArchive::SetConvertAfterOpen

ConvertFileName

Definition at line 348 of file ZipCentralDir.h.

bool CZipCentralDir::m_bFindFastEnabled [protected]

If true, the there is an additional array build, to speed up the finding process CZipArchive::FindFile uses this array to perform a binary search.

Default: false

See also:
CZipArchive::EnableFindFast

CZipArchive::FindFile

CZipCentralDir::m_findarray

Definition at line 455 of file ZipCentralDir.h.

CZipArray<CZipFindFast> CZipCentralDir::m_findarray [protected]

Used in fast finding files by the filename.

See also:
CZipFindFast

m_bFindFastEnabled

CZipArchive::FindFile

Definition at line 443 of file ZipCentralDir.h.

CZipArray<CZipFileHeader*> CZipCentralDir::m_headers

Holds all the files inside archive info.

See also:
CZipFileHeader

Definition at line 319 of file ZipCentralDir.h.

int CZipCentralDir::m_iBufferSize

The size of the buffer used in searching for the central dir.

Set before opening the archive. It is usually set with CZipArchive::SetAdvanced (specify this value as the third argument).

See also:
CZipArchive::SetAdvanced

Definition at line 310 of file ZipCentralDir.h.

Info CZipCentralDir::m_info [protected]

See also:
Info

Definition at line 500 of file ZipCentralDir.h.

CZipStorage* CZipCentralDir::m_pStorage

Points to CZipArchive::m_storage.

Definition at line 300 of file ZipCentralDir.h.

The documentation for this class was generated from the following file:
  • ZipCentralDir.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipCentralDir::CZipFindFast Struct Reference

Used in fast finding files by the filename. More...

#include <ZipCentralDir.h>

List of all members.

Public Member Functions

CZipFindFast (CZipFileHeader *pHeader, WORD uIndex)

Public Attributes

CZipFileHeader * m_pHeader
A pointer to the structure in CZipCentralDir.

WORD m_uIndex
The index in the central directory of the m_pHeader.

Detailed Description

Used in fast finding files by the filename.

A structure for the internal use only.

See also:
CZipCentralDir::m_findarray

CZipArchive::GetFindFastElement

CZipArchive::FindFile

CZipArchive::EnableFindFast

Definition at line 56 of file ZipCentralDir.h.

Member Data Documentation

CZipFileHeader* CZipCentralDir::CZipFindFast::m_pHeader

A pointer to the structure in CZipCentralDir.

We extract a name from it.

Definition at line 67 of file ZipCentralDir.h.

WORD CZipCentralDir::CZipFindFast::m_uIndex

The index in the central directory of the m_pHeader.

Definition at line 72 of file ZipCentralDir.h.

The documentation for this struct was generated from the following file:
  • ZipCentralDir.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


CZipCentralDir::Info Struct Reference

Stores general information about the central directory record. More...

#include <ZipCentralDir.h>

List of all members.

Public Attributes

DWORD | m_uCentrDirPos
the position of the beginning of the central directory (as located by Locate)

DWORD | m_uBytesBeforeZip
The number of bytes before the actual zip archive in a file. It is non-zero for self-extracting archives.

WORD | m_uThisDisk
number of the disk with the central directory end record (the number of disks in the disk-spanning archive)

WORD | m_uDiskWithCD
number of the disk with the start of the central directory

WORD | m_uDiskEntriesNo
total number of entries in the central dir on this disk

WORD | m_uEntriesNumber
total number of entries in the central dir

DWORD | m_uSize
size of the central directory (valid only if m_bOnDisk is true; use GetSize instead)

DWORD | m_uOffset
(as written in the central directory record); valid only if m_bOnDisk is true

bool | m_bOnDisk
true if the central directory is physically present in the archive

Protected Member Functions

bool | CheckIfOK_1 ()
void | SetBytesBeforeZip (bool bIsSpan)
bool | CheckIfOK_2 ()
void | DiskChange (int iCurrentDisk)

Friends

class | CZipCentralDir

Detailed Description

Stores general information about the central directory record.

Definition at line 79 of file ZipCentralDir.h.

The documentation for this struct was generated from the following file:
  • ZipCentralDir.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


CZipException Class Reference

A class representing exceptions specific to the ZipArchive library. More...

#include <ZipException.h>

List of all members.

Public Types

enum ZipErrors {
noError, generic = 100, badZipFile, badCrc,
noCallback, aborted, abortedAction, abortedSafely,
nonRemovable, tooManyVolumes, tooLongFileName, badPassword,
dirWithSize, internal, notRemoved, notRenamed,
platfNotSupp, cdirNotFound, streamEnd = 500, needDict,
errNo, streamError, dataError, memError,
bufError, versionError
}
The codes of errors thrown by the ZipArchive library. More...

Public Member Functions

CZipException (int iCause=generic, LPCTSTR lpszZipName=NULL)
CZipException (CZipException &e)
CZipString | GetErrorDescription ()
Return the error description.

BOOL | GetErrorMessage (LPTSTR lpszError, UINT nMaxError, UINT *=NULL)
Return the description of the error based on system variables (this function is provided only for compatibility with MFC CException::GetErrorMessage).

Static Public Member Functions

void | Throw (int iZipError=CZipException::generic, LPCTSTR lpszZipName=NULL)
Throw an exception.

int | ZlibErrToZip (int iZlibError)
Convert a zlib library error code to a CZipException error code .

Public Attributes

CZipString | m_szFileName
The name of the zip file where the error occurred.

int | m_iCause
A cause of the error - takes one of the ZipErrors enumeration codes.

Protected Member Functions

CZipString | GetInternalErrorDescription (int iCause, bool bNoLoop=false)
Return the error description.

CZipString | GetSystemErrorDescription ()
Return the description of the error based on system variables.

Detailed Description

A class representing exceptions specific to the ZipArchive library.

Library exception class derived in the MFC version from CException and in non-MFC version from std::exception.

Definition at line 45 of file ZipException.h.

Member Enumeration Documentation

enum CZipException::ZipErrors

The codes of errors thrown by the ZipArchive library.

Enumeration values:
noError | no error
generic | unknown error
badZipFile | damaged or not a zip file
badCrc | crc mismatched
noCallback | no disk-spanning callback functor set
aborted | callback functor's method Callback returned false while disk change in the disk-spanning archive
abortedAction | callback functor's method Callback returned false in CZipArchive class members: AddNewFile, ExtractFile, TestFile, DeleteFile or DeleteFiles
abortedSafely | the same as above, you may be sure that the operation was successfully completed before or it didn't cause any damage in the archive (break when counting before deleting files; see CZipArchive::cbDeleteCnt)
nonRemovable | the disk selected for pkzipSpan archive is non removable
tooManyVolumes | limit of the maximum volumes reached (999)
tooLongFileName | the filename of the file added to the archive is too long
badPassword | incorrect password set for the file being decrypted
dirWithSize | during testing: found the directory with the size greater than 0
internal | internal error
notRemoved | error while removing a file (under Windows call GetLastError() to find out more)
notRenamed | error while renaming a file (under Windows call GetLastError() to find out more)
platfNotSupp | the platform that the zip file is being created for is not supported
cdirNotFound | the central directory was not found in the archive (it is thrown also when the last disk of multi-disk archive is not in the drive when opening the archive)
streamEnd | zlib library error
needDict | zlib library error
errNo | zlib library error
streamError | zlib library error
dataError | zlib library error
memError | zlib library error thrown by CZipMemFile as well
bufError | zlib library error
versionError | zlib library error

Definition at line 147 of file ZipException.h.

Constructor & Destructor Documentation

CZipException::CZipException | ( | int | iCause = generic,
 |  | LPCTSTR | lpszZipName = NULL
 | ) |

Parameters:
iCause | error cause (takes one of the ZipErrors enumeration codes)
lpszZipName | the name of the file where the error occurred (if applicable)

Member Function Documentation

CZipString CZipException::GetErrorDescription ( )

Return the error description.

Note:
You need to have defined ZIP_ENABLE_ERROR_DESCRIPTION (in file ZipException.h); undefine this value if you don't want to store the messages in the library.

BOOL CZipException::GetErrorMessage | ( | LPTSTR | lpszError,
 |  | UINT | nMaxError,
 |  | UINT * | = NULL
 | ) |

Return the description of the error based on system variables (this function is provided only for compatibility with MFC CException::GetErrorMessage).

Parameters:
lpszError | a pointer to a buffer that will receive the error message if NULL
nMaxError | the maximum number of characters the buffer can hold, including the NULL terminator
Returns:
TRUE if the error string is not empty
Note:
  • The function will not copy more than nMaxError – 1 characters to the buffer, and it always adds a trailing null to end the string; if the buffer is too small, the error message will be truncated.
  • You need to have defined ZIP_ENABLE_ERROR_DESCRIPTION (in file ZipException.h); undefine this value if you don't want to store the messages in the library.

CZipString CZipException::GetInternalErrorDescription | ( | int | iCause,
 |  | bool | bNoLoop = false
 | ) | [protected]

Return the error description.

Parameters:
iCause : error number
bNoLoop: if true tells not to search for en error description, it the error is generic
Returns:

CZipString CZipException::GetSystemErrorDescription ( ) [protected]

Return the description of the error based on system variables.

Returns:

void CZipException::Throw | ( | int | iZipError = CZipException::generic,
 |  | LPCTSTR | lpszZipName = NULL
 | ) | [inline, static]

Throw an exception.

Throw CZipException* in the MFC version of the library (the object must be deleted with Delete() method) and CZipException in other versions.

The arguments are the same as in CZipException().

Parameters:
iZipError
lpszZipName
See also:
CZipException()

Definition at line 78 of file ZipException.h.

int CZipException::ZlibErrToZip ( int iZlibError ) [static]

Convert a zlib library error code to a CZipException error code .

Parameters:
iZlibError zlib library error code
Returns:
CZipException error code

Member Data Documentation

int CZipException::m_iCause

A cause of the error - takes one of the ZipErrors enumeration codes.

Definition at line 184 of file ZipException.h.

CZipString CZipException::m_szFileName

The name of the zip file where the error occurred.

Definition at line 142 of file ZipException.h.

The documentation for this class was generated from the following file:
  • ZipException.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


CZipFileHeader Class Reference

Representation of a single file stored in the zip archive. More...

#include <ZipFileHeader.h>

List of all members.

Public Member Functions

WORD | GetFileNameSize () const
WORD | GetCommentSize () const
WORD | GetExtraFieldSize () const
CZipString | GetFileName () const
bool | SetFileName (LPCTSTR lpszFileName)
Set the filename.

CZipString | GetComment () const
bool | SetComment (LPCTSTR lpszComment)
Set the file comment.

bool | IsDataDescr () const
DWORD | GetEffComprSize ()
bool | CompressionEfficient ()
float | GetCompressionRatio ()
bool | IsEncrypted () const
void | SetTime (const time_t &ttime)
Set m_uModDate, m_uModTime (file modification time).

time_t | GetTime () const
DWORD | GetSize (bool bLocal=false) const
int | GetSystemCompatibility () const
DWORD | GetSystemAttr () const
DWORD | GetOriginalAttributes () const
bool | IsDirectory () const

Public Attributes

char | m_szSignature [4]
central file header signature

WORD | m_uVersionMadeBy
version made by and system compatibility

WORD | m_uVersionNeeded
version needed to extract

WORD | m_uFlag
general purpose bit flag

WORD | m_uMethod
compression method

WORD | m_uModTime
last mod file time

WORD | m_uModDate
last mod file date

DWORD | m_uCrc32
crc-32

DWORD | m_uComprSize
compressed size

DWORD | m_uUncomprSize
uncompressed size

WORD | m_uDiskStart
disk number start

WORD | m_uInternalAttr
internal file attributes

DWORD | m_uOffset
relative offset of local header

CZipAutoBuffer m_pExtraField
extra field (variable size)

Static Public Attributes

char | m_gszSignature []
central file header signature

char | m_gszLocalSignature []
local file header signature

Protected Member Functions

void | SetSystemCompatibility (int iSystemID)
Set the system compatibility of the file.

void | SetSystemAttr (DWORD uAttr)
Set the system attributes if you wish to set the attributes of this structure use CZipArchive::SetFileHeaderAttr().

void | SetVersion (WORD uVersion)
Set the version made by number.

void | GetCrcAndSizes (char *pBuffer) const
Fill the buffer with the current values of crc and compressed and uncompressed sizes of the file.

bool | CheckCrcAndSizes (char *pBuf) const
Check whether the actual values of crc and compressed and uncompressed sizes of the file are the same as defined in the file header.

bool | PrepareData (int iLevel, bool bSpan, bool bEncrypted)
Prepare the data for the class while adding a new file.

void | WriteLocal (CZipStorage &storage)
Write the local file header to the storage.

bool | Read (CZipStorage *pStorage)
Read the file header from the central directory record from pStorage.

bool | ReadLocal (CZipStorage *pStorage, WORD &iLocExtrFieldSize)
Read the local file header from pStorage and check for consistency.

DWORD | Write (CZipStorage *pStorage)
Write the file header to pStorage.

Protected Attributes

DWORD | m_uExternalAttr
external file attributes

CZipAutoBuffer m_pszFileName
a filename

CZipAutoBuffer m_pszComment
a file comment

Friends

class | CZipCentralDir
class | CZipArchive
void | ZipCompatibility::FileNameUpdate (CZipFileHeader &, bool)

Detailed Description

Representation of a single file stored in the zip archive.

Modify all the class attributes BEFORE adding a file to and archive ( using CZipArchive::OpenNewFile ). It is not possible to modify the data of the existing files in the archive (it would mean updating all the information in the local headers and the offsets would be changed as well when the filename would changed its size)

Definition at line 45 of file ZipFileHeader.h.

Member Function Documentation

bool CZipFileHeader::CheckCrcAndSizes ( char * pBuf ) const [protected]

Check whether the actual values of crc and compressed and uncompressed sizes of the file are the same as defined in the file header.

Parameters:
pBuf buffer with the mentioned data
Returns:
true if they are the same; otherwise false;

bool CZipFileHeader::CompressionEfficient ( ) [inline]

Returns:
false if the file should be stored instead of being compressed

Definition at line 126 of file ZipFileHeader.h.

CZipString CZipFileHeader::GetComment ( ) const

Returns:
the file comment

WORD CZipFileHeader::GetCommentSize ( ) const [inline]

Returns:
the comment size in characters (without NULL)

Definition at line 70 of file ZipFileHeader.h.

float CZipFileHeader::GetCompressionRatio ( ) [inline]

Returns:
the compression ratio of the file

Definition at line 137 of file ZipFileHeader.h.

void CZipFileHeader::GetCrcAndSizes ( char * pBuffer ) const [protected]

Fill the buffer with the current values of crc and compressed and uncompressed sizes of the file.

DWORD CZipFileHeader::GetEffComprSize ( ) [inline]

Returns:
get the effective compressed size: if the file is encrypted, return less by the size of the encryption header

Definition at line 118 of file ZipFileHeader.h.

WORD CZipFileHeader::GetExtraFieldSize ( ) const [inline]

Returns:
the extra field size in characters

Definition at line 75 of file ZipFileHeader.h.

CZipString CZipFileHeader::GetFileName ( ) const

Returns:
the filename

Referenced by CZipCentralDir::GetProperHeaderFileName().

WORD CZipFileHeader::GetFileNameSize ( ) const [inline]

Returns:
the filename size in characters (without NULL)

Definition at line 65 of file ZipFileHeader.h.

DWORD CZipFileHeader::GetOriginalAttributes ( ) const [inline]

Returns:
the original attributes as stored in the archive (without performing any conversion)

Definition at line 226 of file ZipFileHeader.h.

DWORD CZipFileHeader::GetSize ( bool bLocal = false ) const

Parameters:
bLocal if true return the local file header size or in the central directory otherwise
Returns:
the total size of the structure depending on the bLocal parameter

DWORD CZipFileHeader::GetSystemAttr ( ) const

Returns:
the attributes of the file converted to the current system compatible value
Note:
  • Throws exception if the archive system or the current system is not supported by the ZipArchive library.
  • (only Linux version): After obtaining the attributes, you need to shift them right by 16

int CZipFileHeader::GetSystemCompatibility ( ) const [inline]

Returns:
the system compatibility of the current file as the one of ZipCompatibility::ZipPlatforms values; usually the same as CZipArchive::GetSystemComatibility. Software can use this information e.g. to determine the line record format for text files etc. ZipArchive library uses it to perform a proper attributes conversion.
See also:
CZipArchive::GetSystemComatibility

ZipPlatform::GetSystemID

Definition at line 207 of file ZipFileHeader.h.

time_t CZipFileHeader::GetTime ( ) const

Returns:
the modification time
See also:
SetTime

bool CZipFileHeader::IsDataDescr ( ) const [inline]

Returns:
true if the data descriptor is present

Definition at line 111 of file ZipFileHeader.h.

bool CZipFileHeader::IsDirectory ( ) const

Returns:
true, if this object represents a directory; otherwise false; If m_uExternalAttr value is zero, the function check for a presence of a path separator at the end of the file name. If it is present, it is assumed to be a directory.

bool CZipFileHeader::IsEncrypted ( ) const [inline]

Returns:
if the file is encrypted ( a password is needed to extract this file)
See also:
CZipArchive::SetPassword

Definition at line 146 of file ZipFileHeader.h.

bool CZipFileHeader::PrepareData | ( | int | iLevel,
 |  | bool | bSpan,
 |  | bool | bEncrypted
 | ) | [protected]

Prepare the data for the class while adding a new file.

Called by CZipArchive::OpenNewFile

Parameters:
iLevel | a compression level
bSpan | true, if the data descriptor will be present because of spanning archive
bEncrypted | true, if the file will be encrypted
Returns:
true if the sizes of the filename, extra field and comments does not exceed unsigned short maximum value; otherwise false;

bool CZipFileHeader::Read ( CZipStorage * pStorage ) [protected]

Read the file header from the central directory record from pStorage.

Parameters:
*pStorage
Returns:
true if the whole file header is on one disk in a multi-disk archive; otherwise false;
Note:
Throws exceptions.

bool CZipFileHeader::ReadLocal | ( | CZipStorage * | pStorage,
 |  | WORD & | iLocExtrFieldSize
 | ) | [protected]

Read the local file header from pStorage and check for consistency.

Parameters:
*pStorage
iLocExtrFieldSize receives local extra field size
Returns:
false, if something goes wrong; otherwise true;
Note:
Throws exceptions.

bool CZipFileHeader::SetComment ( LPCTSTR lpszComment )

Set the file comment.

Parameters:
lpszComment
Returns:
true, if conversion from UNICODE to single byte was successful (or if there was no conversion needed or possible); otherwise false;

bool CZipFileHeader::SetFileName ( LPCTSTR lpszFileName )

Set the filename.

Parameters:
lpszFileName
Returns:
true, if conversion from UNICODE to single byte was successful (or if there was no conversion needed or possible); otherwise false;

void CZipFileHeader::SetSystemAttr ( DWORD uAttr ) [protected]

Set the system attributes if you wish to set the attributes of this structure use CZipArchive::SetFileHeaderAttr().

Parameters:
uAttr attributes to set
Note:
Throws exceptions if the archive system or the current system is not supported by the ZipArchive library.
See also:
CZipArchive::SetFileHeaderAttr

GetSystemAttr

SetSystemCompatibility

void CZipFileHeader::SetSystemCompatibility ( int iSystemID ) [inline, protected]

Set the system compatibility of the file.

Parameters:
iSystemID one of ZipCompatibility::ZipPlatforms values
See also:
CZipArchive::GetSystemCompatibility

Definition at line 244 of file ZipFileHeader.h.

void CZipFileHeader::SetTime ( const time_t & ttime )

Set m_uModDate, m_uModTime (file modification time).

Parameters:
ttime
See also:
GetTime

DWORD CZipFileHeader::Write ( CZipStorage * pStorage ) [protected]

Write the file header to pStorage.

Parameters:
*pStorage
Returns:
the size of the file header
Note:
Throws exceptions.

void CZipFileHeader::WriteLocal ( CZipStorage & storage ) [protected]

Write the local file header to the storage.

Parameters:
storage
Note:
Throws exceptions.

The documentation for this class was generated from the following file:
  • ZipFileHeader.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


CZipFileMapping Struct Reference

Maps a file to the memory. More...

Detailed Description

Maps a file to the memory.

A system-specific implementation. Stored in ziparchv namespace.

#include "ZipFileMapping.h"

The documentation for this struct was generated from the following file:
  • ZipArchive.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


CZipMemFile Class Reference

A memory buffer which behaves like a physical file. More...

#include <ZipMemFile.h>

List of all members.

Public Member Functions

bool | IsClosed () const
void | Flush ()
ZIP_ULONGLONG | Seek (ZIP_LONGLONG lOff, int nFrom)
ZIP_ULONGLONG | GetLength () const
void | Write (const void *lpBuf, UINT nCount)
UINT | Read (void *lpBuf, UINT nCount)
void | SetLength (ZIP_ULONGLONG nNewLen)
CZipString | GetFilePath () const
CZipMemFile (long nGrowBy=1024)
CZipMemFile (BYTE *lpBuf, UINT nBufSize, long nGrowBy=0)
ZIP_ULONGLONG | GetPosition () const
void | Attach (BYTE *lpBuf, UINT nBufSize, long nGrowBy=0)
BYTE * | Detach ()
void | Close ()

Protected Member Functions

void | Free ()
void | Init ()
void | Grow (size_t nBytes)

Protected Attributes

size_t | m_nGrowBy
size_t | m_nPos
size_t | m_nBufSize
size_t | m_nDataSize
BYTE * | m_lpBuf
bool | m_bAutoDelete

Detailed Description

A memory buffer which behaves like a physical file.

Automatically grows when necessary

Definition at line 36 of file ZipMemFile.h.

The documentation for this class was generated from the following file:
  • ZipMemFile.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


CZipPathComponent Class Reference

A class splitting a file path into components. More...

#include <ZipPathComponent.h>

List of all members.

Public Member Functions

CZipPathComponent (LPCTSTR lpszFullPath)
Construct the object and set a path.

void | SetFullPath (LPCTSTR lpszFullPath)
Set the path.

CZipString | GetFileTitle () const
void | SetFileTitle (LPCTSTR lpszFileTitle)
Set the file title (without an extension).

void | SetExtension (LPCTSTR lpszExt)
Set the extension alone.

CZipString | GetFileExt () const
CZipString | GetFileDrive () const
CZipString | GetNoDrive () const
CZipString | GetFileName () const
CZipString | GetFullPath () const
CZipString | GetFilePath () const

Static Public Member Functions

void | AppendSeparator (CZipString &szPath)
Append a path separator to szPath if it is not already there.

void | RemoveSeparators (CZipString &szPath)
Remove separators from the end of szPath.

void | RemoveSeparatorsLeft (CZipString &szPath)
Remove separators from the beginning of szPath.

bool | IsSeparator (TCHAR c)
bool | HasEndingSeparator (const CZipString &szPath)

Static Public Attributes

const TCHAR | m_cSeparator
A system - specific default path separator. Defined in ZipPlatform.cpp.

Protected Attributes

Path components
CZipString | m_szDirectory
a directory(ies) (one or more) without the path separators at the end and the beginning

CZipString | m_szFileTitle
a filename without an extension

CZipString | m_szFileExt
a file extension without a dot

CZipString | m_szDrive
a drive (if the system path standard uses it) without a path separator at the end

CZipString | m_szPrefix
a prefix (e.g. for the UNC path or Unicode path under Windows)

Detailed Description

A class splitting a file path into components.

Definition at line 34 of file ZipPathComponent.h.

Constructor & Destructor Documentation

CZipPathComponent::CZipPathComponent ( LPCTSTR lpszFullPath ) [inline]

Construct the object and set a path.

Parameters:
lpszFullPath the full path of the file
See also:
SetFullPath

Definition at line 99 of file ZipPathComponent.h.

Member Function Documentation

CZipString CZipPathComponent::GetFileDrive ( ) const [inline]

Returns:
the drive (no path separator at the end)

Definition at line 145 of file ZipPathComponent.h.

CZipString CZipPathComponent::GetFileExt ( ) const [inline]

Returns:
the file extension without a dot

Definition at line 141 of file ZipPathComponent.h.

CZipString CZipPathComponent::GetFileName ( ) const [inline]

Returns:
the filename including an extension

Definition at line 154 of file ZipPathComponent.h.

CZipString CZipPathComponent::GetFilePath ( ) const [inline]

Returns:
the path of the file (without the separator at the end)

Definition at line 182 of file ZipPathComponent.h.

CZipString CZipPathComponent::GetFileTitle ( ) const [inline]

Returns:
the filename (without an extension)

Definition at line 116 of file ZipPathComponent.h.

CZipString CZipPathComponent::GetFullPath ( ) const [inline]

Returns:
the full path of the file (including the filename)

Definition at line 167 of file ZipPathComponent.h.

CZipString CZipPathComponent::GetNoDrive ( ) const

Returns:
the full path without the drive (no separator at the beginning)

bool CZipPathComponent::HasEndingSeparator ( const CZipString & szPath ) [inline, static]

Returns:
true if the path has a path separator at the and

Definition at line 84 of file ZipPathComponent.h.

bool CZipPathComponent::IsSeparator ( TCHAR c ) [inline, static]

Returns:
true if c is a slash or a backslash

Definition at line 76 of file ZipPathComponent.h.

void CZipPathComponent::RemoveSeparatorsLeft ( CZipString & szPath ) [inline, static]

Remove separators from the beginning of szPath.

Definition at line 64 of file ZipPathComponent.h.

void CZipPathComponent::SetExtension ( LPCTSTR lpszExt ) [inline]

Set the extension alone.

Parameters:
lpszExt may but not have to contain a dot at the beginning

Definition at line 132 of file ZipPathComponent.h.

void CZipPathComponent::SetFileTitle ( LPCTSTR lpszFileTitle ) [inline]

Set the file title (without an extension).

Parameters:
lpszFileTitle
Returns:

Definition at line 124 of file ZipPathComponent.h.

void CZipPathComponent::SetFullPath ( LPCTSTR lpszFullPath )

Set the path.

Parameters:
lpszFullPath a full path to the file (including a filename - the last element in the path is assumed to be a filename)

The documentation for this class was generated from the following file:
  • ZipPathComponent.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


CZipSpanCallback Struct Reference

Derive from this a class to be used as a callback functor for the disk change callback. More...

#include <ZipStorage.h>

Inheritance diagram for CZipSpanCallback:

[legend]
List of all members.

Public Attributes

DWORD m_uDiskNeeded
the number of a disk needed (counting from 1)

Detailed Description

Derive from this a class to be used as a callback functor for the disk change callback.

You need to override member function CZipCallback::Callback. The meaning of iProgress parameter is the reason for calling:

  • -1 : a disk needed for reading
    other codes occurs during writing:
  • >=0 : min. number of bytes needed
  • -2 : the file with the archive name already exists on the disk
  • -3 : the disk is probably write - protected
  • -4 : couldn't create a file

Return false from the callback function to abort operation: the proper exception will be thrown.

See also:
CZipCallback::Callback

CZipArchive::SetSpanCallback

Definition at line 84 of file ZipStorage.h.

The documentation for this struct was generated from the following file:
  • ZipStorage.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


CZipStorage Class Reference

A low-level class - operates physically on archive (CZipArchive operates logically). More...

#include <ZipStorage.h>

List of all members.

Public Types

enum ZipSpanMode {
noSpan, pkzipSpan, tdSpan, suggestedAuto,
suggestedTd
}
The type of the disk spanning archive. More...

Public Member Functions

void | Open (CZipMemFile &mf, int iMode)
Open the archive in memory (new or existing).

void | Open (LPCTSTR szPathName, int iMode, int iVolumeSize)
Open or create an archive.

void | FinalizeSpan ()
Close the disk-spanning archive and reopens as an existing disk-spanning archive or set mode to noSpan.

void | UpdateSpanMode (WORD uLastDisk)
Called only by CZipCentralDir::Read() when opening an existing archive.

void | Write (const void *pBuf, DWORD iSize, bool bAtOnce)
Write chunk of data to the archive.

DWORD | Read (void *pBuf, DWORD iSize, bool bAtOnce)
Read chunk of data from the archive.

DWORD | GetPosition () const
Return the position in the file, taking into account the bytes in the write buffer.

void | Flush ()
Flush the data from the read buffer to the disk.

void | FlushFile ()
Forces any data remaining in the file buffer to be written to the disk.

void | NextDisk (int iNeeded, LPCTSTR lpszFileName=NULL)
A method used to change disks during writing to the disk spanning archive.

int | GetCurrentDisk () const
void | ChangeDisk (int iNumber)
Change the disk during extract operations.

int | IsSpanMode () const
Detect the span mode.

bool | IsReadOnly ()
return true if the archive cannot be modified.

CZipString | Close (bool bAfterException)

Public Attributes

int | m_iWriteBufferSize
The size of the write buffer.

CZipFile | m_internalfile
The physical archive file (on a storage device).

CZipAbstractFile * | m_pFile
The buffer representing the archive.

int | m_iSpanMode
Takes one of the values of ZipSpanMode.

CZipSpanCallback * m_pChangeDiskFunc
A callback functor which method Callback is called when there is a need for a disk change while operating on a pkzipSpan archive.

Static Public Attributes

char | m_gszExtHeaderSignat []
The signature of the extended header.

Protected Member Functions

void | EmptyWriteBuffer ()
Flush without writing.

bool | OpenFile (LPCTSTR lpszName, UINT uFlags, bool bThrow=true)
Open a physical file.

void | ThrowError (int err)
Throw an exception with the given code.

DWORD | VolumeLeft () const
Return the number of bytes left on the current volume.

CZipString | RenameLastFileInTDSpan ()
Rename last file in TD mode disk spanning archive when done with creating.

void | WriteInternalBuffer (const char *pBuf, DWORD uSize)
Write data to the internal buffer.

DWORD | GetFreeVolumeSpace () const
void | CallCallback (int iCode, CZipString szTemp)
Call the callback functor.

CZipString | GetTdVolumeName (bool bLast, LPCTSTR lpszZipName=NULL) const
Construct the name of the volume in tdSpan mode.

CZipString | ChangeTdRead ()
Change the disk in tdSpan mode.

CZipString | ChangePkzipRead ()
Change the disk in pkzipSpan mode.

DWORD | GetFreeInBuffer () const

Protected Attributes

int | m_iTdSpanData
Used only in TD span mode .

CZipString | m_szSpanExtension
The extension of the last volume.

DWORD | m_uBytesInWriteBuffer
Number of bytes available in the write buffer.

DWORD | m_uCurrentVolSize
The value it holds depends on the open mode:.

DWORD | m_uVolumeFreeInBuffer
number of bytes left free in the write buffer

CZipAutoBuffer m_pWriteBuffer
Write buffer caching data.

DWORD | m_iBytesWritten
Used only during disk spanning archive creation.

bool | m_bNewSpan
True, if the current archive is a new disk spanning archive.

int | m_iCurrentDisk
The current disk in a disk spanning archive.

bool | m_bInMemory
It is set to true when an archive is created in memory; false otherwise.

bool | m_bReadOnly
It is set to true if OpenMode::zipOpenReadOnly was specified when opening the archive.

Friends

class | CZipCentralDir

Detailed Description

A low-level class - operates physically on archive (CZipArchive operates logically).

Definition at line 202 of file ZipStorage.h.

Member Enumeration Documentation

enum CZipStorage::ZipSpanMode

The type of the disk spanning archive.

See also:
CZipArchive::GetSpanMode
Enumeration values:
noSpan | no disk spanning
pkzipSpan | disk spanning compatible with PKZIP
tdSpan | TD mode disk spanning archive
suggestedAuto Detect the type automatically.

If the archive is on the removable device assume PKZIP compatible, otherwise TD mode compatible.

suggestedTd | If the disk spanning archive is on the removable device assume it is TD mode compatible.

Definition at line 211 of file ZipStorage.h.

Member Function Documentation

void CZipStorage::CallCallback | ( | int | iCode,
 |  | CZipString | szTemp
 | ) | [protected]

Call the callback functor.

Throw an exception if the callback functor's method Callback returns false.

Parameters:
iCode | a code to be passed to the callback functor
szTemp | a string to be used as a filename (the second argument of CZipException::Throw) when the exception must be thrown
Note:
Throws exceptions.
See also:
CZipArchive::SetSpanCallback

CZipException::Throw

void CZipStorage::ChangeDisk ( int iNumber )

Change the disk during extract operations.

Parameters:
iNumber a zero-based disk number requested
Returns:

CZipString CZipStorage::Close ( bool bAfterException )

Parameters:
bAfterException set to true after the library has throw an exception. The simplified mode is used then. In this case it'll be possible to reuse the object to operate on another archive, but the current archive file will not be valid anyway.
Returns:
the filepath of the archive (used by CZipArchive::Close)
Note:
Throws exceptions.

void CZipStorage::EmptyWriteBuffer ( ) [inline, protected]

Flush without writing.

Can be used only on non-disk spanning archives.

Definition at line 428 of file ZipStorage.h.

void CZipStorage::Flush ( )

Flush the data from the read buffer to the disk.

Note:
Throws exceptions.

int CZipStorage::GetCurrentDisk ( ) const [inline]

Returns:
a zero-based number of the current disk

Definition at line 334 of file ZipStorage.h.

DWORD CZipStorage::GetFreeInBuffer ( ) const [inline, protected]

Returns:
the count bytes left free in the write buffer

Definition at line 532 of file ZipStorage.h.

DWORD CZipStorage::GetFreeVolumeSpace ( ) const [protected]

Returns:
the number of free bytes on the current removable disk

DWORD CZipStorage::GetPosition ( ) const [inline]

Return the position in the file, taking into account the bytes in the write buffer.

Note:
Throws exceptions.

Definition at line 301 of file ZipStorage.h.

CZipString CZipStorage::GetTdVolumeName | ( | bool | bLast,
 |  | LPCTSTR | lpszZipName = NULL
 | ) | const [protected]

Construct the name of the volume in tdSpan mode.

Parameters:
bLast | must be true if constructing the last volume name (an extension "zip" is given)
lpszZipName | the name of the archive
Returns:
the new volume name

bool CZipStorage::IsReadOnly ( ) [inline]

return true if the archive cannot be modified.

Definition at line 361 of file ZipStorage.h.

int CZipStorage::IsSpanMode ( ) const [inline]

Detect the span mode.

Returns:
  • -1 - existing disk spanning archive opened
  • 0 - no disk spanning archive
  • 1 - disk spanning archive in creation

Definition at line 353 of file ZipStorage.h.

void CZipStorage::NextDisk | ( | int | iNeeded,
 |  | LPCTSTR | lpszFileName = NULL
 | ) |

A method used to change disks during writing to the disk spanning archive.

Parameters:
iNeeded | no of bytes needed on the disk
lpszFileName | the archive filename
Note:
Throws exceptions.

void CZipStorage::Open | ( | LPCTSTR | szPathName,
 |  | int | iMode,
 |  | int | iVolumeSize
 | ) |

Open or create an archive.

The parameters are the same as CZipArchive::Open.

Parameters:
szPathName
iMode
iVolumeSize
Note:
Throws exceptions.
See also:
CZipArchive::Open(CZipMemFile& , int);

void CZipStorage::Open | ( | CZipMemFile & | mf,
 |  | int | iMode
 | ) |

Open the archive in memory (new or existing).

The parameters are the same as CZipArchive::OpenMode.

Parameters:
mf
iMode
Note:
Throws exceptions.
See also:
CZipArchive::Open(LPCTSTR, int, int)

bool CZipStorage::OpenFile | ( | LPCTSTR | lpszName,
 |  | UINT | uFlags,
 |  | bool | bThrow = true
 | ) | [protected]

Open a physical file.

Parameters:
lpszName | the name of the file to open
uFlags | file open flags
bThrow | if true then throw an exception in case of failure
Returns:
true if successful

DWORD CZipStorage::Read | ( | void * | pBuf,
 |  | DWORD | iSize,
 |  | bool | bAtOnce
 | ) |

Read chunk of data from the archive.

Parameters:
pBuf | buffer to receive data
iSize | bytes to read
bAtOnce | if true, the specified number of bytes must be read from the same volume (no disk change allowed)
Note:
Throws exceptions.

void CZipStorage::ThrowError ( int err ) [protected]

Throw an exception with the given code.

Parameters:
err
See also:
CZipException::Throw

void CZipStorage::UpdateSpanMode ( WORD uLastDisk )

Called only by CZipCentralDir::Read() when opening an existing archive.

Parameters:
uLastDisk the disk number the central directory is on
Note:
Throws exceptions.

DWORD CZipStorage::VolumeLeft ( ) const [protected]

Return the number of bytes left on the current volume.

void CZipStorage::Write | ( | const void * | pBuf,
 |  | DWORD | iSize,
 |  | bool | bAtOnce
 | ) |

Write chunk of data to the archive.

Parameters:
pBuf | buffer with data
iSize | bytes to write
bAtOnce | if true, the whole data must fit in the current volume, otherwise the disk change is performed
Note:
Throws exceptions.

void CZipStorage::WriteInternalBuffer | ( | const char * | pBuf,
 |  | DWORD | uSize
 | ) | [protected]

Write data to the internal buffer.

Parameters:
*pBuf | the buffer to copy data from
uSize | bytes to write
Note:
Throws exceptions.

Member Data Documentation

bool CZipStorage::m_bInMemory [protected]

It is set to true when an archive is created in memory; false otherwise.

Definition at line 579 of file ZipStorage.h.

bool CZipStorage::m_bNewSpan [protected]

True, if the current archive is a new disk spanning archive.

Definition at line 568 of file ZipStorage.h.

DWORD CZipStorage::m_iBytesWritten [protected]

Used only during disk spanning archive creation.

Tells how many bytes have been written physically to the current volume.

Definition at line 563 of file ZipStorage.h.

int CZipStorage::m_iCurrentDisk [protected]

The current disk in a disk spanning archive.

Disk no 0 is the first disk.

Definition at line 574 of file ZipStorage.h.

CZipFile CZipStorage::m_internalfile

The physical archive file (on a storage device).

Not used when opening archive in memory with Open(CZipMemFile& , int).

Definition at line 394 of file ZipStorage.h.

int CZipStorage::m_iSpanMode

Takes one of the values of ZipSpanMode.

Definition at line 410 of file ZipStorage.h.

int CZipStorage::m_iTdSpanData [protected]

Used only in TD span mode .

The value it holds depends on the open mode.

  • Opened existing disk spanning archive - store the number of the last disk ( the one with "zip" extension).
  • Disk spanning archive in creation - the size of the volume.

See also:
CZipArchive::Open

CZipArchive::GetSpanMode

Definition at line 522 of file ZipStorage.h.

int CZipStorage::m_iWriteBufferSize

The size of the write buffer.

Set before opening the archive. It is usually set with CZipArchive::SetAdvanced (specify this value as the first argument).

See also:
CZipArchive::SetAdvanced

Definition at line 386 of file ZipStorage.h.

CZipSpanCallback* CZipStorage::m_pChangeDiskFunc

A callback functor which method Callback is called when there is a need for a disk change while operating on a pkzipSpan archive.

See also:
CZipArchive::SetSpanCallback

Definition at line 417 of file ZipStorage.h.

CZipAbstractFile* CZipStorage::m_pFile

The buffer representing the archive.

It is a physical file or a memory buffer depending on what method was used to open the archive. In the first case it is a pointer to m_internalfile.

See also:
Open(LPCTSTR, int, int);

Open(CZipMemFile& mf, int)

Definition at line 405 of file ZipStorage.h.

CZipAutoBuffer CZipStorage::m_pWriteBuffer [protected]

Write buffer caching data.

Definition at line 556 of file ZipStorage.h.

CZipString CZipStorage::m_szSpanExtension [protected]

The extension of the last volume.

Definition at line 527 of file ZipStorage.h.

DWORD CZipStorage::m_uBytesInWriteBuffer [protected]

Number of bytes available in the write buffer.

Definition at line 537 of file ZipStorage.h.

DWORD CZipStorage::m_uCurrentVolSize [protected]

The value it holds depends on the open mode:.

  • tdSpan : the total size of the current volume
  • pkzipSpan: a free space on the current volume

Definition at line 545 of file ZipStorage.h.

The documentation for this class was generated from the following file:
  • ZipStorage.h
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Compound Member Index

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages
All | Functions | Variables | Enumerations | Enumeration values
_ | a | b | c | d | e | f | g | h | i | l | m | n | o | p | r | s | t | u | v | w | z

Here is a list of all documented class members with links to the class documentation for each member:

- _ -

  • _zliballoc() : CZipArchive
  • _zlibfree() : CZipArchive

- a -

  • aborted : CZipException
  • abortedAction : CZipException
  • abortedSafely : CZipException
  • AddNewFile() : CZipCentralDir, CZipArchive
  • afAfterException : CZipArchive
  • afNoException : CZipArchive
  • afWriteDir : CZipArchive
  • AppendSeparator() : CZipPathComponent

- b -

  • badCrc : CZipException
  • badPassword : CZipException
  • badZipFile : CZipException
  • bufError : CZipException
  • BuildFindFastArray() : CZipCentralDir

- c -

  • Callback() : CZipCallback
  • CallbackEnd() : CZipActionCallback
  • CallbackType : CZipArchive
  • CallCallback() : CZipStorage
  • cbActions : CZipArchive
  • cbAdd : CZipArchive
  • cbAddStore : CZipArchive
  • cbAddTmp : CZipArchive
  • cbAll : CZipArchive
  • cbDelete : CZipArchive
  • cbDeleteCnt : CZipArchive
  • cbExtract : CZipArchive
  • cbGetFromArchive : CZipArchive
  • cbNextValue : CZipArchive
  • cbNothing : CZipArchive
  • cbRename : CZipArchive
  • cbReplace : CZipArchive
  • cbSave : CZipArchive
  • cbSubActions : CZipArchive
  • cbTest : CZipArchive
  • cdirNotFound : CZipException
  • ChangeDisk() : CZipStorage
  • ChangePkzipRead() : CZipStorage
  • ChangeTdRead() : CZipStorage
  • CheckCrcAndSizes() : CZipFileHeader
  • CheckForError() : CZipArchive
  • Clear() : CZipCentralDir
  • Close() : CZipStorage, CZipArchive
  • CloseAfterException : CZipArchive
  • CloseFile() : CZipCentralDir, CZipArchive
  • CloseFileWithNoUpdate() : CZipArchive
  • CloseNewFile() : CZipCentralDir, CZipArchive
  • CompareElement() : CZipCentralDir
  • compress : CZipArchive
  • CompressionEfficient() : CZipFileHeader
  • ConvertAll() : CZipCentralDir
  • ConvertFileName() : CZipCentralDir
  • CryptCheck() : CZipArchive
  • CryptCRC32() : CZipArchive
  • CryptCryptHeader() : CZipArchive
  • CryptDecode() : CZipArchive
  • CryptDecodeBuffer() : CZipArchive
  • CryptDecryptByte() : CZipArchive
  • CryptEncode() : CZipArchive
  • CryptEncodeBuffer() : CZipArchive
  • CryptInitKeys() : CZipArchive
  • CryptUpdateKeys() : CZipArchive
  • CurrentFile() : CZipArchive
  • CWildcard() : CZipArchive::CWildcard
  • CZipException() : CZipException
  • CZipPathComponent() : CZipPathComponent

- d -

  • dataError : CZipException
  • Defaults() : CZipAddNewFileInfo
  • DeleteFile() : CZipArchive
  • DeleteFiles() : CZipArchive
  • dirWithSize : CZipException

- e -

  • EmptyPtrList() : CZipArchive
  • EmptyWriteBuffer() : CZipStorage
  • EnableFindFast() : CZipCentralDir, CZipArchive
  • errNo : CZipException
  • extract : CZipArchive
  • ExtractFile() : CZipArchive

- f -

  • ffCaseSens : CZipArchive
  • FFCaseSens : CZipArchive
  • ffDefault : CZipArchive
  • ffNoCaseSens : CZipArchive
  • FinalizeSpan() : CZipStorage
  • FindFile() : CZipCentralDir, CZipArchive
  • FindFileNameIndex() : CZipCentralDir
  • FindMatches() : CZipArchive
  • Flush() : CZipStorage, CZipArchive
  • FlushFile() : CZipStorage

- g -

  • generic : CZipException
  • GetAdvanced() : CZipArchive
  • GetArchivePath() : CZipArchive
  • GetAutoFlush() : CZipArchive
  • GetCallback() : CZipArchive
  • GetCentralDirInfo() : CZipArchive
  • GetCentralDirSize() : CZipArchive
  • GetComment() : CZipFileHeader
  • GetCommentSize() : CZipFileHeader
  • GetCompressionRatio() : CZipFileHeader
  • GetCount() : CZipArchive
  • GetCrcAndSizes() : CZipFileHeader
  • GetCRCTable() : CZipArchive
  • GetCurrentDisk() : CZipStorage, CZipArchive
  • GetEffComprSize() : CZipFileHeader
  • GetErrorDescription() : CZipException
  • GetErrorMessage() : CZipException
  • GetExtraFieldSize() : CZipFileHeader
  • GetFileDrive() : CZipPathComponent
  • GetFileExt() : CZipPathComponent
  • GetFileInfo() : CZipArchive
  • GetFileName() : CZipPathComponent, CZipFileHeader
  • GetFileNameSize() : CZipFileHeader
  • GetFilePath() : CZipPathComponent
  • GetFileTitle() : CZipPathComponent
  • GetFindFastIndex() : CZipCentralDir, CZipArchive
  • GetFreeInBuffer() : CZipStorage
  • GetFreeVolumeSpace() : CZipStorage
  • GetFromArchive() : CZipArchive
  • GetFullPath() : CZipPathComponent
  • GetGlobalComment() : CZipArchive
  • GetIndexes() : CZipArchive
  • GetInfo() : CZipCentralDir
  • GetInternalErrorDescription() : CZipException
  • GetLocalExtraField() : CZipArchive
  • GetNoDrive() : CZipPathComponent
  • GetOriginalAttributes() : CZipFileHeader
  • GetPassword() : CZipArchive
  • GetPosition() : CZipStorage
  • GetProperHeaderFileName() : CZipCentralDir
  • GetRootPath() : CZipArchive
  • GetSize() : CZipFileHeader, CZipCentralDir
  • GetSpanMode() : CZipArchive
  • GetStep() : CZipActionCallback
  • GetStorage() : CZipArchive
  • GetSystemAttr() : CZipFileHeader
  • GetSystemCompatibility() : CZipFileHeader, CZipArchive
  • GetSystemErrorDescription() : CZipException
  • GetTdVolumeName() : CZipStorage
  • GetTempPath() : CZipArchive
  • GetTime() : CZipFileHeader

- h -

  • HasEndingSeparator() : CZipPathComponent

- i -

  • Init() : CZipActionCallback, CZipCentralDir, CZipArchive::CZipInternalInfo
  • InsertFindFastElement() : CZipCentralDir
  • internal : CZipException
  • IsClosed() : CZipArchive
  • IsDataDescr() : CZipFileHeader
  • IsDirectory() : CZipFileHeader
  • IsEncrypted() : CZipFileHeader
  • IsFindFastEnabled() : CZipCentralDir
  • IsMatch() : CZipArchive::CWildcard
  • IsPattern() : CZipArchive::CWildcard
  • IsPatternValid() : CZipArchive::CWildcard
  • IsReadOnly() : CZipStorage, CZipArchive
  • IsSeparator() : CZipPathComponent
  • IsSpanMode() : CZipStorage
  • IsValidIndex() : CZipCentralDir

- l -

  • LeftToDo() : CZipActionCallback
  • Locate() : CZipCentralDir

- m -

  • m_bAutoFlush : CZipArchive
  • m_bCaseSensitive : CZipCentralDir, CZipArchive
  • m_bConvertAfterOpen : CZipCentralDir
  • m_bDetectZlibMemoryLeaks : CZipArchive
  • m_bFindFastEnabled : CZipCentralDir
  • m_bFullPath : CZipAddNewFileInfo
  • m_bIgnoreCRC : CZipArchive
  • m_bInMemory : CZipStorage
  • m_bNewSpan : CZipStorage
  • m_bOnDisk : CZipCentralDir::Info
  • m_bReadOnly : CZipStorage
  • m_bRemoveDriveLetter : CZipArchive
  • m_callbacks : CZipArchive
  • m_centralDir : CZipArchive
  • m_cSeparator : CZipPathComponent
  • m_findarray : CZipCentralDir
  • m_gszCopyright : CZipArchive
  • m_gszExtHeaderSignat : CZipStorage
  • m_gszLocalSignature : CZipFileHeader
  • m_gszSignature : CZipFileHeader, CZipCentralDir
  • m_headers : CZipCentralDir
  • m_iArchiveSystCompatib : CZipArchive
  • m_iBufferSize : CZipCentralDir, CZipArchive::CZipInternalInfo
  • m_iBytesWritten : CZipStorage
  • m_iCause : CZipException
  • m_iComprLevel : CZipAddNewFileInfo
  • m_iCurrentDisk : CZipStorage
  • m_iFileOpened : CZipArchive
  • m_info : CZipCentralDir, CZipArchive
  • m_internalfile : CZipStorage
  • m_iReplaceIndex : CZipAddNewFileInfo
  • m_iSmartLevel : CZipAddNewFileInfo
  • m_iSpanMode : CZipStorage
  • m_iStep : CZipActionCallback
  • m_iTdSpanData : CZipStorage
  • m_iType : CZipActionCallback
  • m_iWriteBufferSize : CZipStorage
  • m_keys : CZipArchive
  • m_list : CZipArchive
  • m_nBufSize : CZipAddNewFileInfo
  • m_pBuffer : CZipArchive::CZipInternalInfo
  • m_pChangeDiskFunc : CZipStorage
  • m_pCompare : CZipCentralDir
  • m_pExtraField : CZipFileHeader
  • m_pFile : CZipStorage, CZipAddNewFileInfo
  • m_pHeader : CZipCentralDir::CZipFindFast
  • m_pLocalExtraField : CZipCentralDir
  • m_pOpenedFile : CZipCentralDir
  • m_pStorage : CZipCentralDir
  • m_pszComment : CZipFileHeader, CZipCentralDir
  • m_pszFileName : CZipFileHeader
  • m_pszPassword : CZipArchive
  • m_pWriteBuffer : CZipStorage
  • m_pZipCompare : CZipArchive
  • m_storage : CZipArchive
  • m_stream : CZipArchive::CZipInternalInfo
  • m_szDirectory : CZipPathComponent
  • m_szDrive : CZipPathComponent
  • m_szExternalFile : CZipCallback
  • m_szFileExt : CZipPathComponent
  • m_szFileInZip : CZipActionCallback
  • m_szFileName : CZipException
  • m_szFileNameInZip : CZipAddNewFileInfo
  • m_szFilePath : CZipAddNewFileInfo
  • m_szFileTitle : CZipPathComponent
  • m_szPrefix : CZipPathComponent
  • m_szRootPath : CZipArchive
  • m_szSignature : CZipFileHeader, CZipCentralDir
  • m_szSpanExtension : CZipStorage
  • m_szTempPath : CZipArchive
  • m_uBytesBeforeZip : CZipCentralDir::Info
  • m_uBytesInWriteBuffer : CZipStorage
  • m_uCentrDirPos : CZipCentralDir::Info
  • m_uComprLeft : CZipArchive::CZipInternalInfo
  • m_uComprSize : CZipFileHeader
  • m_uCrc32 : CZipFileHeader, CZipArchive::CZipInternalInfo
  • m_uCurrentVolSize : CZipStorage
  • m_uDiskEntriesNo : CZipCentralDir::Info
  • m_uDiskNeeded : CZipSpanCallback
  • m_uDiskStart : CZipFileHeader
  • m_uDiskWithCD : CZipCentralDir::Info
  • m_uEntriesNumber : CZipCentralDir::Info
  • m_uExternalAttr : CZipFileHeader
  • m_uFlag : CZipFileHeader
  • m_uIndex : CZipCentralDir::CZipFindFast
  • m_uInternalAttr : CZipFileHeader
  • m_uMethod : CZipFileHeader
  • m_uModDate : CZipFileHeader
  • m_uModTime : CZipFileHeader
  • m_uOffset : CZipFileHeader, CZipCentralDir::Info
  • m_uSize : CZipCentralDir::Info
  • m_uThisDisk : CZipCentralDir::Info
  • m_uTotalSoFar : CZipActionCallback
  • m_uTotalToDo : CZipActionCallback
  • m_uUncomprLeft : CZipArchive::CZipInternalInfo
  • m_uUncomprSize : CZipFileHeader
  • m_uVersionMadeBy : CZipFileHeader
  • m_uVersionNeeded : CZipFileHeader
  • m_uVolumeFreeInBuffer : CZipStorage
  • MakeSpaceForReplace() : CZipArchive
  • Match() : CZipArchive::CWildcard
  • matchAbort : CZipArchive::CWildcard
  • matchEnd : CZipArchive::CWildcard
  • matchLiteral : CZipArchive::CWildcard
  • matchNone : CZipArchive::CWildcard
  • matchPattern : CZipArchive::CWildcard
  • matchRange : CZipArchive::CWildcard
  • matchValid : CZipArchive::CWildcard
  • memError : CZipException
  • MovePackedFiles() : CZipArchive

- n -

  • needDict : CZipException
  • NextDisk() : CZipStorage
  • noCallback : CZipException
  • noError : CZipException
  • nonRemovable : CZipException
  • noSpan : CZipStorage
  • nothing : CZipArchive
  • notRemoved : CZipException
  • notRenamed : CZipException

- o -

  • Open() : CZipStorage, CZipArchive
  • OpenFile() : CZipStorage, CZipCentralDir, CZipArchive
  • OpenFileType : CZipArchive
  • OpenInternal() : CZipArchive
  • OpenMode : CZipArchive
  • OpenNewFile() : CZipArchive
  • operator()() : CZipActionCallback

- p -

  • Pattern : CZipArchive::CWildcard
  • patternClose : CZipArchive::CWildcard
  • patternEmpty : CZipArchive::CWildcard
  • patternEsc : CZipArchive::CWildcard
  • patternRange : CZipArchive::CWildcard
  • patternValid : CZipArchive::CWildcard
  • pkzipSpan : CZipStorage
  • platfNotSupp : CZipException
  • prAuto : CZipArchive
  • prDir : CZipArchive
  • Predict : CZipArchive
  • PredictExtractedFileName() : CZipArchive
  • PredictFileNameInZip() : CZipArchive
  • PrepareData() : CZipFileHeader
  • prFile : CZipArchive

- r -

  • Read() : CZipStorage, CZipFileHeader, CZipCentralDir
  • ReadFile() : CZipArchive
  • ReadHeaders() : CZipCentralDir
  • ReadLocal() : CZipFileHeader
  • RemoveAll() : CZipCentralDir
  • RemoveDataDescr() : CZipCentralDir
  • RemoveFile() : CZipCentralDir
  • RemoveFromDisk() : CZipCentralDir
  • RemoveHeaders() : CZipCentralDir
  • RemoveLast() : CZipArchive
  • RemoveLastFile() : CZipCentralDir
  • RemovePathBeginning() : CZipArchive
  • RemoveSeparators() : CZipPathComponent
  • RemoveSeparatorsLeft() : CZipPathComponent
  • RenameFile() : CZipCentralDir, CZipArchive
  • RenameLastFileInTDSpan() : CZipStorage

- s -

  • SetAdvanced() : CZipArchive
  • SetAutoFlush() : CZipArchive
  • SetCallback() : CZipArchive
  • SetCaseSensitivity() : CZipArchive
  • SetComment() : CZipFileHeader
  • SetConvertAfterOpen() : CZipArchive
  • SetDetectZlibMemoryLeaks() : CZipArchive
  • SetExtension() : CZipPathComponent
  • SetExtraField() : CZipArchive
  • SetFileComment() : CZipArchive
  • SetFileHeaderAttr() : CZipArchive
  • SetFileName() : CZipFileHeader
  • SetFileTitle() : CZipPathComponent
  • SetFullPath() : CZipPathComponent
  • SetGlobalComment() : CZipArchive
  • SetIgnoreCRC() : CZipArchive
  • SetPassword() : CZipArchive
  • SetPattern() : CZipArchive::CWildcard
  • SetRootPath() : CZipArchive
  • SetSpanCallback() : CZipArchive
  • SetSystemAttr() : CZipFileHeader
  • SetSystemCompatibility() : CZipFileHeader, CZipArchive
  • SetTempPath() : CZipArchive
  • SetTime() : CZipFileHeader
  • SetTotal() : CZipActionCallback
  • SetVersion() : CZipFileHeader
  • SingleToWide() : CZipArchive
  • Smartness : CZipArchive
  • SortHeaders() : CZipCentralDir
  • streamEnd : CZipException
  • streamError : CZipException
  • suggestedAuto : CZipStorage
  • suggestedTd : CZipStorage

- t -

  • tdSpan : CZipStorage
  • TestFile() : CZipArchive
  • Throw() : CZipException
  • ThrowError() : CZipStorage, CZipCentralDir, CZipArchive
  • tooLongFileName : CZipException
  • tooManyVolumes : CZipException
  • TrimRootPath() : CZipArchive

- u -

  • UpdateReplaceIndex() : CZipArchive
  • UpdateSpanMode() : CZipStorage

- v -

  • versionError : CZipException
  • VolumeLeft() : CZipStorage

- w -

  • WideToSingle() : CZipArchive
  • WillBeDuplicated() : CZipArchive
  • Write() : CZipStorage, CZipFileHeader, CZipCentralDir
  • WriteCentralDirectory() : CZipArchive
  • WriteCentralEnd() : CZipCentralDir
  • WriteHeaders() : CZipCentralDir
  • WriteInternalBuffer() : CZipStorage
  • WriteLocal() : CZipFileHeader
  • WriteNewFile() : CZipArchive

- z -

  • zipCreate : CZipArchive
  • zipCreateSpan : CZipArchive
  • ZipErrors : CZipException
  • zipOpen : CZipArchive
  • zipOpenReadOnly : CZipArchive
  • zipsmCheckForEff : CZipArchive
  • zipsmCheckForEffInMem : CZipArchive
  • zipsmCPassDir : CZipArchive
  • zipsmCPFile0 : CZipArchive
  • zipsmInternal01 : CZipArchive
  • zipsmLazy : CZipArchive
  • zipsmMemoryFlag : CZipArchive
  • zipsmNotCompSmall : CZipArchive
  • zipsmSafeSmart : CZipArchive
  • zipsmSmartAdd : CZipArchive
  • zipsmSmartest : CZipArchive
  • zipsmSmartPass : CZipArchive
  • ZipSpanMode : CZipStorage
  • ZlibErrToZip() : CZipException
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ziparchv Namespace Reference

A helper namespace. More...

Detailed Description

A helper namespace.

Members
  • CZipFileMapping

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


ZipCompatibility Namespace Reference

Functions that provides the proper conversion of attributes and filename strings between different system platforms. More...

Enumerations

enum ZipPlatforms {
zcDosFat, zcAmiga, zcVaxVms, zcUnix,
zcVmCms, zcAtari, zcOs2Hpfs, zcMacintosh,
zcZsystem, zcCpm, zcNtfs
}
The codes of the compatibility of the file attribute information. More...

Functions

bool | IsPlatformSupported (int iCode)
Check whether the system with the given code is supported by the ZipArchive library.

DWORD | ConvertToSystem (DWORD uAttr, int iFromSystem, int iToSystem)
Convert the system attributes between different system platforms.

void | FileNameUpdate (CZipFileHeader &header, bool bFromZip)
Convert the filename of the file inside archive.

void | SlashBackslashChg (CZipAutoBuffer &buffer, bool bReplaceSlash)
Change the slash to backslash or vice-versa in buffer.

Detailed Description

Functions that provides the proper conversion of attributes and filename strings between different system platforms.

Enumeration Type Documentation

enum ZipCompatibility::ZipPlatforms

The codes of the compatibility of the file attribute information.

See also:
CZipArchive::GetSystemCompatibility

CZipFileHeader::GetSystemCompatibility

ZipPlatform::GetSystemID

Enumeration values:
zcDosFat | MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems).
zcAmiga | Amiga.
zcVaxVms | VAX/VMS.
zcUnix | Unix / Linux.
zcVmCms | VM/CMS.
zcAtari | Atari ST.
zcOs2Hpfs | OS/2 H.P.F.S.
zcMacintosh | Macintosh.
zcZsystem | Z-System.
zcCpm | CP/M.
zcNtfs | Windows NTFS.

Definition at line 46 of file ZipCompatibility.h.

Function Documentation

DWORD ConvertToSystem | ( | DWORD | uAttr,
 |  | int | iFromSystem,
 |  | int | iToSystem
 | ) |

Convert the system attributes between different system platforms.

It calls one of the converting functions.

Parameters:
uAttr | attributes to convert
iFromSystem | system code to convert from
iToSystem | system code to convert to
Returns:
the converted attributes
Note:
Throws exceptions.
See also:
ZipPlatforms

void FileNameUpdate | ( | CZipFileHeader & | header,
 |  | bool | bFromZip
 | ) |

Convert the filename of the file inside archive.

This conversion may not change the size of the filename, otherwise an error may occur in #ReadLocal while comparing the filename sizes.

Parameters:
header | the file header to have the filename converted
bFromZip | if true convert the path from the from it is stored in the archive to the current system compatible form; otherwise vice-versa.
See also:
CZipCentralDir::ConvertFileName

Referenced by CZipCentralDir::ConvertFileName().

bool IsPlatformSupported ( int iCode )

Check whether the system with the given code is supported by the ZipArchive library.

Parameters:
iCode the system code
Returns:
true if supported

void SlashBackslashChg | ( | CZipAutoBuffer & | buffer,
 |  | bool | bReplaceSlash
 | ) |

Change the slash to backslash or vice-versa in buffer.

Parameters:
buffer
bReplaceSlash if true, change slash to backslash

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


ZipPlatform Namespace Reference

Interface to the system API. More...

Various operations on files and directories.

All the functions which are returning a bool value, return true when the operation was successful.

ZIP_API bool | GetCurrentDirectory (CZipString &sz)
Get the current directory and store it in sz.

ZIP_API bool | ChangeDirectory (LPCTSTR lpDirectory)
ZIP_API bool | SetFileAttr (LPCTSTR lpFileName, DWORD uAttr)
ZIP_API bool | GetFileAttr (LPCTSTR lpFileName, DWORD &uAttr)
ZIP_API bool | GetFileModTime (LPCTSTR lpFileName, time_t &ttime)
get the file modification time

ZIP_API bool | GetFileSize (LPCTSTR lpszFileName, DWORD &dSize)
ZIP_API bool | SetFileModTime (LPCTSTR lpFileName, time_t ttime)
set the file modification time

ZIP_API bool | CreateDirectory (LPCTSTR lpDirectory)
ZIP_API bool | SetVolLabel (LPCTSTR lpszPath, LPCTSTR lpszLabel)
lpszPath may point to a file on the device

ZIP_API bool | ForceDirectory (LPCTSTR lpDirectory)
create nested directories at once

ZIP_API bool | RemoveFile (LPCTSTR lpszFileName, bool bThrow=true)
ZIP_API bool | RenameFile (LPCTSTR lpszOldName, LPCTSTR lpszNewName, bool bThrow=true)
ZIP_API bool | TruncateFile (int iDes, DWORD iSize)
ZIP_API int | OpenFile (LPCTSTR lpszFileName, UINT iMode, int iShareMode)
ZIP_API bool | FlushFile (int iDes)
flush the file to the disk.

ZIP_API int | GetFileSystemHandle (int iDes)
return the underlying system handle

Functions

ZIP_API bool | GetSystemCaseSensitivity ()
return the default system case-sensitivity

ZIP_API int | GetSystemID ()
ZIP_API DWORD | GetDefaultAttributes ()
ZIP_API DWORD | GetDefaultDirAttributes ()
ZIP_API DWORD | GetDeviceFreeSpace (LPCTSTR lpszPath)
Get the free space on the device pointed by lpszPath.

ZIP_API CZipString | GetTmpFileName (LPCTSTR lpszPath=NULL, DWORD iSizeNeeded=DWORD(-1))
Return the temporary file name ensuring there is enough size in the destination directory,.

ZIP_API bool | DirectoryExists (LPCTSTR lpszDir)
ZIP_API bool | IsDriveRemovable (LPCTSTR lpszFilePath)
ZIP_API bool | IsDirectory (DWORD uAttr)
ZIP_API void | AnsiOem (CZipAutoBuffer &buffer, bool bAnsiToOem)
Perform the translation between ANSI and OEM character sets.

ZIP_API int | FileExists (LPCTSTR lpszName)
Check if the given file or directory exists.

ZIP_API int | WideToSingle (LPCTSTR lpWide, CZipAutoBuffer &szSingle)
Convert wide character string to single character string.

ZIP_API int | SingleToWide (const CZipAutoBuffer &szSingle, CZipString &szWide)
Convert single character string to wide character string.

Detailed Description

Interface to the system API.

All functions have a system - specific implementation .

Function Documentation

ZIP_API void AnsiOem | ( | CZipAutoBuffer & | buffer,
 |  | bool | bAnsiToOem
 | ) |

Perform the translation between ANSI and OEM character sets.

Remarks:
  • The conversion is performed only for the zip archives created under Windows platform.
  • Windows archiving programs convert a filename to OEM before adding it to the archive.
  • OEM conversion only influences the ANSI values above 126, so it affects only strings containing international characters.
Parameters:
buffer | buffer to be translated
bAnsiToOem | if true, convert ANSI to OEM if false, OEM to ANSI

ZIP_API bool DirectoryExists ( LPCTSTR lpszDir )

Parameters:
lpszDir
Returns:
true, if lpszDir directory exists; otherwise false;

ZIP_API int FileExists ( LPCTSTR lpszName )

Check if the given file or directory exists.

Parameters:
lpszName
Returns:
  • -1 if the given file is a directory
  • 1 a file
  • 0 if there is no such a file

ZIP_API DWORD GetDefaultAttributes ( )

Returns:
the default file attributes for the current system

ZIP_API DWORD GetDefaultDirAttributes ( )

Returns:
the default directory attributes for the current system

ZIP_API int GetSystemID ( )

Returns:
A current system name tag. May be one of ZipCompatibility::ZipPlatforms values.
See also:
CZipArchive::GetSystemCompatibility

ZIP_API CZipString GetTmpFileName | ( | LPCTSTR | lpszPath = NULL,
 |  | DWORD | iSizeNeeded = DWORD(-1)
 | ) |

Return the temporary file name ensuring there is enough size in the destination directory,.

Checking for the size is disabled by default.

ZIP_API bool IsDirectory ( DWORD uAttr )

Parameters:
uAttr attributes value to test
Returns:
true if the attributes are the directory attributes

ZIP_API bool IsDriveRemovable ( LPCTSTR lpszFilePath )

Parameters:
lpszFilePath may point to a file path or a directory on the device
Returns:
true if the drive is removable. Implemented only on Windows system, in all others always returns true.

ZIP_API int SingleToWide | ( | const CZipAutoBuffer & | szSingle,
 |  | CZipString & | szWide
 | ) |

Convert single character string to wide character string.

Parameters:
szSingle | single string to convert (no terminating NULL character at the end)
szWide | receives the wide string after the conversion
Returns:
the length of the string after the conversion (without the NULL character), or -1 when not succeeded
Note:
Only in UNICODE version.

ZIP_API int WideToSingle | ( | LPCTSTR | lpWide,
 |  | CZipAutoBuffer & | szSingle
 | ) |

Convert wide character string to single character string.

Parameters:
lpWide | Wide string to convert
szSingle | buffer to receive converted string (without the terminating NULL character)
Returns:
the szSingle buffer length, or -1 when not succeeded
Note:
Only in UNICODE version.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Cryptography

Methods performing data encryption and decryption and attributes used by them. More...

Functions

void | CZipArchive::CryptDecodeBuffer (DWORD uCount)
Decode uCount bytes from the internal buffer.

void | CZipArchive::CryptEncodeBuffer ()
Encode the internal buffer.

void | CZipArchive::CryptEncode (char &c)
Encode the character c and update encryption keys .

void | CZipArchive::CryptCryptHeader (long iCrc, CZipAutoBuffer &buf)
Create an encryption header for the new file in the archive.

DWORD | CZipArchive::CryptCRC32 (DWORD l, char c)
void | CZipArchive::CryptDecode (char &c)
Decode the character c and update encryption keys .

char | CZipArchive::CryptDecryptByte ()
bool | CZipArchive::CryptCheck ()
Decrypt the encryption header and check its control value.

void | CZipArchive::CryptUpdateKeys (char c)
Update encryption keys with the given value.

void | CZipArchive::CryptInitKeys ()
Initialize encryption keys .

Variables

CZipAutoBuffer CZipArchive::m_pszPassword
The archive password.

DWORD | CZipArchive::m_keys [3]
Encryption keys.

Detailed Description

Methods performing data encryption and decryption and attributes used by them.

Function Documentation

bool CZipArchive::CryptCheck ( ) [protected, inherited]

Decrypt the encryption header and check its control value.

The control value depends on the presence of the data descriptor.

Returns:
true if the control value is correct
See also:
CryptCryptHeader

DWORD CZipArchive::CryptCRC32 | ( | DWORD | l,
 |  | char | c
 | ) | [protected, inherited]

void CZipArchive::CryptCryptHeader | ( | long | iCrc,
 |  | CZipAutoBuffer & | buf
 | ) | [protected, inherited]

Create an encryption header for the new file in the archive.

Parameters:
iCrc | A control value. Use the two lower bytes of CZipFileHeader::m_uModTime. This entails the need for a data description presence at the end of the compressed data. We cannot use the real CRC now, because we don't know it yet.
buf | a buffer to receive the header
See also:
CryptCheck

void CZipArchive::CryptDecodeBuffer ( DWORD uCount ) [protected, inherited]

Decode uCount bytes from the internal buffer.

See also:
m_info

CZipInternalInfo::m_pBuffer

char CZipArchive::CryptDecryptByte ( ) [protected, inherited]

void CZipArchive::CryptEncodeBuffer ( ) [protected, inherited]

Encode the internal buffer.

See also:
m_info

CZipInternalInfo::m_pBuffer

void CZipArchive::CryptUpdateKeys ( char c ) [protected, inherited]

Update encryption keys with the given value.

Variable Documentation

DWORD CZipArchive::m_keys[3] [protected, inherited]

Encryption keys.

The key values are initialized using a supplied encryption password.

See also:
CryptInitKeys

Definition at line 2043 of file ZipArchive.h.

CZipAutoBuffer CZipArchive::m_pszPassword [protected, inherited]

The archive password.

If empty, the new file will not be encrypted.

Definition at line 2036 of file ZipArchive.h.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Namespace Member Index

All | Functions | Enumerations | Enumeration values
a | c | d | f | g | i | s | w | z

Here is a list of all documented namespace members with links to the namespaces they belong to:

- a -

  • AnsiOem() : ZipPlatform

- c -

  • ConvertToSystem() : ZipCompatibility

- d -

  • DirectoryExists() : ZipPlatform

- f -

  • FileExists() : ZipPlatform
  • FileNameUpdate() : ZipCompatibility
  • FlushFile() : ZipPlatform
  • ForceDirectory() : ZipPlatform

- g -

  • GetCurrentDirectory() : ZipPlatform
  • GetDefaultAttributes() : ZipPlatform
  • GetDefaultDirAttributes() : ZipPlatform
  • GetDeviceFreeSpace() : ZipPlatform
  • GetFileModTime() : ZipPlatform
  • GetFileSystemHandle() : ZipPlatform
  • GetSystemCaseSensitivity() : ZipPlatform
  • GetSystemID() : ZipPlatform
  • GetTmpFileName() : ZipPlatform

- i -

  • IsDirectory() : ZipPlatform
  • IsDriveRemovable() : ZipPlatform
  • IsPlatformSupported() : ZipCompatibility

- s -

  • SetFileModTime() : ZipPlatform
  • SetVolLabel() : ZipPlatform
  • SingleToWide() : ZipPlatform
  • SlashBackslashChg() : ZipCompatibility

- w -

  • WideToSingle() : ZipPlatform

- z -

  • zcAmiga : ZipCompatibility
  • zcAtari : ZipCompatibility
  • zcCpm : ZipCompatibility
  • zcDosFat : ZipCompatibility
  • zcMacintosh : ZipCompatibility
  • zcNtfs : ZipCompatibility
  • zcOs2Hpfs : ZipCompatibility
  • zcUnix : ZipCompatibility
  • zcVaxVms : ZipCompatibility
  • zcVmCms : ZipCompatibility
  • zcZsystem : ZipCompatibility
  • ZipPlatforms : ZipCompatibility
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Revision history

ver 2.4.1 (06-2004)

Workarounds:

  • exception thrown in CFile::GetFilePath() by MFC when working on offline files under Windows XP (thanks to Richard Stooke for spotting and solving this).

ver 2.4.0 (03-2004)

Changes:

  • zlib library updated to version 1.2.1; See the zlib library change log.
  • CZipArchive::CloseFileAfterTestFailed renamed to CZipArchive::CloseFileWithNoUpdate

ver 2.3.6 (11-2003)

Bugs fixed:

  • not proper string comparison in CZipCentralDir::FindFile (thanks to Igor Green for reporting it)

ver 2.3.5 (09-2003)

Features added:

  • method CZipArchive::ExtractFile(WORD, CZipMemFile&, bool, DWORD) has a new parameter added, bRewind, which determines whether position the memory file pointer at the beginning of the decompressed data or not (thanks to Tim Musschoot for a remark)

Changes:

  • method CZipArchive::ExtractFile(WORD, CZipMemFile&, bool, DWORD) positions the memory file pointer at the beginning of the compressed data after compression
  • CZipArchive::AddNewFile method now automaticaly sets the value of the file pointer (CZipAddNewFileInfo::m_pFile), if set, to the beginning of the file - performs CZipAbstractFile::SeekToBegin (thanks to Michael A. Rusakov for pointing this out)
  • compatibility with STLPort (thanks to Ben Discoe for the changes)

Bugs fixed:

  • compilation errors on Solaris and Linux box gcc 3.2.2 (thanks to Aditya Dwivedula for the fixes)
  • when creating multi-disk volume, the 'zip' extension was not properly appended
  • in methods CZipArchive::AddNewFile(LPCTSTR,int,bool,int, unsigned long), CZipArchive::AddNewFile(LPCTSTR,LPCTSTR,int,int, unsigned long) and CZipArchive::AddNewFile(CZipMemFile& mf,LPCTSTR,int,int, unsigned long) the smartnes level was always set to CZipArchive::zipsmSafeSmart regardless of iSmartLevel parameter (thanks to Antonio Maiorano for reporting)
  • rare problems under Windows with STL version (thanks to Daniel Walton for the fix)

ver 2.3.4 (06-2003)

Bugs fixed:

  • problems with extracting some archives (very rare) (thanks to Ben Jos Walbeehm for the fix)
  • problems with extracting some archives created under Linux (thanks to Jürgen Marquardt for reporting)
  • small compilation errors under MSVC++ .NET (thanks to Darren Whobrey for the fixes)
  • setting password in zippie (thanks to Amnon David for the fix)

Changes:

  • CZipArchive::TestFile throws an exception now if CZipArchive::CloseFile returned -1. It makes it work as described in the documentation that an exception is thrown when the file is corrupted (thanks to Silvio Scarpati for pointing this out)
  • it is now possible to add an already opened file to an archive (thanks to Kristjan Bjarnason for the change)

ver 2.3.3 (01-2003)

Features added:

  • CZipArchive::m_bRemoveDriveLetter option added

Bugs fixed:

  • not extracting files from the last volume when opening an existing archive created in TDSpan mode, where the last volume filename has other extension than ".zip"
  • added PKZIP_BUG_WORKAROUND definition to the zlib.h file distributed with ZipArchive library as well as to ZipArchive project files (in case the zlib library is replaced with a new version). It deals with pkzip bug existing in some archives (thanks to Ben Jos Walbeehm for reporting).

ver 2.3.2 (08-2002)

Bug fixed:

  • problem with creating disk spanning archives in the STL version of the library (thanks to Luiz Rafael Culik for reporting)

ver 2.3.1 (05-2002)

Bug fixed:

  • using CZipMemFile::CZipMemFile(BYTE* , UINT , long ) constructor could cause memory errors (thanks to Laurent Doré)

ver 2.3 (04-2002) (includes changes and fixes from 2.2a to 2.2c)

Features added:

  • Visual Studio .NET compatibility
  • methods CZipArchive::GetFromArchive added, which allow copying files from another archive without decompressing them
  • many times requested replacing of files in the archive feature; it works with methods CZipArchive::GetFromArchive and a new CZipArchive::AddNewFile(CZipAddNewFileInfo& ) which was introduced due to increasing parameters count
  • added method CZipArchive::RenameFile which renames a file in the archive maintaining its physical position inside the archive
  • projects and necessary changes for compiling ZipArchive as a DLL version (courtesy of Jonathan Reis) - see DLL version and Compiling as DLL
    ( they are not embedded into existing ones, but made separated, since the DLL version needs separated project for zlib.dll and for the static version, zlib library is already included in the projects to minimize linking problems with applications)
  • added CZipArchive::WillBeDuplicated which lets you check quickly if the given filename would duplicate an existing one in the archive
  • CZipArchive::GetCount has now an additional parameter and can return the number of files in the archive not counting the directories
  • CZipArchive::Close has been given also an additional parameter (bUpdateTimeStamp) and can set the modification time of the zip archive to the modification time of the newest file inside the archive
  • method CZipArchive::GetIndexes added
  • ZipArc application updated to support renaming, replacing (as well as updating files in the archive) and getting compressed files from another archive

Changes:

  • zlib library updated to version 1.1.4 that fixes the security vulnerability in version 1.1.3 as described in http://www.zlib.org/advisory-2002-03-11.txt
  • if the file inside the archive has the wrong date/time stamp set, then the extracted file is given the current time instead of reporting an error
  • a little change in CZipArchive::PredictFileNameInZip : parameter bAnsiOem changed to bExactly (apart from the name, the meaning has also been changed)
  • removed parameter bFileNameOnly from CZipArchive::DeleteFiles(const CZipStringArray &);

Bugs fixed:

  • eliminated possible errors when using CZipArchive::zipsmCheckForEff with disk-spanning mode
  • reading some files created with other archivers failed occasionally in CZipFileHeader::ReadLocal (thanks to Christian von Seydlitz)
  • while a file recompression (smartness level included CZipArchive::zipsmCheckForEff) if the AutoFlush feature was enabled, there were redundant bytes added to the archive (thanks to Roman Scherzer)
  • aborting extraction of multi-disk archive caused errors (thanks to Sabina Terenzi)
  • some GUI fixes in ZipArc

Known issues:

  • under Windows XP, in TD disk spanning mode, when the central directory is not entirely written on the last volume (but divided between volumes), SHGetFileInfo hangs up (it is used i.e. by CFileDialog::DoModal) - Windows probably tries to analize zip structure, but fails becuase it is an additional feature of ZipArchive library to create multi volume archives on non-removable data storage

ver 2.2 (10-2001) Time for global changes

Features added:

  • deleting multiple files from the archive is now way faster - the files are not deleted separately as it was so far, but the library creates a map of holes and continuous areas and moves the data to remain in file over the holes; it means that the data is copied only once and not for every file to delete.
  • callback functions has been replaced by functional objects to make the code cleaner and to make it possible to pass more information during a callback call (see: CZipArchive::SetCallback). The same application written using the library with callback functions and then with functional objects as callbacks (slightly modified) has proven to be circa 15% faster in the latter case (that's why it's in features), inter alia because only data that changes is passed to the callback method, method derived from CZipCallback::Callback can be inlined if defined inside the class declaration). Important issues:
    • it affects the following functions parameters:
      • CZipArchive::AddNewFile,
      • CZipArchive::ExtractFile,
      • CZipArchive::TestFile,
      • CZipArchive::SetSpanCallback
    • the meaning of the parameters passed to a callback functor is different from that what has so far been passed to the callback functions (see CZipCallback)
    • see Action progress notifications (callbacks) if you're not sure how to use functors
  • added callback feature when deleting files
  • added callback feature when saving central directory
  • added possibility to extract or delete files which filenames match the specified wildcard pattern (see CZipArchive::FindMatches)
  • iterating the central directory elements speeded up (hence all the operations that iterate the central directory were speeded up, especially sorting, multiple adding, extracting, testing)
  • the library now doesn't throw an exception if the platform the archive was created under is not supported, but it tries to distinguish files from directories
  • CZipArchive::Flush can be called now for a disk-spanning archive in creation finalizing it then, and yet allows extracting or testing (see the function description for more)
  • function CZipArchive::CloseNewFile can be called after an exception to allow to repair the archive later
  • adding files with one of CZipArchive::AddNewFile functions can be safely aborted in a non-disk-spanning archive (the added data is removed from the archive)
  • added function CZipException::GetErrorMessage for compatibility with MFC CException::GetErrorMessage
  • added parameter bForce to CZipArchive::SetTempPath that creates the directory if it doesn't exists
  • the archive created with the library under Windows can be now correctly extracted under Linux and vice versa without the need for setting the system compatibility of the files
  • function CZipArchive::SetIgnoreCRC added to make possible working with the Java TM Archives (jar)
  • function CZipArchive::GetFindFastIndex added
  • function CZipArchive::GetCentralDirInfo added
  • function CZipArchive::GetCentralDirSize added
  • function CZipArchive::GetCurrentDisk added
  • function CZipArchive::IsReadOnly added
  • function CZipFileHeader::CompressionEfficient added
  • function CZipFileHeader::GetCompressionRatio added
  • const keywords added to functions
  • TRACE messages are now easier to locate in MSVC++ (double clicking gets you directly to the code now)

Changes:

  • if the callback functor's method Callback returns false, a CZipException is thrown with code CZipException::abortedAction or CZipException::abortedSafely;
  • function CZipArchive::DeleteFiles(const CZipStringArray) uses now FindFast array; added bFileNameOnly parameter
  • function CZipArchive::GetNoEntries renamed to GetCount (more standard, easier to type and easier to find at the beginning)
  • the encrypted file is not recompressed again if the difference in sizes before and after compression is the length of the encryption header
  • function CZipArchive::OpenFile throws exception CZipException::badPassword if the password was not set for the encrypted file instead of returning false;
  • versioning shortened

Bugs fixed:

  • CZipStorage::Flush doesn't call now m_pFile->Flush() (it has proven to slow down the archive creation speed significantly) - it is called in different places instead
  • CZipArchive::TestFile sometimes was not detecting wrong password set
  • filenames in zip are now correctly converted after calling CZipArchive::Flush
  • fixed value of CZipArchive::zipsmCheckForEffInMem; the bug cause the temporary file to be always created in memory
  • ZipPlatform::GetDeviceFreeSpace was not working on Windows with other devices than removable (in spite of what is written in MSDN it is sometimes needed to add slash when passing drive name to GetDiskFreeSpace and sometimes not). I'm not sure if this bug concerned all Windows platforms (it was detected on Windows 2000)
  • crash eliminated when the file modification time could not be retrieved (in case of an impossible value e.g. a year is 28980)
  • Unix attributes corrected
  • CZipArchive::ExtractFile had wrong value passed to the callback function

ver 2.1.1 (10-2001)

Features added:

  • Linux version at the beta stage (thanks to Luiz Rafael Culik for help)
  • smart and efficient compression added to CZipArchive::AddNewFile
    inter alia optional compression to a temporary file first or to memory, in a disk spanning mode, to see whether the file is smaller after compression and if it is not then add it without the compression (see also CZipArchive::Smartness)
  • integration of the help system with MSDN made possible (see: Integrating with MSDN)
  • adding a file with the user-specified filename in zip ( CZipArchive::AddNewFile(LPCTSTR , LPCTSTR , int , int , unsigned long ) )
  • adding files from memory and extracting files to memory ( CZipArchive::AddNewFile(CZipMemFile&, LPCTSTR, int, int, unsigned long) and CZipArchive::ExtractFile(WORD, CZipMemFile&, DWORD))
  • function CZipArchive::Flush added - increases the safety when working with zip archives (thanks to Brad Kremer for the idea)
  • function CZipArchive::SetCaseSensitivity added (see the function description which functions it affects)
  • function CZipArchive::PredictFileNameInZip added
  • function CZipArchive::PredictExtractedFileName added
  • function CZipArchive::FindFile speeded up again, the case-sensitivity parameter meaning changed, added possibility to find a filename only without a path (see the function description)
  • function CZipArchive::TrimRootPath function improved
  • function CZipArchive::Close allows now to write the central directory to the archive even after exception, which lets you e.g. repair the archive later
  • obtaining error descriptions (English only) - see CZipException::GetErrorDescription()
  • STL sample application added (a command line archiver which works for both Windows and Linux; located in stl/zippie)
  • in TestZipDlg sample application added switch in options to allow an effective compression
  • several minor enhancements

Changes:

  • CZipPathComponent functions renamed : GetFullFileName -> GetFileName, GetFileName -> GetFileTitle, SetFileName -> SetFileTitle
  • file __[...].zcfg is created depending on the current configuration when using scripts to copy files (see a note at Compiling for different implementations and platforms)

Bugs fixed:

  • when performing a non-case-sensitive search with CZipArchive::FindFile (thanks to Kenny Prole)
  • in CZipString (STL) when using a different locale than English and non-English characters (see STL version for info on how to set your locale in the program)
  • CZipStorage::Flush call now m_pFile->Flush() as well (it might have caused a zip creation problems sometimes)

ver 1.6.6 (08-2001)

Features added:

  • CZipPathComponent understands now a UNC path, so it is possible to extract files over a network (other operations over a network were already possible)
  • sample application updated to reflect previous (ver 1.6.5) and current changes (necessary prefix added to a UNC path following the Windows File Name Conventions : see FAQ)

ver 1.6.5 (07-2001)

Features added:

  • added function CZipArchive::SetRootPath that allows more flexible path manipulations when using CZipArchive::AddNewFile and CZipArchive::ExtractFile
  • ability to set the archive system compatibility to a value different than the current system ID with the function CZipArchive::SetSystemCompatibility()

Bugs fixed:

  • bug which caused not updating the time stamp of an extracted file and an exception being thrown, if the file had the read-only attribute set (thanks to Arnon Meydav)
  • bugs in conversion of Unix attributes
  • directories inside the archive are now recognized properly by Unix archivers if the archive was created for Unix platform

ver 1.6.4 (06-2001)

  • fixed errors that made impossible using CZipMemFile class and creation of the archives in memory

ver 1.6.3 (05-2001)

  • zlib library sources incorporated into ZipArchive library projects (eliminates most often link errors)

ver 1.6.2 (04-2001)

  • ZipPlatform::SetVolLabel() appends now a directory separator to the drive name (lack of it caused errors sometimes)
  • added a simple protection against compiling MFC or STL version without copying the proper files first
  • added several preprocessor directives for Borland compilers

ver 1.6.1 (03-2001)

Features added:

  • non MFC dependent version (STL)
  • porting to different platforms made easier
  • possibility to read zip files created on other platforms than Windows (correct interpretation of file/directory attributes)
  • documentation generated (using Doxygen )

Changes:

  • LICENSING CHANGED
  • overall tuning
  • sample application updated

ver 1.5.1 (02-2001)

Features added:

  • ability to reuse the archive after an exception thrown during extraction
  • added progress control possibilities to CZipArchive::AddNewFile, CZipArchive::ExtractFile, CZipArchive::TestFile
  • when the central directory was not located, the library throws CZipException::cdirNotFound, which allows distinguish from other exceptions (useful when we want to keep prompting the user to insert the last disk in a multi-disk spanning archive).

Changes:

  • CZipArchive::FindFile operation boosted ( thanks to Darin Warling)
  • library name changed to ZipArchive
  • the sample application updated

Bugs fixed:

  • removed bug during extracting an encrypted file with 0 size
  • fixed bug when extracting a file with an extra field in a local file header (CFileHeader::ReadLocal)

ver 1.4.1 (01-2001)

  • Disk numbering in a disk spanning archive begins now from PKBACK# 001 not PKBACK# 000
  • Adding and extracting without a full path possible in CZipArchive::AddNewFile and CZipArchive::ExtractFile.
  • Several minor changes and enhancements
  • Changed names for several classes.

ver 1.3.1 (11-2000)

  • Testing the archive made easier
  • Added support for password encryption and decryption. The encryption used in PKZIP was generously supplied by Roger Schlafly.
  • Support for compiling the sources for Unicode added

ver 1.2.2 (08-2000)

  • Bugs fixed

ver 1.2.1 (06-2000)

the code has been completely rewritten from the very beginning; the main improvements are:
  • multi-disk archive support
  • creation of the disk spanning archives with the user-defined volume size
  • ability to modify existing archives (add, delete files)
  • modification self-extracting archives
  • write buffer used for faster disk write operations
  • one class for zip and unzip functions
  • fast adding, deleting and extracting files with a single function call
ver 1.1.2 (03-2000)
  • international characters in filenames inside archive are now converted in a compatible way with other archiving programs (they are stored converted to OEM inside archive).

ver 1.1.1 (01-2000)

the first version; it is just modified code from zip.c and unzip.c files written by Gilles Vollant and distributed with zlib library; the modifications are as follows:
  • added class' wrappers
  • several bugs fixed
  • several enhancements added
  • MFC support added
  • memory leaks eliminated when write error occurred
  • automatically free used memory on destruction or exception
  • modern error notification using exceptions
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


FAQ

Q: I experience linking problems. What to do?

Q: When do I need to purchase the commercial license?

Q: When I open a multi-disk archive (Pkzip mode) and the last disk is not in the drive, I receive the CZipException::cdirNotFound exception. How to detect whether the last disk is in the drive?

Q: Of what size should be a single volume in a multi-disk archive created in the TD span mode ?

Q: How can I detect the disk spanning mode of an archive?

Q: How to integrate the library with the sample application?

Q: Why the library doesn't want to extract archives (mostly old)?

Q: In CZipArchive::AddNewFile and CZipArchive::ExtractFile I want to use partial path for the filename inside the archive.

Q: I want to create an archive that will be readable under Unix/Linux.

Q: How can I use UNC path with CZipArchive::ExtractFile function ?

Q: How to create a zip archive in memory and then write it to disk or read the archive from the disk and extract from memory ?

Q: How can I extract or delete files that matches a specified wildcard pattern ?

Q: Why an exception is thrown when I call CZipArchive::CloseFile ?

Q: I experience linking problems. What to do?

A:

If you get mostly LNK2005 :
If you changed the project configuration (e.g. from Release to Unicode Release), rebuild the projects. If you are still getting link errors, make sure that the library and your program are both using single-threaded or both multithreaded (or multithreaded DLL) run-time library. The option Project->Settings-> c/c++ ->Code Generation->Use run-time library should be set to the same value in the ZipArchive library and the program project options. Make sure that you link appropriate configurations (Release against Release, Debug against Debug...) and that you're using MFC library in the same way (shared, static or not using) in those configurations.
If you get LNK1104 (e.g. cannot open file "mfc42u.lib")
You're trying to compile the Unicode version but you haven't installed the necessary libraries. When installing Visual C++ Professional for example, you need to check the boxes "Static Libraries for Unicode" and "Shared Libraries for Unicode". They are in "VC++ MFC and Template libraries\\MS Foundation Class Libraries". You don't need to reinstall the Visual Studio to add them.
Q: When do I need to purchase the commercial license?

A: The ZipArchive library is distributed under GNU GPL which implies that it can only be used with software that is licensed under conditions compliant with the GPL. It means that you need to provide a customer with the source code of your software that uses the library. The commercial license removes this obligation. You can find out more at Alternative license for use with proprietary software.

Q: When I open a multi-disk archive (Pkzip mode) and the last disk is not in the drive, I receive the CZipException::cdirNotFound exception. How to detect whether the last disk is in the drive?

A: The last disk can not be detected before opening an archive. The only way to prevent the program from failing when an incorrect disk is inserted is to catch the CZipException::cdirNotFound exception while opening the archive and keep prompting the user to insert the last disk into the drive. Please see the sample application on how it can be done in details.

Q: Of what size should be a single volume in a multi-disk archive created in the TD span mode ?

A: The size of the volume may be from 1 byte to the maximum integer value, and the bigger - the faster is creation and extraction (no file changes meantime), but the size of the whole archive is the same. The optimal solution is to set it to about the size of the diskette (a little less to be comfortable when there are bad sectors found on the disk) to allow the future conversion to PKZIP span mode.

Q: How can I detect the disk spanning mode of an archive?

A: You need to open the archive and the call CZipArchive::GetSpanMode. When opening the archive in tdSpan mode on a removable device, you should set iVolumeSize to a non-zero value while opening the archive (with CZipArchive::Open). There is no universal way to distinguish a PKSpan archive from a TDSpan archive on a removable device, because they have identical internal structure.

Q: How to integrate the library with the sample application?

A:The usual way is to put ZipArchive library at the same directory level what your project is, and then use one of the integration methods. Make a directory structure like this:
---
|-ZipArc // the application project
|-ZipArchive // the ZipArchive library

You can now follow the integration method 1 or 2 (the easier one).

Q: Why the library doesn't want to extract archives (mostly old)?

A: The common reason is that the data is compressed using imploded method (usually with old archivers). The only methods supported by the zlib library are deflation which is the most commonly used by archivers and storing which is in fact not a compression method. You can use a compiled ZipArc application to find out what method the file was compressed with (View->File Info)

Q: In CZipArchive::AddNewFile and CZipArchive::ExtractFile I want to use partial path for the filename inside the archive. For example:
When I compress some directory, like this: c:\program files\example (full directory path: c:\program files\example\text\txt) it comes with the whole path. I would like that the zip only get the EXAMPLE\text\txt path.

A: You can set bFullPath argument to false in these functions and set the beginning part of the path that you commonly want to eliminate with CZipArchive::SetRootPath function. In the example above you'd set it to c:\program files\ (the path separator at the end is added automatically).

Q: I want to create an archive that will be readable under Unix/Linux.

A: Inside the archive there is an information stored about the system it was created under. It helps converting the file attributes that are stored inside the archive to file attributes that are used on the system on which the file is extracted. Some Unix archivers cannot convert Windows attributes to Unix, so that it is needed to create the archive with the Unix attributes already (and the internal info about the system set to a Unix value). To achieve that, simply call CZipArchive::SetSystemCompatibility with the argument set to ZipCompatibility::zcUnix after creating the archive.

Q: How can I use UNC path with CZipArchive::ExtractFile function ?

A: You need to replace \\\\ at the beginning of the UNC path with \\\\?\UNC\ .

Q: How to create a zip archive in memory and then write it to a disk or read the archive from the disk and extract from memory ?

A: See Creating and extracting archives from/in memory

Q: How can I extract or delete files that matches a specified wildcard pattern ?

A: You need to build a CZipWordArray with CZipArchive::FindMatches and then:

  • to delete: use the array as an argument to CZipArchive::DeleteFiles
  • to extract: the array stores the indexes of the files to extract; you need to enumerate the array and pass the indexes one-by-one to CZipArchive::ExtractFile function

Q: Why an exception is thrown when I call CZipArchive::CloseFile ?

A: If you haven't exctracted all of the file contents (e.g. only the beginning) or you have encountered an exception during extraction, you need to call CZipArchive::CloseFile with bAfterException parameter set to true or call CZipArchive::CloseFileWithNoUpdate instead.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Licensing information

ZipArchive library - creation, modification and decompression of "zip" format archives
Copyright © 2000 - 2004 Tadeusz Dracz.
E-Mail: tdracz@artpol-software.com
Web: http://www.artpol-software.com

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

An English version of the GNU GPL is in the gpl.txt file distributed with this project. Translations to other languages are available at: http://www.gnu.org/copyleft/gpl.html

Distributing ZipArchive under GNU GPL implies ZipArchive can only be used with software that is licensed under conditions compliant with the GPL. Embedding in proprietary software requires an alternative license.

Alternative license for use with proprietary software

If you want to distribute software in a commercial context that incorporates ZipArchive and you do not want to meet the conditions of GNU GPL (e.g. an obligation to provide a customer with the source code of your software that uses the ZipArchive library), you need to have a commercial license.
  • The commercial license provides you with the same rights as the GNU GPL, but in addition allows you to embed ZipArchive library in proprietary software without affecting the copyright of this software (it removes the GNU GPL obligation to publish the source code)
  • The license gives you royalty free distribution rights
  • The license does not allow you to transfer these rights
  • The license is granted per developer
  • You won't need to purchase an additional license for the future versions of the library

The commercial license is available free of charge for using ZipArchive library in:

  • freeware software (freeware is software that is available free of charge, but which is copyrighted by the developer, who retains the right to control its redistribution and to sell it in the future)
    • excluded is software which is associated with an equipment that the same company manufactures and which has no practical usage value without the mentioned equipment (e.g. software used for maintenace of machines) - unless the equipment is free as well
    • if you decide to sell the software in the future - you will need to purchase the commercial license for using the ZipArchive library, unless it is distributed in the shareware way - see below
  • software distributed in the Shareware way (Shareware distribution gives users a chance to try software before buying it. If you try a Shareware program and continue using it, you are expected to register. Individual programs differ on details -- some request registration while others require it, some specify a maximum trial period. Copyright laws apply to both Shareware and commercial software and the copyright holder retains all rights, with the exception that copying and distributing the program for evaluation purposes is encouraged, subject to certain conditions. For example, some authors require written permission before a commercial disk vendor may copy their Shareware. )
    • excluded is software which price for a single copy is higher than the price of the ZipArchive library for a single developer

Extended Licence for HBZLIB (library for zip compression in Harbour)
You can create proprietary software using hbzlib respecting the follow:

  • ZipArchive library must be linked together with hbzlib
  • you cannot use ZipArchive as a dynamic library (DLL), it must be linked staticaly with the software
  • the commercial license for ZipArchive is free of charge, but these grants are valid only if the whole application is written with Harbour

There is a fee for the commercial license for using the library in the software not falling into the mentioned categories.
It is recommended that you should print two copies of the commercial license document after you receive it, sign them and send by post. One copy, signed by the author will be sent back to you. Please contact the author or visit the Artpol Software web site to find out more.

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


GNU GENERAL PUBLIC LICENSE

GNU GENERAL PUBLIC LICENSE Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.

b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.

c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Compilation & Integration

  • Compiling for different implementations and platforms
    • Windows MFC
    • Windows STL
    • Linux (STL version)
  • Visual C++ : integrating with the project
    • Method 1
    • Method 2 (simpler)
    • DLL version
  • Borland C++ compatibility
    • Compiling the sample application
  • Linux platform
    • Notes
    • Compiling the library and liniking with the application
  • Notes
    • STL version
    • Compiling as DLL
    • MFC sample application (ZipArc)

Compiling for different implementations and platforms

The files required for all the library versions are located in the program root directory. You also need to copy additional files to the library root directory from the two more subfolders. Depending on the configuration these files are located in:

Windows MFC

\Windows and \mfc
You can just execute _copy from Win-MFC.bat batch file.

Windows STL

\Windows and \stl
You can just execute _copy from Win-STL.bat batch file.

Linux (STL version)

\Linux and \stl
You can just execute _copy_from_Linux.sh script file (don't forget to set executable rights before e.g. with the command: chmod +x _copy_from_Linux.sh ).

Note:
If you use one of the mentioned scripts to copy the files then for easy orientation there will be a file __[...].zcfg created with the name depending on the current configuration

Visual C++ : integrating with the project

To add ZipArchive library functionality into your project you need to link the library to the project. You can do this in at least two ways (in both cases you need to include ZipArchive.h header in your sources).

Method 1

Add ZipArchive.lib with the proper path e.g. ..\ZipArchive\debug\ZipArchive.lib to Project Settings->Link->Input->Object/library modules and add ZipArchive library directory to the preprocessor searches ( Project Settings -> C++ -> Preprocessor -> Additional include directories ).

Method 2 (simpler)

Insert Zip project into workspace and set project dependencies: your project dependent on ZipArchive project ( Project -> Dependencies and then on the dialog that will appear you select your project name from the combo box and check the box next to ZipArchive project name). When you use this method, you link configurations in your project with configurations in the ZipArchive project that have the same name in both projects. So if you need to use for example "Static Release" configuration from ZipArchive project, you need to create one with the same name in your application project and make sure that your project uses MFC library and run-time library in same way ( Project->Settings->General->Microsoft Fundation Classes and Project->Settings-> c/c++ ->Code Generation->Use run-time library ).

DLL version

When you're using the DLL version of the ZipArchive library, you need to define in your program ZIP_HAS_DLL (e.g. in Project Settings -> C++ -> Preprocessor -> Preprocessor definitions ). Apart from integrating the ZipArchive library with your program (use one of the methods above), you also need to take into account zlib.lib file (use zlib/zlib.dsw to create it and add to preprocessor includes) or zlib/zlib.dsw project (insert into workspace and set ZipArchive project dependent on it)). Files zlib.dll and ZipArchive.dll must be available for the program when running (e.g. in the program's directory).

You can read about linking problems in the FAQ.

Borland C++ compatibility

The library contains a project files for Borland C++ 5.0 ( They were created using Visual C++ Project Conversion Utility (VCTOBPR.EXE). You can start this tool with the command Tools->Visual C++ Project Conversion Utility .

Note:
Be sure to create Release subfolder before compiling one of these projects, otherwise you'll get a write error.
In case the projects provided don't work for you, you can create your own. You need to copy to the root directory appropriate files for MFC or STL versions. You may use the Borland project conversion utility.

The library contains also makefiles which should work with other versions of Borland.

Compiling the sample application

There is a Borland C++ project provided with the sample application ZipArc.
To compile it you need compiled MFC version of ZipArchive library.

Note:
Be sure to create Release subfolder first, otherwise you'll get a write error.
Add the library (ZipArchive.lib ) to the project (Project->Add To Project) and compile.

If you wish to convert Visual C++ project using Visual C++ Project Conversion Utility then after converting to properly compile the application you need to remove odbccp32.lib from the project file and comment everything out in ZipArc_TLB.cpp or remove this file from the project files.

Linux platform

Notes

Usage

When using the library under Linux you should be aware of a few things:

  • after you get the system attributes with CZipFileHeader::GetSystemAttr() function, you need to shift them right by 16 ( e.g. uAttr = header.GetSystemAttr() >> 16 ) - the reason for that is the way the attributes are stored in the archive created under (or for) Linux.
  • due to lack of implementation of ZipPlatform::IsDriveRemovable(), which has proven to be a kind of difficult to do, the device containing the archive is always assumed to be removable; the only effect of this is that you need to set iVolumeSize to a value different from 0 when opening with the function CZipArchive::Open() the archive created in tdSpan mode.

Compiling

  • the library was tested under g++ version 3.2.2
  • warnings that use of the tempnam and mktemp is not safe can be ignored, because the temporary file is created almost straight away.

Compiling the library and liniking with the application

  • First you need to copy the appropriate files (see above)
  • If you haven't got the zlib library already installed on your system, you can install it using Makefile in the zlib subdirectory (type make and then make install )
  • only static version (you can download a full version of the zlib library from the ZipArchive library site). If you don't want to install the zlib library, you need to include it in the ZipArchive library ( edit the Makefile in the main directory and change comments, so that OBJSZLIB is not an empty value but points to zlib library object files)
  • Compile the library by typing make. The resulting file is a static library libziparch.a
  • You can copy the library and the headers (if you have an appropriate rights) to /usr/lib and /usr/include/ziparchive (you can change them in Makefile) with the command make install
  • Now you can link the library to your application
    e.g. with the command (if the library is in the same directory)
    g++ $I. -o app app.cpp -lstdc++ -lz libziparch.a
    or if you have the library installed in the /usr subdirectories:
    g++ $I/usr/include/ziparchive -o app app.cpp -lstdc++ -lz -lziparch
    If you haven't got the zlib library installed, you need to omit the switch -lz in the above commands.
  • There is a test application named zippie.cpp (in stl/zippie which you can compile typing make zippie (providing that you have installed the ZipArchive library). If you haven't got the zlib library installed, you need to switch the comments (comment one line and uncomment another) in the Makefile in the section "zippie:".
  • If you wish to uninstall the library type make uninstall

Notes

STL version

  • [Windows only] If your locale is different from English and you wish to use non-English characters in zip files, you need to set your locale with function std::locale::global(std::locale("")) to set it to be the same as your system locale or e.g. std::locale::global(std::locale("French")) to set it to the specified value (do not use _T() macro here when using Unicode); setlocale() function is not sufficient in this case.
  • There is a sample application that compiles under Windows (MSVC) and Linux (see below to find out how to compile it under Linux). This sample application demonstrates most of the ZipArchive library features and is located in stl/zippie.

Compiling as DLL

[Windows only]
  • The project that compiles the DLL version of the ZipArchive library needs to have defined ZIP_HAS_DLL, ZIP_BUILD_DLL and also ZLIB_DLL.
  • The project that uses the ZipArchive library as the DLL version need to have defined ZIP_HAS_DLL

MFC sample application (ZipArc)

MFC sample application using ZipArchive library is available separately. Main features:
  • MDI application
  • multithreaded - you can work with many zip files at one time
  • shell integration (remembers the last application used to open zip files and can restore it correctly)
  • drag & drop support
  • detailed error reports
  • you can open and modify SFX archives
  • it demonstrates the use of the following functions (most of them are placed in ZipArcDoc.cpp) : CZipArchive::AddNewFile, CZipArchive::Close, CZipArchive::CloseFile, CZipArchive::CloseNewFile, CZipArchive::DeleteFiles, CZipArchive::EnableFindFast, CZipArchive::ExtractFile, CZipArchive::FindFile, CZipArchive::FindMatches, CZipArchive::Flush, CZipArchive::GetArchivePath, CZipArchive::GetCentralDirInfo, CZipArchive::GetCentralDirSize, CZipArchive::GetCurrentDisk, CZipArchive::GetFileInfo, CZipArchive::GetFindFastIndex, CZipArchive::GetGlobalComment, CZipArchive::GetCount, CZipArchive::GetPassword, CZipArchive::GetSpanMode, CZipArchive::IsClosed, CZipArchive::IsReadOnly, CZipArchive::Open, CZipArchive::RenameFile, CZipArchive::PredictExtractedFileName, CZipArchive::SetAdvanced, CZipArchive::SetCallback, CZipArchive::SetFileComment, CZipArchive::SetGlobalComment, CZipArchive::SetIgnoreCRC, CZipArchive::SetPassword, CZipArchive::SetRootPath, CZipArchive::SetSpanCallback, CZipArchive::SetTempPath, CZipArchive::TestFile, CZipArchive::WillBeDuplicated,
    CZipFileHeader::IsEncrypted, CZipFileHeader::IsDirectory, CZipFileHeader::GetTime, CZipFileHeader::GetSystemCompatibility, CZipFileHeader::GetSystemAttr, CZipFileHeader::GetSize, CZipFileHeader::GetFileName, CZipFileHeader::GetEffComprSize, CZipFileHeader::GetCompressionRatio, CZipFileHeader::GetComment, CZipFileHeader::CompressionEfficient,
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


General Information

Compression and decompression
Multi-disk archives
Password encryption and decryption
Self extract support
Exceptions
Creating and extracting archives from/in memory
Action progress notifications (callbacks)
Integrating with MSDN

Compression and decompression

There are some functions defined for fast operations on archive: CZipArchive::AddNewFile, CZipArchive::ExtractFile, CZipArchive::DeleteFile, CZipArchive::TestFile. You only need to call functions CZipArchive::Open - before and CZipArchive::Close - after using them. Calling CZipArchive::Close function after you've done modifying the archive is necessary for the archive to be intact.

Multi-disk archives

This library can create multi-disk archives in two ways (modes):

  • PKSpan mode. Disk spanning is performed in the compatible way with all other main zip programs. It means that:
    • the archive can only be created on a removable device,
    • the size of the volume is auto-detected
    • the label is written to the disk
    • you need to define a callback functor for changing disks and set it with CZipArchive::SetSpanCallback function.

  • TDSpan mode. Disk spanning is performed in the internal mode. It means that:
    • the archive can be created on non-removable device as well
    • you need to define the single volume size
    • there is no need to set callback functor in this mode.

These two disk spanning modes create volumes with compatible internal structure. It means that you can easily convert the volumes created in one mode to the other one by renaming the files (in TDSpan mode each volume but last has a number as an extension). To convert the archive from TD to PKZIP compatible archive, copy each file to the removable media, giving them the extension ".zip". You should also label each disk with the appropriate label starting from "pkback# 001" (note the space between '#' and '0').

There is a limited functions set available while working with multi-disk archives. Only adding is allowed when creating the archive and only extracting and testing after opening an existing one. Deleting files from these archives is not allowed at all.

Class CZipArchive uses write buffer to make write operations as fast as possible. You can change its size with CZipArchive::SetAdvanced function (first argument). While creating a multi-disk archive, set the size of the buffer to the maximum size of the volume for the best performance.

The popular archivers such as PKZIP and WinZip cannot operate on archive in TDSpan mode. You need to convert them to PKZIP span mode (have a look above). Remember about copying the files to the removable media (it does not comply with Winzip, which can extract a multi-disk archive from any media but only from the fixed location on the drive).

Password encryption and decryption

This library supports creating and extracting the password protected archives. There are several issues you should be aware of when using this feature. To set the password for the file to be added or extracted call the function CZipArchive::SetPassword with the password as the argument. To clear the password call this function without arguments or with an empty string argument. The function has no effect on a closed archive and on the currently opened file (whether new or existing) inside archive. During opening the archive the password is cleared. You can set different passwords for different files inside the same archive, but remember to set it BEFORE opening the file. You cannot use ASCII characters with codes above 127 in the password, if you do so, the function CZipArchive::SetPassword returns false and the password is cleared. You can find out what files are password encrypted by calling CZipArchive::GetFileInfo, which fills the structure CZipFileHeader with data, and then call the method ZipFileHeader::IsEncrypted. If it returns true, the file needs a password to extract. The successful extraction of the encrypted file doesn't always mean that the password is correct. You also need to check the return value of CZipArchive::CloseFile. You could also check the size of the extracted file since it can be smaller than it should be in case of the bad password.

Self extract support

The library is capable of extracting and modifying self-extracting archives. You can create your own SFX archive as well. This is the simplest code responsible for the self-extracting:

//Windows code

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
 CZipArchive zip;

 // get the path of the executable
 TCHAR szBuff[_MAX_PATH];
 if (!::GetModuleFileName(hInstance, szBuff, _MAX_PATH))
  return -1;

 CZipString szDest;
 // ...
 // add some code here to get the destination directory from the user
 // for example:
 // CBrowseForFolder bf;
 //   bf.strTitle = _T("Select directory to extract files");
 //   if (!bf.GetFolder(szDest))
 //       return -1;
 //
 // class CBrowseForFolder is included in the sample application project
 // remember about including the header!
 zip.Open(szBuff, CZipArchive::zipOpenReadOnly);
 // zipOpenReadOnly mode is necessary for self extract archives
 for (WORD i = 0; i < zip.GetCount(); i++)
  zip.ExtractFile(i, szDest);

 zip.Close();
 return 0;
 // this code will not work for the encrypted archives since it is needed
 // to get the password from the user ( a small addition to the
 // existing code I suppose )
}

After compiling it and appending a zip archive to it (e.g. with the DOS command: copy /b SelfExtract.exe + ZipFile.zip FinalFile.exe ) you have a self extracting archive.

Exceptions

The ZipArchive library mostly uses exceptions to notify about the error occured. The library throws CZipException to notify about errors specific to the internal zip file processing. In the MFC version CZipException class is derived from CException whereas in the STL version it is derived from std::exception.

MFC version

The library throws the following exceptions inherited from CException: CMemoryException*, CFileExeption* and CZipException* (be sure to delete the object when you done with it). Handling them may be done in the following way:

try
{
 // ...
 // some operations on the ZipArchive library
}
catch (CException* e)
{
 if (e->IsKindOf( RUNTIME_CLASS( CZipException )))
 {
  CZipException* p = (CZipException*) e;
  //... and so on
 }
 else if (e->IsKindOf( RUNTIME_CLASS( CFileException )))
 {
  CFileException* p = (CFileException*) e;
  //... and so on
 }
 else
 {
  // the only possibility is a memory exception I suppose
  //... and so on
 }
 e->Delete();
}

STL version

The library throws exceptions inherited from std::exception. In this case you should catch std::exception object (not a pointer to it).

Creating and extracting archives from/in memory

With the function CZipArchive::Open(CZipMemFile&, int) you can create the archive in memory and then write to disk, e.g.:

CZipArchive zip;
CZipMemFile mf;
// create archive in memory
zip.Open(mf, CZipArchive::zipCreate);
// ...
// add some files to archive here e.g. by calling CZipArchive::AddNewFile
// ...
zip.Close();
// write the archive to disk
CZipFile f;
if (f.Open("c:\\temp.zip", CZipFile::modeWrite|CZipFile::modeCreate, false)
{
 int iLen = mf.GetLength();
 BYTE* b = mf.Detach();
 f.Write(b, iLen);
 f.Close();
 // we must free the detached memory
 free(b);
}

You can as well read the archive from disk and then extract files, e.g.:

CZipFile f;
if (f.Open("c:\\temp.zip", CZipFile::modeRead, false)
{
 int iLen = f.GetLength();
 BYTE* b = (BYTE*)malloc((UINT)iLen);
 f.Read(b, iLen);
 f.Close();
 CZipMemFile mf;
 mf.Attach(b, iLen);
 CZipArchive zip;
 zip.Open(mf);
 // ...
 // extract files here from the archive e.g. by calling CZipArchive::ExtractFile
 // ...
 zip.Close();
}

With functions CZipArchive::AddNewFile(CZipMemFile&, LPCTSTR, int, int, unsigned long) and CZipArchive::ExtractFile(WORD, CZipMemFile&, DWORD) you can add files to archive from memory and extract them to a memory file. Now a bit larger example:

// create the archive in memory with two files inside
CZipMemFile mf;
CZipArchive zip;
zip.Open(mf, CZipArchive::zipCreate);
zip.AddNewFile("c:\\testfile1.txt");
zip.AddNewFile("c:\\testfile2.txt");
zip.Close();
//create the archive on disk and add a previously zipped file from memory
zip.Open("c:\\test.zip", CZipArchive::zipCreate);
zip.AddNewFile(mf, "File1.zip");
zip.Close();
// we have now zip-in-zip file on the disk,
// let's extract the embedded zip file back to memory
zip.Open("c:\\test.zip");
// reset the contents of the CZipMemFile object
mf.SetLength(0);
zip.ExtractFile(0, mf);
zip.Close();
// write the file from memory to disk
CZipFile f;
if (f.Open("c:\\File1.zip", CZipFile::modeWrite|CZipFile::modeCreate, false))
{
 int iLen = mf.GetLength();
 BYTE* b = mf.Detach();
 f.Write(b, iLen);
 f.Close();
 // we must free the detached memory
 free(b);
}

One important thing: when you operate on the archive in memory, you must ensure that CZipMemory object will not be destroyed before calling CZipArchive::Close. In some cases you'll need to construct the object using the new operator, e.g.:

// ...
CZipMemFile* pmf = new CZipMemFile;
zip.Open(*pmf, CZipArchive::zipCreate);
// ...
zip.Close();
delete pmf;

Action progress notifications (callbacks)

The library has the possibility to notify about the progress of the various actions (see CZipArchive::CallbackType). To use this feature you need to define a new class derived from CZipActionCallback or from CZipSpanCallback and override CZipCallback::Callback function. Then you need to declare an object of your class and pass its address to function CZipArchive::SetCallback or CZipArchive::SetSpanCallback. Make sure that the object exists while the library performs the action the functor was assigned to. or tell the library not to use the callback (use the same functions).

Integrating with MSDN

If you wish to integrate the ZipArchive help system with the MSDN library you need to:
  • download from the Artpol Software site ZipArchive HTML Help documentation or ZipArchive HTML documentation if you don't have it.
  • in the latter case you need to compile the html files to the HTML Help format with HTML Web Workshop by Microsoft (at the moment of writing available here) and using provided index.hhp file (it is at the same location as ZipArchive html help files)
  • now you should have index.chm and index.chi files, rename them if you want to and put them to the directory of your choice
  • you need to download a free MSDN Integration Utility by Kirk Stowell; you can download it from the Code Project site or from the Artpol Software site (Download->ZipArchive)
  • use the MSDN Integration Utility for the files you have prepared
  • now pressing the F1 key on the ZipArchive library method or class in the Visual Studio brings up the MSDN help; you have also a searchable ZipArchive collection inside MSDN
    Note:
    After integrating the ZipArchive help system with the MSDN library, you need to be patient when you use the Index for the first time, because it'll be rebuilt then which can be a lengthy process.
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


ZipArchive Newsletter

To be notified about ZipArchive library updates, enter your e-mail into the input field below and press Subscribe! button. You should receive a confirmation message then.

Privacy Policy of the ZipArchvie library Newsletter List

  • The information you provide, will never be made available to any third party company.
  • Only the Web Master of the Artpol Software site will have an access to the mailing list.
  • If at anytime you wish to be removed from the mailing list, you can do it by following the link that you will receive with every newsletter.
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Graphical Class Hierarchy

ZipArchive Graphical Class Hierarchy

Go to the textual class hierarchy

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:06 2004.


Annotated Index

ZipArchive Class List

Here are the classes, structs, unions and interfaces with brief descriptions:
CZipActionCallback | Derive from this a class to be used as a callback functors when adding, extracting, deleting, testing a file or saving central directory
CZipAddNewFileInfo | Structure used as a parameter in CZipArchive::AddNewFile(CZipAddNewFileInfo& ); Use one of constructors provided and then adjust the member variables that are set to default values by Defaults method
CZipArchive | The representation of the zip archive file
CZipArchive::CWildcard | A class used in wildcard pattern matching
CZipArchive::CZipClbckStrg | Storage for callback functors
CZipArchive::CZipDeleteInfo | Holds map of holes and areas to remain when deleting files from the archive
CZipArchive::CZipInternalInfo | The purpose of this structure is to hold the data that allow communication with the zlib library
CZipArchive::CZipSmClrPass | A structure for the internal use only
CZipAutoBuffer | A smart buffer freeing its contents on destruction
CZipCallback | A base class for functional objects (functors) that are used as a callbacks during various actions
CZipCentralDir | A class representing the central directory record in the archive
CZipCentralDir::CZipFindFast | Used in fast finding files by the filename
CZipCentralDir::Info | Stores general information about the central directory record
CZipException | A class representing exceptions specific to the ZipArchive library
CZipFileHeader | Representation of a single file stored in the zip archive
CZipFileMapping | Maps a file to the memory
CZipMemFile | A memory buffer which behaves like a physical file
CZipPathComponent | A class splitting a file path into components
CZipSpanCallback | Derive from this a class to be used as a callback functor for the disk change callback
CZipStorage | A low-level class - operates physically on archive (CZipArchive operates logically)
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


Member List

CZipArchive Member List

This is the complete list of members for CZipArchive, including all inherited members.
_zliballoc(void *opaque, UINT items, UINT size) | CZipArchive | [protected, static]
_zlibfree(void *opaque, void *address) | CZipArchive | [protected, static]
AddNewFile(CZipAddNewFileInfo &info) | CZipArchive |
AddNewFile(LPCTSTR lpszFilePath, int iComprLevel=-1, bool bFullPath=true, int iSmartLevel=zipsmSafeSmart, unsigned long nBufSize=65536) | CZipArchive |
AddNewFile(LPCTSTR lpszFilePath, LPCTSTR lpszFileNameInZip, int iComprLevel=-1, int iSmartLevel=zipsmSafeSmart, unsigned long nBufSize=65536) | CZipArchive |
AddNewFile(CZipMemFile &mf, LPCTSTR lpszFileNameInZip, int iComprLevel=-1, int iSmartLevel=zipsmSafeSmart, unsigned long nBufSize=65536) | CZipArchive |
afAfterException enum value | CZipArchive |
afNoException enum value | CZipArchive |
afWriteDir enum value | CZipArchive |
CallbackType enum name | CZipArchive |
cbActions enum value | CZipArchive |
cbAdd enum value | CZipArchive |
cbAddStore enum value | CZipArchive |
cbAddTmp enum value | CZipArchive |
cbAll enum value | CZipArchive |
cbDelete enum value | CZipArchive |
cbDeleteCnt enum value | CZipArchive |
cbExtract enum value | CZipArchive |
cbGetFromArchive enum value | CZipArchive |
cbNextValue enum value | CZipArchive |
cbNothing enum value | CZipArchive |
cbRename enum value | CZipArchive |
cbReplace enum value | CZipArchive |
cbSave enum value | CZipArchive |
cbSubActions enum value | CZipArchive |
cbTest enum value | CZipArchive |
CheckForError(int iErr) | CZipArchive | [protected]
Close(int iAfterException=afNoException, bool bUpdateTimeStamp=false) | CZipArchive |
CloseAfterException enum name | CZipArchive |
CloseFile(CZipFile &file) | CZipArchive |
CloseFile(LPCTSTR lpszFilePath=NULL, bool bAfterException=false) | CZipArchive |
CloseFileWithNoUpdate() | CZipArchive |
CloseNewFile(bool bAfterException=false) | CZipArchive |
compress enum value | CZipArchive | [protected]
CryptCheck() | CZipArchive | [protected]
CryptCRC32(DWORD l, char c) | CZipArchive | [protected]
CryptCryptHeader(long iCrc, CZipAutoBuffer &buf) | CZipArchive | [protected]
CryptDecode(char &c) | CZipArchive | [protected]
CryptDecodeBuffer(DWORD uCount) | CZipArchive | [protected]
CryptDecryptByte() | CZipArchive | [protected]
CryptEncode(char &c) | CZipArchive | [protected]
CryptEncodeBuffer() | CZipArchive | [protected]
CryptInitKeys() | CZipArchive | [protected]
CryptUpdateKeys(char c) | CZipArchive | [protected]
CurrentFile() | CZipArchive | [protected]
CZipArchive() (defined in CZipArchive) | CZipArchive |
CZipPtrListIter typedef (defined in CZipArchive) | CZipArchive | [protected]
DeleteFile(WORD uIndex) | CZipArchive |
DeleteFiles(CZipWordArray &aIndexes) | CZipArchive |
DeleteFiles(const CZipStringArray &aNames) | CZipArchive |
EmptyPtrList() | CZipArchive | [protected]
EnableFindFast(bool bEnable=true) | CZipArchive |
extract enum value | CZipArchive | [protected]
ExtractFile(WORD uIndex, LPCTSTR lpszPath, bool bFullPath=true, LPCTSTR lpszNewName=NULL, DWORD nBufSize=65536) | CZipArchive |
ExtractFile(WORD uIndex, CZipMemFile &mf, bool bRewind=true, DWORD nBufSize=65536) | CZipArchive |
FFCaseSens enum name | CZipArchive |
ffCaseSens enum value | CZipArchive |
ffDefault enum value | CZipArchive |
ffNoCaseSens enum value | CZipArchive |
FindFile(LPCTSTR lpszFileName, int iCaseSensitive=ffDefault, bool bFileNameOnly=false) | CZipArchive |
FindMatches(LPCTSTR lpszPattern, CZipWordArray &ar, bool bFullPath=true) const | CZipArchive |
Flush() | CZipArchive |
GetAdvanced(int *piWriteBuffer=NULL, int *piGeneralBuffer=NULL, int *piSearchBuffer=NULL) | CZipArchive | [inline]
GetArchivePath() const | CZipArchive |
GetAutoFlush() const | CZipArchive | [inline]
GetCallback(CallbackType iWhich) | CZipArchive | [inline]
GetCentralDirInfo(CZipCentralDir::Info &info) const | CZipArchive |
GetCentralDirSize(bool bWhole=true) const | CZipArchive | [inline]
GetCount(bool bOnlyFiles=false) const | CZipArchive | [inline]
GetCRCTable() | CZipArchive | [inline, static]
GetCurrentDisk() const | CZipArchive |
GetFileInfo(CZipFileHeader &fhInfo, WORD uIndex) const | CZipArchive |
GetFindFastIndex(int iFindFastIndex) const | CZipArchive | [inline]
GetFromArchive(CZipArchive &zip, WORD uIndex, int iReplaceIndex=-1, bool bKeepSystComp=false) | CZipArchive | [inline]
GetFromArchive(CZipArchive &zip, CZipWordArray &aIndexes, bool bKeepSystComp=false) | CZipArchive |
GetFromArchive(CZipArchive &zip, CZipStringArray &aNames, bool bKeepSystComp=false) | CZipArchive | [inline]
GetFromArchive(CZipArchive &zip, WORD uIndex, int iReplaceIndex, bool bKeepSystComp, CZipActionCallback *pCallback) | CZipArchive | [protected]
GetGlobalComment() const | CZipArchive |
GetIndexes(const CZipStringArray &aNames, CZipWordArray &aIndexes) | CZipArchive |
GetLocalExtraField(char *pBuf, int iSize) const | CZipArchive |
GetPassword() const | CZipArchive |
GetRootPath() const | CZipArchive | [inline]
GetSpanMode() const | CZipArchive | [inline]
GetStorage() | CZipArchive | [inline]
GetSystemCompatibility() const | CZipArchive | [inline]
GetTempPath() const | CZipArchive | [inline]
IsClosed(bool bArchive=true) const | CZipArchive |
IsReadOnly() | CZipArchive | [inline]
m_bAutoFlush | CZipArchive | [protected]
m_bCaseSensitive | CZipArchive | [protected]
m_bDetectZlibMemoryLeaks | CZipArchive | [protected]
m_bIgnoreCRC | CZipArchive | [protected]
m_bRemoveDriveLetter | CZipArchive |
m_callbacks | CZipArchive | [protected]
m_centralDir | CZipArchive | [protected]
m_gszCopyright | CZipArchive | [protected, static]
m_iArchiveSystCompatib | CZipArchive | [protected]
m_iFileOpened | CZipArchive | [protected]
m_info | CZipArchive | [protected]
m_keys | CZipArchive | [protected]
m_list | CZipArchive | [protected]
m_pszPassword | CZipArchive | [protected]
m_pZipCompare | CZipArchive | [protected]
m_storage | CZipArchive | [protected]
m_szRootPath | CZipArchive | [protected]
m_szTempPath | CZipArchive | [protected]
MakeSpaceForReplace(int iReplaceIndex, DWORD uTotal, LPCTSTR lpszFileName) | CZipArchive | [protected]
MovePackedFiles(DWORD uStartOffset, DWORD uEndOffset, DWORD uMoveBy, CZipActionCallback *pCallback, bool bForward=false) | CZipArchive | [protected]
nothing enum value | CZipArchive | [protected]
Open(LPCTSTR szPathName, int iMode=zipOpen, int iVolumeSize=0) | CZipArchive |
Open(CZipMemFile &mf, int iMode=zipOpen) | CZipArchive |
OpenFile(WORD uIndex) | CZipArchive |
OpenFileType enum name | CZipArchive | [protected]
OpenInternal(int iMode) | CZipArchive | [protected]
OpenMode enum name | CZipArchive |
OpenNewFile(CZipFileHeader &header, int iLevel=Z_DEFAULT_COMPRESSION, LPCTSTR lpszFilePath=NULL, DWORD uInternal=0) | CZipArchive |
prAuto enum value | CZipArchive |
prDir enum value | CZipArchive |
Predict enum name | CZipArchive |
PredictExtractedFileName(LPCTSTR lpszFileNameInZip, LPCTSTR lpszPath, bool bFullPath, LPCTSTR lpszNewName=NULL) const | CZipArchive |
PredictFileNameInZip(LPCTSTR lpszFilePath, bool bFullPath, int iWhat=prAuto, bool bExactly=false) const | CZipArchive |
prFile enum value | CZipArchive |
ReadFile(void *pBuf, DWORD iSize) | CZipArchive |
RemoveLast(bool bRemoveAnyway=false) | CZipArchive | [protected]
RemovePathBeginning(LPCTSTR lpszBeginning, CZipString &szPath, ZIPSTRINGCOMPARE pCompareFunction) | CZipArchive | [static]
RenameFile(WORD uIndex, LPCTSTR lpszNewName) | CZipArchive |
SetAdvanced(int iWriteBuffer=65536, int iGeneralBuffer=65536, int iSearchBuffer=32768) | CZipArchive |
SetAutoFlush(bool bAutoFlush=true) | CZipArchive |
SetCallback(CZipActionCallback *pCallback=NULL, int iWhich=cbAll) | CZipArchive |
SetCaseSensitivity(bool bCaseSensitive) | CZipArchive | [inline]
SetConvertAfterOpen(bool bConvertAfterOpen) | CZipArchive | [inline]
SetDetectZlibMemoryLeaks(bool bDetect) | CZipArchive | [inline]
SetExtraField(const char *pBuf, WORD iSize) | CZipArchive |
SetFileComment(WORD uIndex, LPCTSTR lpszComment) | CZipArchive |
SetFileHeaderAttr(CZipFileHeader &header, DWORD uAttr) | CZipArchive |
SetGlobalComment(LPCTSTR lpszComment) | CZipArchive |
SetIgnoreCRC(bool bIgnore=true) | CZipArchive | [inline]
SetPassword(LPCTSTR lpszPassword=NULL) | CZipArchive |
SetRootPath(LPCTSTR szPath=NULL) | CZipArchive |
SetSpanCallback(CZipSpanCallback *pCallback=NULL) | CZipArchive | [inline]
SetSystemCompatibility(int iSystemComp) | CZipArchive |
SetTempPath(LPCTSTR lpszPath=NULL, bool bForce=true) | CZipArchive |
SingleToWide(const CZipAutoBuffer &szSingle, CZipString &szWide) | CZipArchive | [static]
Smartness enum name | CZipArchive |
TestFile(WORD uIndex, DWORD uBufSize=65536) | CZipArchive |
ThrowError(int err, bool bZlib=false) | CZipArchive | [protected]
TrimRootPath(CZipPathComponent &zpc) const | CZipArchive |
UpdateReplaceIndex(int &iReplaceIndex, LPCTSTR lpszNewFileName) | CZipArchive | [protected]
WideToSingle(LPCTSTR lpWide, CZipAutoBuffer &szSingle) | CZipArchive | [static]
WillBeDuplicated(LPCTSTR lpszFilePath, bool bFullPath, bool bFileNameOnly=false, int iWhat=prAuto) | CZipArchive |
WriteCentralDirectory(bool bFlush=true) | CZipArchive | [protected]
WriteNewFile(const void *pBuf, DWORD iSize) | CZipArchive |
zipCreate enum value | CZipArchive |
zipCreateSpan enum value | CZipArchive |
zipOpen enum value | CZipArchive |
zipOpenReadOnly enum value | CZipArchive |
zipsmCheckForEff enum value | CZipArchive |
zipsmCheckForEffInMem enum value | CZipArchive |
zipsmCPassDir enum value | CZipArchive |
zipsmCPFile0 enum value | CZipArchive |
zipsmInternal01 enum value | CZipArchive |
zipsmLazy enum value | CZipArchive |
zipsmMemoryFlag enum value | CZipArchive |
zipsmNotCompSmall enum value | CZipArchive |
zipsmSafeSmart enum value | CZipArchive |
zipsmSmartAdd enum value | CZipArchive |
zipsmSmartest enum value | CZipArchive |
zipsmSmartPass enum value | CZipArchive |
~CZipArchive() (defined in CZipArchive) | CZipArchive | [virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipArchive::CWildcard Member List

This is the complete list of members for CZipArchive::CWildcard, including all inherited members.
CWildcard() (defined in CZipArchive::CWildcard) | CZipArchive::CWildcard | [inline]
CWildcard(LPCTSTR lpszPattern, bool bCaseSensitive) | CZipArchive::CWildcard | [inline]
IsMatch(LPCTSTR lpszText, int *iRetCode=NULL) | CZipArchive::CWildcard |
IsPattern(LPCTSTR lpszPattern) | CZipArchive::CWildcard | [static]
IsPatternValid(LPCTSTR lpszPattern, int *iErrorType=NULL) | CZipArchive::CWildcard | [static]
m_bCaseSensitive (defined in CZipArchive::CWildcard) | CZipArchive::CWildcard | [protected]
m_szPattern (defined in CZipArchive::CWildcard) | CZipArchive::CWildcard | [protected]
Match(LPCTSTR lpszPattern, LPCTSTR lpszText) | CZipArchive::CWildcard | [static]
Match enum name | CZipArchive::CWildcard |
matchAbort enum value | CZipArchive::CWildcard |
MatchAfterStar(LPCTSTR p, LPCTSTR t) (defined in CZipArchive::CWildcard) | CZipArchive::CWildcard | [protected, static]
matchEnd enum value | CZipArchive::CWildcard |
matchLiteral enum value | CZipArchive::CWildcard |
matchNone enum value | CZipArchive::CWildcard |
matchPattern enum value | CZipArchive::CWildcard |
matchRange enum value | CZipArchive::CWildcard |
matchValid enum value | CZipArchive::CWildcard |
operator LPCTSTR() (defined in CZipArchive::CWildcard) | CZipArchive::CWildcard | [inline]
Pattern enum name | CZipArchive::CWildcard |
patternClose enum value | CZipArchive::CWildcard |
patternEmpty enum value | CZipArchive::CWildcard |
patternEsc enum value | CZipArchive::CWildcard |
patternRange enum value | CZipArchive::CWildcard |
patternValid enum value | CZipArchive::CWildcard |
SetPattern(LPCTSTR lpszPattern, bool bCaseSensitive) | CZipArchive::CWildcard | [inline]
~CWildcard() (defined in CZipArchive::CWildcard) | CZipArchive::CWildcard | [inline, virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipAutoBuffer Member List

This is the complete list of members for CZipAutoBuffer, including all inherited members.
Allocate(DWORD iSize, bool bZeroMemory=false) (defined in CZipAutoBuffer) | CZipAutoBuffer |
CZipAutoBuffer(DWORD iSize, bool bZeroMemory=false) (defined in CZipAutoBuffer) | CZipAutoBuffer |
CZipAutoBuffer() (defined in CZipAutoBuffer) | CZipAutoBuffer |
CZipAutoBuffer(const CZipAutoBuffer &buffer) (defined in CZipAutoBuffer) | CZipAutoBuffer |
GetBuffer() const (defined in CZipAutoBuffer) | CZipAutoBuffer | [inline]
GetSize() const (defined in CZipAutoBuffer) | CZipAutoBuffer | [inline]
IsAllocated() const (defined in CZipAutoBuffer) | CZipAutoBuffer | [inline]
m_iSize (defined in CZipAutoBuffer) | CZipAutoBuffer | [protected]
m_pBuffer (defined in CZipAutoBuffer) | CZipAutoBuffer | [protected]
operator char *() (defined in CZipAutoBuffer) | CZipAutoBuffer | [inline]
operator const char *() const (defined in CZipAutoBuffer) | CZipAutoBuffer | [inline]
operator=(const CZipAutoBuffer &buffer) (defined in CZipAutoBuffer) | CZipAutoBuffer |
Release() (defined in CZipAutoBuffer) | CZipAutoBuffer |
~CZipAutoBuffer() (defined in CZipAutoBuffer) | CZipAutoBuffer | [virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipCentralDir Member List

This is the complete list of members for CZipCentralDir, including all inherited members.
AddNewFile(const CZipFileHeader &header, int iReplaceIndex=-1) | CZipCentralDir |
BuildFindFastArray(bool bCaseSensitive) | CZipCentralDir | [protected]
Clear(bool bEverything=true) | CZipCentralDir |
CloseFile(bool bAfterException=false) | CZipCentralDir |
CloseNewFile() | CZipCentralDir |
CompareElement(LPCTSTR lpszFileName, WORD uIndex) const | CZipCentralDir | [inline, protected]
CompareHeaders(const void *pArg1, const void *pArg2) (defined in CZipCentralDir) | CZipCentralDir | [inline, protected, static]
ConvertAll() | CZipCentralDir |
ConvertFileName(bool bFromZip, bool bAfterOpen, CZipFileHeader *pHeader=NULL) const | CZipCentralDir | [inline]
CZipCentralDir() (defined in CZipCentralDir) | CZipCentralDir |
EnableFindFast(bool bEnable, bool bCaseSensitive) | CZipCentralDir |
FindFile(LPCTSTR lpszFileName, bool bCaseSensitive, bool bSporadically, bool bFileNameOnly) | CZipCentralDir |
FindFileNameIndex(LPCTSTR lpszFileName) const | CZipCentralDir |
GetBytesBefore() const (defined in CZipCentralDir) | CZipCentralDir | [inline]
GetFindFastIndex(int iFindFastIndex) const | CZipCentralDir | [inline]
GetInfo(Info &info) const | CZipCentralDir | [inline]
GetProperHeaderFileName(const CZipFileHeader *pHeader) const | CZipCentralDir | [inline]
GetSize(bool bWhole=false) const | CZipCentralDir |
Init() | CZipCentralDir |
InsertFindFastElement(CZipFileHeader *pHeader, WORD uIndex) | CZipCentralDir | [protected]
IsFindFastEnabled() | CZipCentralDir | [inline]
IsValidIndex(int uIndex) const | CZipCentralDir |
Locate() | CZipCentralDir | [protected]
m_bCaseSensitive | CZipCentralDir | [protected]
m_bConvertAfterOpen | CZipCentralDir |
m_bFindFastEnabled | CZipCentralDir | [protected]
m_findarray | CZipCentralDir | [protected]
m_gszSignature | CZipCentralDir | [static]
m_headers | CZipCentralDir |
m_iBufferSize | CZipCentralDir |
m_info | CZipCentralDir | [protected]
m_pCompare | CZipCentralDir | [protected]
m_pLocalExtraField | CZipCentralDir |
m_pOpenedFile | CZipCentralDir |
m_pStorage | CZipCentralDir |
m_pszComment | CZipCentralDir |
m_szSignature | CZipCentralDir |
OpenFile(WORD uIndex) | CZipCentralDir |
operator[](int iIndex) (defined in CZipCentralDir) | CZipCentralDir | [inline]
operator[](int iIndex) const (defined in CZipCentralDir) | CZipCentralDir | [inline]
Read() | CZipCentralDir |
ReadHeaders() | CZipCentralDir | [protected]
RemoveAll() | CZipCentralDir |
RemoveDataDescr(bool bFromBuffer) | CZipCentralDir | [protected]
RemoveFile(CZipFileHeader *pHeader, int iIndex=-1, bool bShift=true) | CZipCentralDir |
RemoveFromDisk() | CZipCentralDir |
RemoveHeaders() | CZipCentralDir | [protected]
RemoveLastFile(CZipFileHeader *pHeader=NULL, int iIndex=-1) | CZipCentralDir | [inline]
RenameFile(WORD uIndex, LPCTSTR lpszNewName) | CZipCentralDir |
SortHeaders() | CZipCentralDir | [protected]
ThrowError(int err) const | CZipCentralDir | [protected]
Write(CZipActionCallback *pCallback) | CZipCentralDir |
WriteCentralEnd() | CZipCentralDir | [protected]
WriteHeaders(CZipActionCallback *pCallback, bool bOneDisk) | CZipCentralDir | [protected]
~CZipCentralDir() (defined in CZipCentralDir) | CZipCentralDir | [virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipException Member List

This is the complete list of members for CZipException, including all inherited members.
aborted enum value | CZipException |
abortedAction enum value | CZipException |
abortedSafely enum value | CZipException |
badCrc enum value | CZipException |
badPassword enum value | CZipException |
badZipFile enum value | CZipException |
bufError enum value | CZipException |
cdirNotFound enum value | CZipException |
CZipException(int iCause=generic, LPCTSTR lpszZipName=NULL) | CZipException |
CZipException(CZipException &e) (defined in CZipException) | CZipException | [inline]
dataError enum value | CZipException |
dirWithSize enum value | CZipException |
errNo enum value | CZipException |
generic enum value | CZipException |
GetErrorDescription() | CZipException |
GetErrorMessage(LPTSTR lpszError, UINT nMaxError, UINT *=NULL) | CZipException |
GetInternalErrorDescription(int iCause, bool bNoLoop=false) | CZipException | [protected]
GetSystemErrorDescription() | CZipException | [protected]
internal enum value | CZipException |
m_iCause | CZipException |
m_szFileName | CZipException |
memError enum value | CZipException |
needDict enum value | CZipException |
noCallback enum value | CZipException |
noError enum value | CZipException |
nonRemovable enum value | CZipException |
notRemoved enum value | CZipException |
notRenamed enum value | CZipException |
platfNotSupp enum value | CZipException |
streamEnd enum value | CZipException |
streamError enum value | CZipException |
Throw(int iZipError=CZipException::generic, LPCTSTR lpszZipName=NULL) | CZipException | [inline, static]
tooLongFileName enum value | CZipException |
tooManyVolumes enum value | CZipException |
versionError enum value | CZipException |
ZipErrors enum name | CZipException |
ZlibErrToZip(int iZlibError) | CZipException | [static]
~CZipException() (defined in CZipException) | CZipException | [virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Member List

CZipFileHeader Member List

This is the complete list of members for CZipFileHeader, including all inherited members.
CheckCrcAndSizes(char *pBuf) const | CZipFileHeader | [protected]
CompressionEfficient() | CZipFileHeader | [inline]
CZipArchive (defined in CZipFileHeader) | CZipFileHeader | [friend]
CZipCentralDir (defined in CZipFileHeader) | CZipFileHeader | [friend]
CZipFileHeader() (defined in CZipFileHeader) | CZipFileHeader |
GetComment() const | CZipFileHeader |
GetCommentSize() const | CZipFileHeader | [inline]
GetCompressionRatio() | CZipFileHeader | [inline]
GetCrcAndSizes(char *pBuffer) const | CZipFileHeader | [protected]
GetEffComprSize() | CZipFileHeader | [inline]
GetExtraFieldSize() const | CZipFileHeader | [inline]
GetFileName() const | CZipFileHeader |
GetFileNameSize() const | CZipFileHeader | [inline]
GetOriginalAttributes() const | CZipFileHeader | [inline]
GetSize(bool bLocal=false) const | CZipFileHeader |
GetSystemAttr() const | CZipFileHeader |
GetSystemCompatibility() const | CZipFileHeader | [inline]
GetTime() const | CZipFileHeader |
IsDataDescr() const | CZipFileHeader | [inline]
IsDirectory() const | CZipFileHeader |
IsEncrypted() const | CZipFileHeader | [inline]
m_gszLocalSignature | CZipFileHeader | [static]
m_gszSignature | CZipFileHeader | [static]
m_pExtraField | CZipFileHeader |
m_pszComment | CZipFileHeader | [protected]
m_pszFileName | CZipFileHeader | [protected]
m_szSignature | CZipFileHeader |
m_uComprSize | CZipFileHeader |
m_uCrc32 | CZipFileHeader |
m_uDiskStart | CZipFileHeader |
m_uExternalAttr | CZipFileHeader | [protected]
m_uFlag | CZipFileHeader |
m_uInternalAttr | CZipFileHeader |
m_uMethod | CZipFileHeader |
m_uModDate | CZipFileHeader |
m_uModTime | CZipFileHeader |
m_uOffset | CZipFileHeader |
m_uUncomprSize | CZipFileHeader |
m_uVersionMadeBy | CZipFileHeader |
m_uVersionNeeded | CZipFileHeader |
PrepareData(int iLevel, bool bSpan, bool bEncrypted) | CZipFileHeader | [protected]
Read(CZipStorage *pStorage) | CZipFileHeader | [protected]
ReadLocal(CZipStorage *pStorage, WORD &iLocExtrFieldSize) | CZipFileHeader | [protected]
SetComment(LPCTSTR lpszComment) | CZipFileHeader |
SetFileName(LPCTSTR lpszFileName) | CZipFileHeader |
SetSystemAttr(DWORD uAttr) | CZipFileHeader | [protected]
SetSystemCompatibility(int iSystemID) | CZipFileHeader | [inline, protected]
SetTime(const time_t &ttime) | CZipFileHeader |
SetVersion(WORD uVersion) | CZipFileHeader | [inline, protected]
Write(CZipStorage *pStorage) | CZipFileHeader | [protected]
WriteLocal(CZipStorage &storage) | CZipFileHeader | [protected]
ZipCompatibility::FileNameUpdate (defined in CZipFileHeader) | CZipFileHeader | [friend]
~CZipFileHeader() (defined in CZipFileHeader) | CZipFileHeader | [virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Member List

CZipMemFile Member List

This is the complete list of members for CZipMemFile, including all inherited members.
Attach(BYTE *lpBuf, UINT nBufSize, long nGrowBy=0) (defined in CZipMemFile) | CZipMemFile | [inline]
Close() (defined in CZipMemFile) | CZipMemFile | [inline]
CZipMemFile(long nGrowBy=1024) (defined in CZipMemFile) | CZipMemFile | [inline]
CZipMemFile(BYTE *lpBuf, UINT nBufSize, long nGrowBy=0) (defined in CZipMemFile) | CZipMemFile | [inline]
Detach() (defined in CZipMemFile) | CZipMemFile | [inline]
Flush() (defined in CZipMemFile) | CZipMemFile | [inline]
Free() (defined in CZipMemFile) | CZipMemFile | [inline, protected]
GetFilePath() const (defined in CZipMemFile) | CZipMemFile | [inline]
GetLength() const (defined in CZipMemFile) | CZipMemFile | [inline]
GetPosition() const (defined in CZipMemFile) | CZipMemFile | [inline]
Grow(size_t nBytes) (defined in CZipMemFile) | CZipMemFile | [protected]
Init() (defined in CZipMemFile) | CZipMemFile | [inline, protected]
IsClosed() const (defined in CZipMemFile) | CZipMemFile | [inline]
m_bAutoDelete (defined in CZipMemFile) | CZipMemFile | [protected]
m_lpBuf (defined in CZipMemFile) | CZipMemFile | [protected]
m_nBufSize (defined in CZipMemFile) | CZipMemFile | [protected]
m_nDataSize (defined in CZipMemFile) | CZipMemFile | [protected]
m_nGrowBy (defined in CZipMemFile) | CZipMemFile | [protected]
m_nPos (defined in CZipMemFile) | CZipMemFile | [protected]
Read(void *lpBuf, UINT nCount) (defined in CZipMemFile) | CZipMemFile |
Seek(ZIP_LONGLONG lOff, int nFrom) (defined in CZipMemFile) | CZipMemFile |
SetLength(ZIP_ULONGLONG nNewLen) (defined in CZipMemFile) | CZipMemFile |
Write(const void *lpBuf, UINT nCount) (defined in CZipMemFile) | CZipMemFile |
~CZipMemFile() (defined in CZipMemFile) | CZipMemFile | [inline, virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Member List

CZipPathComponent Member List

This is the complete list of members for CZipPathComponent, including all inherited members.
AppendSeparator(CZipString &szPath) | CZipPathComponent | [inline, static]
CZipPathComponent() (defined in CZipPathComponent) | CZipPathComponent | [inline]
CZipPathComponent(LPCTSTR lpszFullPath) | CZipPathComponent | [inline]
GetFileDrive() const | CZipPathComponent | [inline]
GetFileExt() const | CZipPathComponent | [inline]
GetFileName() const | CZipPathComponent | [inline]
GetFilePath() const | CZipPathComponent | [inline]
GetFileTitle() const | CZipPathComponent | [inline]
GetFullPath() const | CZipPathComponent | [inline]
GetNoDrive() const | CZipPathComponent |
HasEndingSeparator(const CZipString &szPath) | CZipPathComponent | [inline, static]
IsSeparator(TCHAR c) | CZipPathComponent | [inline, static]
m_cSeparator | CZipPathComponent | [static]
m_szDirectory | CZipPathComponent | [protected]
m_szDrive | CZipPathComponent | [protected]
m_szFileExt | CZipPathComponent | [protected]
m_szFileTitle | CZipPathComponent | [protected]
m_szPrefix | CZipPathComponent | [protected]
RemoveSeparators(CZipString &szPath) | CZipPathComponent | [inline, static]
RemoveSeparatorsLeft(CZipString &szPath) | CZipPathComponent | [inline, static]
SetExtension(LPCTSTR lpszExt) | CZipPathComponent | [inline]
SetFileTitle(LPCTSTR lpszFileTitle) | CZipPathComponent | [inline]
SetFullPath(LPCTSTR lpszFullPath) | CZipPathComponent |
~CZipPathComponent() (defined in CZipPathComponent) | CZipPathComponent | [virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Member List

CZipStorage Member List

This is the complete list of members for CZipStorage, including all inherited members.
CallCallback(int iCode, CZipString szTemp) | CZipStorage | [protected]
ChangeDisk(int iNumber) | CZipStorage |
ChangePkzipRead() | CZipStorage | [protected]
ChangeTdRead() | CZipStorage | [protected]
Close(bool bAfterException) | CZipStorage |
CZipCentralDir (defined in CZipStorage) | CZipStorage | [friend]
CZipStorage() (defined in CZipStorage) | CZipStorage |
EmptyWriteBuffer() | CZipStorage | [inline, protected]
FinalizeSpan() | CZipStorage |
Flush() | CZipStorage |
FlushFile() | CZipStorage | [inline]
GetCurrentDisk() const | CZipStorage | [inline]
GetFreeInBuffer() const | CZipStorage | [inline, protected]
GetFreeVolumeSpace() const | CZipStorage | [protected]
GetPosition() const | CZipStorage | [inline]
GetTdVolumeName(bool bLast, LPCTSTR lpszZipName=NULL) const | CZipStorage | [protected]
IsReadOnly() | CZipStorage | [inline]
IsSpanMode() const | CZipStorage | [inline]
m_bInMemory | CZipStorage | [protected]
m_bNewSpan | CZipStorage | [protected]
m_bReadOnly | CZipStorage | [protected]
m_gszExtHeaderSignat | CZipStorage | [static]
m_iBytesWritten | CZipStorage | [protected]
m_iCurrentDisk | CZipStorage | [protected]
m_internalfile | CZipStorage |
m_iSpanMode | CZipStorage |
m_iTdSpanData | CZipStorage | [protected]
m_iWriteBufferSize | CZipStorage |
m_pChangeDiskFunc | CZipStorage |
m_pFile | CZipStorage |
m_pWriteBuffer | CZipStorage | [protected]
m_szSpanExtension | CZipStorage | [protected]
m_uBytesInWriteBuffer | CZipStorage | [protected]
m_uCurrentVolSize | CZipStorage | [protected]
m_uVolumeFreeInBuffer | CZipStorage | [protected]
NextDisk(int iNeeded, LPCTSTR lpszFileName=NULL) | CZipStorage |
noSpan enum value | CZipStorage |
Open(CZipMemFile &mf, int iMode) | CZipStorage |
Open(LPCTSTR szPathName, int iMode, int iVolumeSize) | CZipStorage |
OpenFile(LPCTSTR lpszName, UINT uFlags, bool bThrow=true) | CZipStorage | [protected]
pkzipSpan enum value | CZipStorage |
Read(void *pBuf, DWORD iSize, bool bAtOnce) | CZipStorage |
RenameLastFileInTDSpan() | CZipStorage | [protected]
suggestedAuto enum value | CZipStorage |
suggestedTd enum value | CZipStorage |
tdSpan enum value | CZipStorage |
ThrowError(int err) | CZipStorage | [protected]
UpdateSpanMode(WORD uLastDisk) | CZipStorage |
VolumeLeft() const | CZipStorage | [protected]
Write(const void *pBuf, DWORD iSize, bool bAtOnce) | CZipStorage |
WriteInternalBuffer(const char *pBuf, DWORD uSize) | CZipStorage | [protected]
ZipSpanMode enum name | CZipStorage |
~CZipStorage() (defined in CZipStorage) | CZipStorage | [virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Alphabetical index

ZipArchive Class Index

A | C | E | F | M | P | S

A
CZipArchive::CZipDeleteInfo CZipCentralDir
F
P
CZipActionCallback CZipArchive::CZipInternalInfo CZipCentralDir::CZipFindFast CZipFileHeader CZipPathComponent
CZipAddNewFileInfo CZipArchive::CZipSmClrPass CZipCentralDir::Info CZipFileMapping
S
CZipArchive CZipAutoBuffer
E
M
CZipSpanCallback
CZipArchive::CWildcard
C
CZipException CZipMemFile CZipStorage
CZipArchive::CZipClbckStrg CZipCallback

A | C | E | F | M | P | S

ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


File Index

ZipArchive File List

Here is a list of all documented files with brief descriptions:
ZipArchive.h [code] | Interface for the CZipArchive class
ZipAutoBuffer.h [code] | Interface for the CZipAutoBuffer class
ZipCentralDir.h [code] | Interface for the CZipCentralDir class
ZipCompatibility.h [code] | ZipCompatibility namespace declaration
ZipException.h [code] | Interface for the CZipException class
ZipFileHeader.h [code] | Interface for the CZipFileHeader class
ZipMemFile.h [code] | Interface for the CZipMemFile class
ZipPathComponent.h [code] | Interface for the CZipPathComponent class
ZipPlatform.h [code] | ZipPlatform namespace declaration
ZipStorage.h [code] | Interface for the CZipStorage class
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


Compound Member Index

All | Functions | Variables | Enumerations | Enumeration values

  • CallbackType : CZipArchive
  • CloseAfterException : CZipArchive
  • FFCaseSens : CZipArchive
  • Match : CZipArchive::CWildcard
  • OpenFileType : CZipArchive
  • OpenMode : CZipArchive
  • Pattern : CZipArchive::CWildcard
  • Predict : CZipArchive
  • Smartness : CZipArchive
  • ZipErrors : CZipException
  • ZipSpanMode : CZipStorage
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


Compound Member Index

All | Functions | Variables | Enumerations | Enumeration values
a | b | c | d | e | f | g | i | m | n | p | s | t | v | z

- a -

  • aborted : CZipException
  • abortedAction : CZipException
  • abortedSafely : CZipException
  • afAfterException : CZipArchive
  • afNoException : CZipArchive
  • afWriteDir : CZipArchive

- b -

  • badCrc : CZipException
  • badPassword : CZipException
  • badZipFile : CZipException
  • bufError : CZipException

- c -

  • cbActions : CZipArchive
  • cbAdd : CZipArchive
  • cbAddStore : CZipArchive
  • cbAddTmp : CZipArchive
  • cbAll : CZipArchive
  • cbDelete : CZipArchive
  • cbDeleteCnt : CZipArchive
  • cbExtract : CZipArchive
  • cbGetFromArchive : CZipArchive
  • cbNextValue : CZipArchive
  • cbNothing : CZipArchive
  • cbRename : CZipArchive
  • cbReplace : CZipArchive
  • cbSave : CZipArchive
  • cbSubActions : CZipArchive
  • cbTest : CZipArchive
  • cdirNotFound : CZipException
  • compress : CZipArchive

- d -

  • dataError : CZipException
  • dirWithSize : CZipException

- e -

  • errNo : CZipException
  • extract : CZipArchive

- f -

  • ffCaseSens : CZipArchive
  • ffDefault : CZipArchive
  • ffNoCaseSens : CZipArchive

- g -

  • generic : CZipException

- i -

  • internal : CZipException

- m -

  • matchAbort : CZipArchive::CWildcard
  • matchEnd : CZipArchive::CWildcard
  • matchLiteral : CZipArchive::CWildcard
  • matchNone : CZipArchive::CWildcard
  • matchPattern : CZipArchive::CWildcard
  • matchRange : CZipArchive::CWildcard
  • matchValid : CZipArchive::CWildcard
  • memError : CZipException

- n -

  • needDict : CZipException
  • noCallback : CZipException
  • noError : CZipException
  • nonRemovable : CZipException
  • noSpan : CZipStorage
  • nothing : CZipArchive
  • notRemoved : CZipException
  • notRenamed : CZipException

- p -

  • patternClose : CZipArchive::CWildcard
  • patternEmpty : CZipArchive::CWildcard
  • patternEsc : CZipArchive::CWildcard
  • patternRange : CZipArchive::CWildcard
  • patternValid : CZipArchive::CWildcard
  • pkzipSpan : CZipStorage
  • platfNotSupp : CZipException
  • prAuto : CZipArchive
  • prDir : CZipArchive
  • prFile : CZipArchive

- s -

  • streamEnd : CZipException
  • streamError : CZipException
  • suggestedAuto : CZipStorage
  • suggestedTd : CZipStorage

- t -

  • tdSpan : CZipStorage
  • tooLongFileName : CZipException
  • tooManyVolumes : CZipException

- v -

  • versionError : CZipException

- z -

  • zipCreate : CZipArchive
  • zipCreateSpan : CZipArchive
  • zipOpen : CZipArchive
  • zipOpenReadOnly : CZipArchive
  • zipsmCheckForEff : CZipArchive
  • zipsmCheckForEffInMem : CZipArchive
  • zipsmCPassDir : CZipArchive
  • zipsmCPFile0 : CZipArchive
  • zipsmInternal01 : CZipArchive
  • zipsmLazy : CZipArchive
  • zipsmMemoryFlag : CZipArchive
  • zipsmNotCompSmall : CZipArchive
  • zipsmSafeSmart : CZipArchive
  • zipsmSmartAdd : CZipArchive
  • zipsmSmartest : CZipArchive
  • zipsmSmartPass : CZipArchive
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


Compound Member Index

All | Functions | Variables | Enumerations | Enumeration values
_ | a | b | c | d | e | f | g | h | i | l | m | n | o | p | r | s | t | u | v | w | z

- _ -

  • _zliballoc() : CZipArchive
  • _zlibfree() : CZipArchive

- a -

  • AddNewFile() : CZipCentralDir, CZipArchive
  • AppendSeparator() : CZipPathComponent

- b -

  • BuildFindFastArray() : CZipCentralDir

- c -

  • Callback() : CZipCallback
  • CallbackEnd() : CZipActionCallback
  • CallCallback() : CZipStorage
  • ChangeDisk() : CZipStorage
  • ChangePkzipRead() : CZipStorage
  • ChangeTdRead() : CZipStorage
  • CheckCrcAndSizes() : CZipFileHeader
  • CheckForError() : CZipArchive
  • Clear() : CZipCentralDir
  • Close() : CZipStorage, CZipArchive
  • CloseFile() : CZipCentralDir, CZipArchive
  • CloseFileWithNoUpdate() : CZipArchive
  • CloseNewFile() : CZipCentralDir, CZipArchive
  • CompareElement() : CZipCentralDir
  • CompressionEfficient() : CZipFileHeader
  • ConvertAll() : CZipCentralDir
  • ConvertFileName() : CZipCentralDir
  • CryptCheck() : CZipArchive
  • CryptCRC32() : CZipArchive
  • CryptCryptHeader() : CZipArchive
  • CryptDecode() : CZipArchive
  • CryptDecodeBuffer() : CZipArchive
  • CryptDecryptByte() : CZipArchive
  • CryptEncode() : CZipArchive
  • CryptEncodeBuffer() : CZipArchive
  • CryptInitKeys() : CZipArchive
  • CryptUpdateKeys() : CZipArchive
  • CurrentFile() : CZipArchive
  • CWildcard() : CZipArchive::CWildcard
  • CZipException() : CZipException
  • CZipPathComponent() : CZipPathComponent

- d -

  • Defaults() : CZipAddNewFileInfo
  • DeleteFile() : CZipArchive
  • DeleteFiles() : CZipArchive

- e -

  • EmptyPtrList() : CZipArchive
  • EmptyWriteBuffer() : CZipStorage
  • EnableFindFast() : CZipCentralDir, CZipArchive
  • ExtractFile() : CZipArchive

- f -

  • FinalizeSpan() : CZipStorage
  • FindFile() : CZipCentralDir, CZipArchive
  • FindFileNameIndex() : CZipCentralDir
  • FindMatches() : CZipArchive
  • Flush() : CZipStorage, CZipArchive
  • FlushFile() : CZipStorage

- g -

  • GetAdvanced() : CZipArchive
  • GetArchivePath() : CZipArchive
  • GetAutoFlush() : CZipArchive
  • GetCallback() : CZipArchive
  • GetCentralDirInfo() : CZipArchive
  • GetCentralDirSize() : CZipArchive
  • GetComment() : CZipFileHeader
  • GetCommentSize() : CZipFileHeader
  • GetCompressionRatio() : CZipFileHeader
  • GetCount() : CZipArchive
  • GetCrcAndSizes() : CZipFileHeader
  • GetCRCTable() : CZipArchive
  • GetCurrentDisk() : CZipStorage, CZipArchive
  • GetEffComprSize() : CZipFileHeader
  • GetErrorDescription() : CZipException
  • GetErrorMessage() : CZipException
  • GetExtraFieldSize() : CZipFileHeader
  • GetFileDrive() : CZipPathComponent
  • GetFileExt() : CZipPathComponent
  • GetFileInfo() : CZipArchive
  • GetFileName() : CZipPathComponent, CZipFileHeader
  • GetFileNameSize() : CZipFileHeader
  • GetFilePath() : CZipPathComponent
  • GetFileTitle() : CZipPathComponent
  • GetFindFastIndex() : CZipCentralDir, CZipArchive
  • GetFreeInBuffer() : CZipStorage
  • GetFreeVolumeSpace() : CZipStorage
  • GetFromArchive() : CZipArchive
  • GetFullPath() : CZipPathComponent
  • GetGlobalComment() : CZipArchive
  • GetIndexes() : CZipArchive
  • GetInfo() : CZipCentralDir
  • GetInternalErrorDescription() : CZipException
  • GetLocalExtraField() : CZipArchive
  • GetNoDrive() : CZipPathComponent
  • GetOriginalAttributes() : CZipFileHeader
  • GetPassword() : CZipArchive
  • GetPosition() : CZipStorage
  • GetProperHeaderFileName() : CZipCentralDir
  • GetRootPath() : CZipArchive
  • GetSize() : CZipFileHeader, CZipCentralDir
  • GetSpanMode() : CZipArchive
  • GetStep() : CZipActionCallback
  • GetStorage() : CZipArchive
  • GetSystemAttr() : CZipFileHeader
  • GetSystemCompatibility() : CZipFileHeader, CZipArchive
  • GetSystemErrorDescription() : CZipException
  • GetTdVolumeName() : CZipStorage
  • GetTempPath() : CZipArchive
  • GetTime() : CZipFileHeader

- h -

  • HasEndingSeparator() : CZipPathComponent

- i -

  • Init() : CZipActionCallback, CZipCentralDir, CZipArchive::CZipInternalInfo
  • InsertFindFastElement() : CZipCentralDir
  • IsClosed() : CZipArchive
  • IsDataDescr() : CZipFileHeader
  • IsDirectory() : CZipFileHeader
  • IsEncrypted() : CZipFileHeader
  • IsFindFastEnabled() : CZipCentralDir
  • IsMatch() : CZipArchive::CWildcard
  • IsPattern() : CZipArchive::CWildcard
  • IsPatternValid() : CZipArchive::CWildcard
  • IsReadOnly() : CZipStorage, CZipArchive
  • IsSeparator() : CZipPathComponent
  • IsSpanMode() : CZipStorage
  • IsValidIndex() : CZipCentralDir

- l -

  • LeftToDo() : CZipActionCallback
  • Locate() : CZipCentralDir

- m -

  • MakeSpaceForReplace() : CZipArchive
  • Match() : CZipArchive::CWildcard
  • MovePackedFiles() : CZipArchive

- n -

  • NextDisk() : CZipStorage

- o -

  • Open() : CZipStorage, CZipArchive
  • OpenFile() : CZipStorage, CZipCentralDir, CZipArchive
  • OpenInternal() : CZipArchive
  • OpenNewFile() : CZipArchive
  • operator()() : CZipActionCallback

- p -

  • PredictExtractedFileName() : CZipArchive
  • PredictFileNameInZip() : CZipArchive
  • PrepareData() : CZipFileHeader

- r -

  • Read() : CZipStorage, CZipFileHeader, CZipCentralDir
  • ReadFile() : CZipArchive
  • ReadHeaders() : CZipCentralDir
  • ReadLocal() : CZipFileHeader
  • RemoveAll() : CZipCentralDir
  • RemoveDataDescr() : CZipCentralDir
  • RemoveFile() : CZipCentralDir
  • RemoveFromDisk() : CZipCentralDir
  • RemoveHeaders() : CZipCentralDir
  • RemoveLast() : CZipArchive
  • RemoveLastFile() : CZipCentralDir
  • RemovePathBeginning() : CZipArchive
  • RemoveSeparators() : CZipPathComponent
  • RemoveSeparatorsLeft() : CZipPathComponent
  • RenameFile() : CZipCentralDir, CZipArchive
  • RenameLastFileInTDSpan() : CZipStorage

- s -

  • SetAdvanced() : CZipArchive
  • SetAutoFlush() : CZipArchive
  • SetCallback() : CZipArchive
  • SetCaseSensitivity() : CZipArchive
  • SetComment() : CZipFileHeader
  • SetConvertAfterOpen() : CZipArchive
  • SetDetectZlibMemoryLeaks() : CZipArchive
  • SetExtension() : CZipPathComponent
  • SetExtraField() : CZipArchive
  • SetFileComment() : CZipArchive
  • SetFileHeaderAttr() : CZipArchive
  • SetFileName() : CZipFileHeader
  • SetFileTitle() : CZipPathComponent
  • SetFullPath() : CZipPathComponent
  • SetGlobalComment() : CZipArchive
  • SetIgnoreCRC() : CZipArchive
  • SetPassword() : CZipArchive
  • SetPattern() : CZipArchive::CWildcard
  • SetRootPath() : CZipArchive
  • SetSpanCallback() : CZipArchive
  • SetSystemAttr() : CZipFileHeader
  • SetSystemCompatibility() : CZipFileHeader, CZipArchive
  • SetTempPath() : CZipArchive
  • SetTime() : CZipFileHeader
  • SetTotal() : CZipActionCallback
  • SetVersion() : CZipFileHeader
  • SingleToWide() : CZipArchive
  • SortHeaders() : CZipCentralDir

- t -

  • TestFile() : CZipArchive
  • Throw() : CZipException
  • ThrowError() : CZipStorage, CZipCentralDir, CZipArchive
  • TrimRootPath() : CZipArchive

- u -

  • UpdateReplaceIndex() : CZipArchive
  • UpdateSpanMode() : CZipStorage

- v -

  • VolumeLeft() : CZipStorage

- w -

  • WideToSingle() : CZipArchive
  • WillBeDuplicated() : CZipArchive
  • Write() : CZipStorage, CZipFileHeader, CZipCentralDir
  • WriteCentralDirectory() : CZipArchive
  • WriteCentralEnd() : CZipCentralDir
  • WriteHeaders() : CZipCentralDir
  • WriteInternalBuffer() : CZipStorage
  • WriteLocal() : CZipFileHeader
  • WriteNewFile() : CZipArchive

- z -

  • ZlibErrToZip() : CZipException
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


Compound Member Index

All | Functions | Variables | Enumerations | Enumeration values
m

- m -

  • m_bAutoFlush : CZipArchive
  • m_bCaseSensitive : CZipCentralDir, CZipArchive
  • m_bConvertAfterOpen : CZipCentralDir
  • m_bDetectZlibMemoryLeaks : CZipArchive
  • m_bFindFastEnabled : CZipCentralDir
  • m_bFullPath : CZipAddNewFileInfo
  • m_bIgnoreCRC : CZipArchive
  • m_bInMemory : CZipStorage
  • m_bNewSpan : CZipStorage
  • m_bOnDisk : CZipCentralDir::Info
  • m_bReadOnly : CZipStorage
  • m_bRemoveDriveLetter : CZipArchive
  • m_callbacks : CZipArchive
  • m_centralDir : CZipArchive
  • m_cSeparator : CZipPathComponent
  • m_findarray : CZipCentralDir
  • m_gszCopyright : CZipArchive
  • m_gszExtHeaderSignat : CZipStorage
  • m_gszLocalSignature : CZipFileHeader
  • m_gszSignature : CZipFileHeader, CZipCentralDir
  • m_headers : CZipCentralDir
  • m_iArchiveSystCompatib : CZipArchive
  • m_iBufferSize : CZipCentralDir, CZipArchive::CZipInternalInfo
  • m_iBytesWritten : CZipStorage
  • m_iCause : CZipException
  • m_iComprLevel : CZipAddNewFileInfo
  • m_iCurrentDisk : CZipStorage
  • m_iFileOpened : CZipArchive
  • m_info : CZipCentralDir, CZipArchive
  • m_internalfile : CZipStorage
  • m_iReplaceIndex : CZipAddNewFileInfo
  • m_iSmartLevel : CZipAddNewFileInfo
  • m_iSpanMode : CZipStorage
  • m_iStep : CZipActionCallback
  • m_iTdSpanData : CZipStorage
  • m_iType : CZipActionCallback
  • m_iWriteBufferSize : CZipStorage
  • m_keys : CZipArchive
  • m_list : CZipArchive
  • m_nBufSize : CZipAddNewFileInfo
  • m_pBuffer : CZipArchive::CZipInternalInfo
  • m_pChangeDiskFunc : CZipStorage
  • m_pCompare : CZipCentralDir
  • m_pExtraField : CZipFileHeader
  • m_pFile : CZipStorage, CZipAddNewFileInfo
  • m_pHeader : CZipCentralDir::CZipFindFast
  • m_pLocalExtraField : CZipCentralDir
  • m_pOpenedFile : CZipCentralDir
  • m_pStorage : CZipCentralDir
  • m_pszComment : CZipFileHeader, CZipCentralDir
  • m_pszFileName : CZipFileHeader
  • m_pszPassword : CZipArchive
  • m_pWriteBuffer : CZipStorage
  • m_pZipCompare : CZipArchive
  • m_storage : CZipArchive
  • m_stream : CZipArchive::CZipInternalInfo
  • m_szDirectory : CZipPathComponent
  • m_szDrive : CZipPathComponent
  • m_szExternalFile : CZipCallback
  • m_szFileExt : CZipPathComponent
  • m_szFileInZip : CZipActionCallback
  • m_szFileName : CZipException
  • m_szFileNameInZip : CZipAddNewFileInfo
  • m_szFilePath : CZipAddNewFileInfo
  • m_szFileTitle : CZipPathComponent
  • m_szPrefix : CZipPathComponent
  • m_szRootPath : CZipArchive
  • m_szSignature : CZipFileHeader, CZipCentralDir
  • m_szSpanExtension : CZipStorage
  • m_szTempPath : CZipArchive
  • m_uBytesBeforeZip : CZipCentralDir::Info
  • m_uBytesInWriteBuffer : CZipStorage
  • m_uCentrDirPos : CZipCentralDir::Info
  • m_uComprLeft : CZipArchive::CZipInternalInfo
  • m_uComprSize : CZipFileHeader
  • m_uCrc32 : CZipFileHeader, CZipArchive::CZipInternalInfo
  • m_uCurrentVolSize : CZipStorage
  • m_uDiskEntriesNo : CZipCentralDir::Info
  • m_uDiskNeeded : CZipSpanCallback
  • m_uDiskStart : CZipFileHeader
  • m_uDiskWithCD : CZipCentralDir::Info
  • m_uEntriesNumber : CZipCentralDir::Info
  • m_uExternalAttr : CZipFileHeader
  • m_uFlag : CZipFileHeader
  • m_uIndex : CZipCentralDir::CZipFindFast
  • m_uInternalAttr : CZipFileHeader
  • m_uMethod : CZipFileHeader
  • m_uModDate : CZipFileHeader
  • m_uModTime : CZipFileHeader
  • m_uOffset : CZipFileHeader, CZipCentralDir::Info
  • m_uSize : CZipCentralDir::Info
  • m_uThisDisk : CZipCentralDir::Info
  • m_uTotalSoFar : CZipActionCallback
  • m_uTotalToDo : CZipActionCallback
  • m_uUncomprLeft : CZipArchive::CZipInternalInfo
  • m_uUncomprSize : CZipFileHeader
  • m_uVersionMadeBy : CZipFileHeader
  • m_uVersionNeeded : CZipFileHeader
  • m_uVolumeFreeInBuffer : CZipStorage
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

Consider the following example:

/*! Invisible class because of truncation */
class Invisible { };

/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };

/* Class not documented with doxygen comments */
class Undocumented { };

/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };

/*! A template class */
template<class T> class Templ { };

/*! Class that is inherited using protected inheritance */
class ProtectedBase { };

/*! Class that is inherited using private inheritance */
class PrivateBase { };

/*! Class that is used by the Inherited class */
class Used { };

/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
                  protected ProtectedBase,
                  private PrivateBase,
                  public Undocumented
                  public Templ<int>
{
  private:
    Used *m_usedClass;
};
If the MAX_DOT_GRAPH_HEIGHT tag in the configuration file is set to 240 this will result in the following graph:

The boxes in the above graph have the following meaning:

  • A filled black box represents the struct or class for which the graph is generated.
  • A box with a black border denotes a documented struct or class.
  • A box with a grey border denotes an undocumented struct or class.
  • A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
The arrows have the following meaning:
  • A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • A dark green arrow is used for protected inheritance.
  • A dark red arrow is used for private inheritance.
  • A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
  • A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance.
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Hierarchical Index

ZipArchive Class Hierarchy

Go to the graphical class hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:

  • CZipAddNewFileInfo
  • CZipArchive
  • CZipArchive::CWildcard
  • CZipArchive::CZipClbckStrg
  • CZipArchive::CZipDeleteInfo
  • CZipArchive::CZipInternalInfo
  • CZipArchive::CZipSmClrPass
  • CZipAutoBuffer
  • CZipCallback
    • CZipActionCallback
    • CZipSpanCallback
  • CZipCentralDir
  • CZipCentralDir::CZipFindFast
  • CZipCentralDir::Info
  • CZipException
  • CZipFileHeader
  • CZipFileMapping
  • CZipMemFile
  • CZipPathComponent
  • CZipStorage
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


Module Index

ZipArchive Modules

Here is a list of all modules:
  • Cryptography
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Namespace Member Index

All | Functions | Enumerations | Enumeration values

  • ZipPlatforms : ZipCompatibility
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Namespace Member Index

All | Functions | Enumerations | Enumeration values

  • zcAmiga : ZipCompatibility
  • zcAtari : ZipCompatibility
  • zcCpm : ZipCompatibility
  • zcDosFat : ZipCompatibility
  • zcMacintosh : ZipCompatibility
  • zcNtfs : ZipCompatibility
  • zcOs2Hpfs : ZipCompatibility
  • zcUnix : ZipCompatibility
  • zcVaxVms : ZipCompatibility
  • zcVmCms : ZipCompatibility
  • zcZsystem : ZipCompatibility
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Namespace Member Index

All | Functions | Enumerations | Enumeration values

  • AnsiOem() : ZipPlatform
  • ConvertToSystem() : ZipCompatibility
  • DirectoryExists() : ZipPlatform
  • FileExists() : ZipPlatform
  • FileNameUpdate() : ZipCompatibility
  • FlushFile() : ZipPlatform
  • ForceDirectory() : ZipPlatform
  • GetCurrentDirectory() : ZipPlatform
  • GetDefaultAttributes() : ZipPlatform
  • GetDefaultDirAttributes() : ZipPlatform
  • GetDeviceFreeSpace() : ZipPlatform
  • GetFileModTime() : ZipPlatform
  • GetFileSystemHandle() : ZipPlatform
  • GetSystemCaseSensitivity() : ZipPlatform
  • GetSystemID() : ZipPlatform
  • GetTmpFileName() : ZipPlatform
  • IsDirectory() : ZipPlatform
  • IsDriveRemovable() : ZipPlatform
  • IsPlatformSupported() : ZipCompatibility
  • SetFileModTime() : ZipPlatform
  • SetVolLabel() : ZipPlatform
  • SingleToWide() : ZipPlatform
  • SlashBackslashChg() : ZipCompatibility
  • WideToSingle() : ZipPlatform
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Namespace Index

ZipArchive Namespace List

Here is a list of all documented namespaces with brief descriptions:
ziparchv | A helper namespace
ZipCompatibility | Functions that provides the proper conversion of attributes and filename strings between different system platforms
ZipPlatform | Interface to the system API
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Page Index

ZipArchive Related Pages

Here is a list of all related documentation pages:
  • Revision history
  • FAQ
  • Licensing information
  • GNU GENERAL PUBLIC LICENSE
  • Compilation & Integration
  • General Information
  • ZipArchive Newsletter
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Member List

CZipActionCallback Member List

This is the complete list of members for CZipActionCallback, including all inherited members.
Callback(int iProgress)=0 | CZipCallback | [pure virtual]
CallbackEnd() | CZipActionCallback | [inline, virtual]
CZipActionCallback() (defined in CZipActionCallback) | CZipActionCallback | [inline]
GetStep() | CZipActionCallback | [inline]
Init(LPCTSTR lpszFileInZip=NULL, LPCTSTR lpszExternalFile=NULL) | CZipActionCallback | [inline, virtual]
LeftToDo() | CZipActionCallback | [inline]
m_iStep | CZipActionCallback | [static]
m_iType | CZipActionCallback |
m_szExternalFile | CZipCallback |
m_szFileInZip | CZipActionCallback |
m_uTotalSoFar | CZipActionCallback |
m_uTotalToDo | CZipActionCallback |
operator()(int iProgress) | CZipActionCallback | [inline, virtual]
SetTotal(DWORD uTotalToDo) | CZipActionCallback | [inline, virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:00 2004.


Member List

CZipAddNewFileInfo Member List

This is the complete list of members for CZipAddNewFileInfo, including all inherited members.
CZipAddNewFileInfo(LPCTSTR lpszFilePath, bool bFullPath=true) (defined in CZipAddNewFileInfo) | CZipAddNewFileInfo | [inline]
CZipAddNewFileInfo(LPCTSTR lpszFilePath, LPCTSTR lpszFileNameInZip) (defined in CZipAddNewFileInfo) | CZipAddNewFileInfo | [inline]
CZipAddNewFileInfo(CZipAbstractFile *pFile, LPCTSTR lpszFileNameInZip) (defined in CZipAddNewFileInfo) | CZipAddNewFileInfo | [inline]
Defaults() | CZipAddNewFileInfo |
m_bFullPath | CZipAddNewFileInfo |
m_iComprLevel | CZipAddNewFileInfo |
m_iReplaceIndex | CZipAddNewFileInfo |
m_iSmartLevel | CZipAddNewFileInfo |
m_nBufSize | CZipAddNewFileInfo |
m_pFile | CZipAddNewFileInfo |
m_szFileNameInZip | CZipAddNewFileInfo |
m_szFilePath | CZipAddNewFileInfo |
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipArchive::CZipClbckStrg Member List

This is the complete list of members for CZipArchive::CZipClbckStrg, including all inherited members.
Get(CallbackType iType) (defined in CZipArchive::CZipClbckStrg) | CZipArchive::CZipClbckStrg | [inline]
Set(CZipActionCallback *pCallback, CallbackType iType) (defined in CZipArchive::CZipClbckStrg) | CZipArchive::CZipClbckStrg | [inline]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipArchive::CZipDeleteInfo Member List

This is the complete list of members for CZipArchive::CZipDeleteInfo, including all inherited members.
CZipDeleteInfo() (defined in CZipArchive::CZipDeleteInfo) | CZipArchive::CZipDeleteInfo | [inline]
CZipDeleteInfo(CZipFileHeader *pHeader, bool bDelete) (defined in CZipArchive::CZipDeleteInfo) | CZipArchive::CZipDeleteInfo | [inline]
m_bDelete (defined in CZipArchive::CZipDeleteInfo) | CZipArchive::CZipDeleteInfo |
m_pHeader (defined in CZipArchive::CZipDeleteInfo) | CZipArchive::CZipDeleteInfo |
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipArchive::CZipInternalInfo Member List

This is the complete list of members for CZipArchive::CZipInternalInfo, including all inherited members.
CZipInternalInfo() (defined in CZipArchive::CZipInternalInfo) | CZipArchive::CZipInternalInfo | [inline]
Init() | CZipArchive::CZipInternalInfo | [inline]
m_iBufferSize | CZipArchive::CZipInternalInfo |
m_pBuffer | CZipArchive::CZipInternalInfo |
m_stream | CZipArchive::CZipInternalInfo |
m_uComprLeft | CZipArchive::CZipInternalInfo |
m_uCrc32 | CZipArchive::CZipInternalInfo |
m_uUncomprLeft | CZipArchive::CZipInternalInfo |
ReleaseBuf() (defined in CZipArchive::CZipInternalInfo) | CZipArchive::CZipInternalInfo | [inline]
~CZipInternalInfo() (defined in CZipArchive::CZipInternalInfo) | CZipArchive::CZipInternalInfo | [inline, virtual]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipArchive::CZipSmClrPass Member List

This is the complete list of members for CZipArchive::CZipSmClrPass, including all inherited members.
ClearPasswordSmartly(CZipArchive *pZip) (defined in CZipArchive::CZipSmClrPass) | CZipArchive::CZipSmClrPass | [inline]
m_pZip (defined in CZipArchive::CZipSmClrPass) | CZipArchive::CZipSmClrPass |
m_szPass (defined in CZipArchive::CZipSmClrPass) | CZipArchive::CZipSmClrPass |
~CZipSmClrPass() (defined in CZipArchive::CZipSmClrPass) | CZipArchive::CZipSmClrPass | [inline]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipCallback Member List

This is the complete list of members for CZipCallback, including all inherited members.
Callback(int iProgress)=0 | CZipCallback | [pure virtual]
m_szExternalFile | CZipCallback |
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipCentralDir::CZipFindFast Member List

This is the complete list of members for CZipCentralDir::CZipFindFast, including all inherited members.
CZipFindFast() (defined in CZipCentralDir::CZipFindFast) | CZipCentralDir::CZipFindFast | [inline]
CZipFindFast(CZipFileHeader *pHeader, WORD uIndex) (defined in CZipCentralDir::CZipFindFast) | CZipCentralDir::CZipFindFast | [inline]
m_pHeader | CZipCentralDir::CZipFindFast |
m_uIndex | CZipCentralDir::CZipFindFast |
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:04 2004.


Member List

CZipCentralDir::Info Member List

This is the complete list of members for CZipCentralDir::Info, including all inherited members.
CheckIfOK_1() (defined in CZipCentralDir::Info) | CZipCentralDir::Info | [inline, protected]
CheckIfOK_2() (defined in CZipCentralDir::Info) | CZipCentralDir::Info | [inline, protected]
CZipCentralDir (defined in CZipCentralDir::Info) | CZipCentralDir::Info | [friend]
DiskChange(int iCurrentDisk) (defined in CZipCentralDir::Info) | CZipCentralDir::Info | [inline, protected]
m_bOnDisk | CZipCentralDir::Info |
m_uBytesBeforeZip | CZipCentralDir::Info |
m_uCentrDirPos | CZipCentralDir::Info |
m_uDiskEntriesNo | CZipCentralDir::Info |
m_uDiskWithCD | CZipCentralDir::Info |
m_uEntriesNumber | CZipCentralDir::Info |
m_uOffset | CZipCentralDir::Info |
m_uSize | CZipCentralDir::Info |
m_uThisDisk | CZipCentralDir::Info |
SetBytesBeforeZip(bool bIsSpan) (defined in CZipCentralDir::Info) | CZipCentralDir::Info | [inline, protected]
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


Member List

CZipSpanCallback Member List

This is the complete list of members for CZipSpanCallback, including all inherited members.
Callback(int iProgress)=0 | CZipCallback | [pure virtual]
m_szExternalFile | CZipCallback |
m_uDiskNeeded | CZipSpanCallback |
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:05:05 2004.


ZipArchive.h Source File

ZipArchive.h

Go to the documentation of this file.
00001
00002 // $Workfile: ZipArchive.h $
00003 // $Archive: /ZipArchive/ZipArchive.h $
00004 // $Date: 04-03-06 19:25 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyright 2000-2004 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // For the licensing details see the file License.txt
00015 //
00016 // Check the site http://www.artpol-software.com for the updated version of the library.
00018 //
00019 // The following information files are distributed along with this library:
00020 //  License.txt  - licensing information
00021 //  gpl.txt   - General Public License text
00022 //  Readme.txt  - general information
00023 //  ChangeLog.txt - revision history
00024 //  faq.txt   - frequently asked questions
00025 //  Appnote.txt  - details on the zip format
00026 //       ( also available at ftp://ftp.pkware.com/appnote.zip)
00027 //
00028 //
00029
00030
00031
00038 #if !defined(AFX_ZIPARCHIVE_H__A7F528A6_1872_4071_BE66_D56CC2DDE0E6__INCLUDED_)
00039 #define AFX_ZIPARCHIVE_H__A7F528A6_1872_4071_BE66_D56CC2DDE0E6__INCLUDED_
00040
00062 // to ensure that the correct files are copied
00063 // (see "Compatibility" chapter in the documentation).
00064 // Rebuild the project after copying the files.
00065 #ifdef ZIP_ARCHIVE_MFC_PROJ
00066  #ifndef ZIP_ARCHIVE_MFC
00067   #error You need to copy files from the MFC subdirectory\
00068    to the ZipArchive root directory and rebuild the project
00069  #endif
00070 #elif defined ZIP_ARCHIVE_STL_PROJ
00071  #ifndef ZIP_ARCHIVE_STL
00072   #error You need to copy files from the STL subdirectory\
00073    to the ZipArchive root directory and rebuild the project
00074  #endif
00075 #endif //
00076
00077 #if (_MSC_VER > 1000) && (defined ZIP_HAS_DLL)
00078  #pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class
00079  #pragma warning( disable : 4275 ) // non dll-interface class used as base for dll-interface
00080 #endif
00081
00082 #ifdef __GNUC__
00083  #include "zlib.h"
00084 #else
00085  #include "zlib/zlib.h"
00086 #endif
00087
00088 #include "ZipException.h"
00089 #include "ZipAutoBuffer.h"
00090 #include "ZipCentralDir.h"
00091 #include "ZipStorage.h"
00092 #include "ZipPathComponent.h"
00093 #include "ZipString.h"
00094 #include "ZipExport.h"
00095
00096
00102 struct ZIP_API CZipAddNewFileInfo
00103 {
00104  CZipAddNewFileInfo(LPCTSTR lpszFilePath, bool bFullPath = true)
00105   : m_szFilePath(lpszFilePath),m_bFullPath(bFullPath)
00106  {
00107   m_pFile = NULL;
00108   Defaults();
00109  }
00110  CZipAddNewFileInfo(LPCTSTR lpszFilePath, LPCTSTR lpszFileNameInZip)
00111   : m_szFilePath(lpszFilePath), m_szFileNameInZip(lpszFileNameInZip)
00112  {
00113   m_pFile = NULL;
00114   Defaults();
00115  }
00116  CZipAddNewFileInfo(CZipAbstractFile* pFile, LPCTSTR lpszFileNameInZip)
00117   : m_pFile(pFile), m_szFileNameInZip(lpszFileNameInZip)
00118  {
00119   Defaults();
00120  }
00124  CZipString m_szFilePath;
00125
00131  CZipString m_szFileNameInZip;
00132
00145  bool m_bFullPath;
00146
00150  int m_iComprLevel;
00151
00160  int m_iSmartLevel;
00161
00189  int m_iReplaceIndex;
00190
00194  unsigned long m_nBufSize;
00195
00205  CZipAbstractFile* m_pFile;
00206
00210  void Defaults();
00211 };
00212
00213
00219 class ZIP_API CZipArchive
00220 {
00221
00222 public:
00227  struct ZIP_API CZipInternalInfo
00228  {
00229
00230   CZipInternalInfo()
00231   {
00232    m_iBufferSize = 65536;
00233   }
00234   virtual ~CZipInternalInfo(){}
00235
00239   void Init()
00240   {
00241    m_pBuffer.Allocate(m_iBufferSize);
00242   }
00243   void ReleaseBuf()
00244   {
00245    m_pBuffer.Release();
00246   }
00247   z_stream m_stream;
00248   DWORD m_uUncomprLeft;
00249   DWORD m_uComprLeft;
00250   DWORD m_uCrc32;
00251
00259   DWORD m_iBufferSize;
00260
00264   CZipAutoBuffer m_pBuffer;
00265  };
00266
00267  CZipArchive();
00268  virtual ~CZipArchive();
00269
00279  static int SingleToWide(const CZipAutoBuffer &szSingle, CZipString& szWide);
00280
00290  static int WideToSingle(LPCTSTR lpWide, CZipAutoBuffer &szSingle);
00291
00292
00302  bool SetPassword(LPCTSTR lpszPassword = NULL);
00303
00307  CZipString GetPassword()const ;
00308
00325  void SetAdvanced(int iWriteBuffer = 65536, int iGeneralBuffer = 65536, int iSearchBuffer = 32768);
00326
00330  void GetAdvanced(int* piWriteBuffer = NULL, int* piGeneralBuffer = NULL, int* piSearchBuffer= NULL)
00331  {
00332   if (piWriteBuffer)
00333    *piWriteBuffer =  m_storage.m_iWriteBufferSize;
00334   if (piGeneralBuffer)
00335    *piGeneralBuffer = m_info.m_iBufferSize;
00336   if (piSearchBuffer)
00337    *piSearchBuffer = m_centralDir.m_iBufferSize;
00338  }
00339
00345  enum CallbackType
00346  {
00347   cbNothing = 0x0000,
00348   cbAdd  = 0x0001,
00349   cbAddTmp = 0x0002,
00350
00351   cbAddStore = 0x0004,
00352
00353
00354   cbExtract = 0x0008,
00355
00356   cbDeleteCnt = 0x0010,
00357   cbDelete = 0x0020,
00358
00359   cbTest  = 0x0040,
00360   cbSave  = 0x0080,
00361
00362   cbGetFromArchive
00363      = 0x0100,
00364   cbRename = 0x0200,
00365   cbReplace = 0x0400,
00366   cbNextValue = 0x0800,
00367
00368
00369   cbSubActions= cbAddTmp | cbAddStore | cbDeleteCnt | cbReplace,
00370   cbActions = cbAdd | cbExtract | cbDelete | cbTest | cbSave | cbGetFromArchive | cbRename,
00371   cbAll  = cbActions | cbSubActions
00372  };
00373
00374
00390  void SetCallback(CZipActionCallback* pCallback = NULL, int iWhich = cbAll);
00391
00395  CZipActionCallback* GetCallback(CallbackType iWhich)
00396  {
00397   return m_callbacks.Get(iWhich);
00398  }
00399
00416  void SetSpanCallback(CZipSpanCallback* pCallback = NULL){m_storage.m_pChangeDiskFunc = pCallback;}
00417
00418
00419
00424  enum OpenMode
00425  {
00426   zipOpen,
00427
00434   zipOpenReadOnly,
00435   zipCreate,
00436   zipCreateSpan
00437  };
00438
00439
00440
00472  void Open(LPCTSTR szPathName, int iMode = zipOpen, int iVolumeSize = 0);
00473
00474
00488  void Open(CZipMemFile& mf, int iMode = zipOpen);
00489
00508  void SetRootPath(LPCTSTR szPath = NULL);
00509
00510
00515  CZipString GetRootPath()const
00516  {
00517   return m_szRootPath;
00518  }
00519
00529  enum Smartness
00530  {
00531   zipsmLazy   = 0x0000,
00532   zipsmCPassDir  = 0x0001,
00533   zipsmCPFile0  = 0x0002,
00534   zipsmNotCompSmall = 0x0004,
00535   zipsmCheckForEff = 0x0008,
00536
00537
00538
00539
00540
00541
00542   zipsmMemoryFlag  = 0x0010,
00543
00544   zipsmCheckForEffInMem = zipsmMemoryFlag | zipsmCheckForEff,
00545
00546   zipsmSmartPass = zipsmCPassDir | zipsmCPFile0,
00547   zipsmSmartAdd = zipsmNotCompSmall | zipsmCheckForEff,
00548   zipsmSafeSmart = zipsmSmartPass | zipsmNotCompSmall,
00549   zipsmSmartest = zipsmSmartPass | zipsmSmartAdd,
00550
00551
00552   zipsmInternal01  = 0xf000
00553
00554  };
00555
00556
00573  bool AddNewFile(CZipAddNewFileInfo& info);
00574
00575
00580  bool AddNewFile(LPCTSTR lpszFilePath, int iComprLevel = -1, bool bFullPath = true,
00581   int iSmartLevel = zipsmSafeSmart, unsigned long nBufSize = 65536);
00582
00583
00587  bool AddNewFile(LPCTSTR lpszFilePath,
00588         LPCTSTR lpszFileNameInZip,
00589                              int iComprLevel = -1,
00590         int iSmartLevel = zipsmSafeSmart,
00591                              unsigned long nBufSize = 65536);
00592
00596  bool AddNewFile(CZipMemFile& mf,
00597         LPCTSTR lpszFileNameInZip,
00598                              int iComprLevel = -1,
00599         int iSmartLevel = zipsmSafeSmart,
00600                              unsigned long nBufSize = 65536);
00601
00602
00603
00655  bool OpenNewFile(CZipFileHeader & header, int iLevel = Z_DEFAULT_COMPRESSION, LPCTSTR lpszFilePath = NULL, DWORD uInternal = 0);
00656
00667  bool WriteNewFile(const void *pBuf, DWORD iSize);
00668
00669
00681  void SetExtraField(const char *pBuf, WORD iSize);
00682
00693  bool CloseNewFile(bool bAfterException = false);
00694
00722  bool GetFromArchive(CZipArchive& zip, WORD uIndex, int iReplaceIndex = -1, bool bKeepSystComp = false)
00723  {
00724
00725   m_info.Init();
00726   bool bRet;
00727   try
00728   {
00729    bRet = GetFromArchive(zip, uIndex, iReplaceIndex, bKeepSystComp, GetCallback(cbGetFromArchive));
00730   }
00731   catch(...)
00732   {
00733    m_info.ReleaseBuf();
00734    throw;
00735   }
00736   m_info.ReleaseBuf();
00737   if (bRet && m_bAutoFlush)
00738    Flush();
00739
00740   return bRet;
00741  }
00742
00754  bool GetFromArchive(CZipArchive& zip, CZipWordArray &aIndexes, bool bKeepSystComp = false);
00755
00770  bool GetFromArchive(CZipArchive& zip, CZipStringArray &aNames, bool bKeepSystComp = false)
00771  {
00772   CZipWordArray indexes;
00773   zip.GetIndexes(aNames, indexes);
00774   return GetFromArchive(zip, indexes, bKeepSystComp);
00775
00776  }
00777
00789  void GetIndexes(const CZipStringArray &aNames, CZipWordArray& aIndexes);
00790
00828  bool ExtractFile(WORD uIndex, LPCTSTR lpszPath, bool bFullPath = true,
00829   LPCTSTR lpszNewName = NULL, DWORD nBufSize = 65536);
00830
00831
00846  bool ExtractFile(WORD uIndex, CZipMemFile& mf, bool bRewind = true, DWORD nBufSize = 65536);
00847
00859  bool OpenFile(WORD uIndex);
00860
00871  DWORD ReadFile(void *pBuf, DWORD iSize);
00872
00873
00889  bool TestFile(WORD uIndex, DWORD uBufSize = 65536);
00890
00899  void CloseFileWithNoUpdate();
00900
00911  int GetLocalExtraField(char* pBuf, int iSize)const ;
00912
00922  int CloseFile(CZipFile &file);
00923
00924
00941  int CloseFile(LPCTSTR lpszFilePath = NULL, bool bAfterException = false);
00942
00956  void DeleteFile(WORD uIndex);
00957
00972  void DeleteFiles(CZipWordArray &aIndexes);
00973
00974
00989  void DeleteFiles(const CZipStringArray &aNames);
00990
00991
00999  bool SetGlobalComment(LPCTSTR lpszComment);
01000
01001
01005  CZipString GetGlobalComment()const ;
01006
01007
01017  bool SetFileComment(WORD uIndex, LPCTSTR lpszComment);
01018
01022  CZipString GetArchivePath()const;
01023
01032  int GetCurrentDisk()const ;
01033
01047  int GetSpanMode()const
01048  {
01049   return m_storage.m_iSpanMode * m_storage.IsSpanMode();
01050  }
01051
01055  enum FFCaseSens
01056  {
01057   ffDefault,
01058
01059
01060
01061   ffCaseSens,
01062
01063
01064
01065   ffNoCaseSens
01066
01067
01068
01069
01070  };
01071
01095  int FindFile(LPCTSTR lpszFileName, int iCaseSensitive = ffDefault, bool bFileNameOnly = false);
01096
01105  bool GetFileInfo(CZipFileHeader & fhInfo, WORD uIndex) const;
01106
01107
01114  int GetCount(bool bOnlyFiles = false)const
01115  {
01116   int iTotalCount = m_centralDir.m_headers.GetSize();
01117   if (bOnlyFiles)
01118   {
01119    int iCount = 0;
01120    for (int i = 0; i < iTotalCount; i++)
01121     if (!m_centralDir.m_headers[i]->IsDirectory())
01122      iCount++;
01123    return iCount;
01124   }
01125   else
01126    return iTotalCount;
01127  }
01128
01132  enum CloseAfterException
01133  {
01134   afNoException,
01135   afAfterException,
01136   afWriteDir
01137
01138  };
01139
01150  void Close(int iAfterException = afNoException, bool bUpdateTimeStamp = false);
01151
01152
01161  bool IsClosed(bool bArchive = true)const ;
01162
01183  void Flush();
01184
01185
01197  void SetAutoFlush(bool bAutoFlush = true);
01198
01199
01205  bool GetAutoFlush()const {return m_bAutoFlush;}
01206
01227  int GetSystemCompatibility() const {return m_iArchiveSystCompatib;}
01228
01241  bool SetSystemCompatibility(int iSystemComp);
01242
01257  void SetFileHeaderAttr(CZipFileHeader& header, DWORD uAttr);
01258
01259
01266  static const DWORD* GetCRCTable()
01267  {
01268    return get_crc_table();
01269  }
01270
01277  CZipStorage* GetStorage(){return &m_storage;}
01278
01279
01287  void SetDetectZlibMemoryLeaks(bool bDetect)
01288  {
01289   if (m_iFileOpened != nothing)
01290   {
01291    TRACE(_T("CZipArchive::SetDetectZlibMemoryLeaks: Set it before opening a file in the archive"));
01292    return;
01293   }
01294   m_bDetectZlibMemoryLeaks = bDetect;
01295
01296  }
01297
01311  void SetConvertAfterOpen (bool bConvertAfterOpen)
01312  {
01313   if (!IsClosed())
01314   {
01315    TRACE(_T("CZipArchive::SetConvertAfterOpen: Set it before opening the archive"));
01316    return;
01317   }
01318   m_centralDir.m_bConvertAfterOpen = bConvertAfterOpen;
01319
01320  }
01321
01332  void EnableFindFast(bool bEnable = true);
01333
01334
01353  int GetFindFastIndex(int iFindFastIndex) const
01354  {
01355   if (IsClosed())
01356   {
01357    TRACE(_T("CZipArchive::GetFindFastIndex: ZipArchive not yet opened.\n"));
01358    return -1;
01359   }
01360
01361   return m_centralDir.GetFindFastIndex(iFindFastIndex);
01362  }
01363
01364
01378  void SetTempPath(LPCTSTR lpszPath = NULL, bool bForce = true);
01379
01380
01381
01385  enum Predict
01386  {
01387
01388   prDir,
01389   prFile,
01390   prAuto
01391
01392  };
01393
01413  CZipString PredictFileNameInZip(LPCTSTR lpszFilePath, bool bFullPath, int iWhat = prAuto, bool bExactly = false)const ;
01414
01426  int WillBeDuplicated(LPCTSTR lpszFilePath, bool bFullPath, bool bFileNameOnly = false, int iWhat = prAuto);
01427
01428
01439  CZipString PredictExtractedFileName(LPCTSTR lpszFileNameInZip, LPCTSTR lpszPath, bool bFullPath, LPCTSTR lpszNewName = NULL)const ;
01440
01447  CZipString GetTempPath()const
01448  {
01449   return m_szTempPath;
01450  }
01451
01458  CZipString TrimRootPath(CZipPathComponent& zpc)const ;
01459
01471  static bool RemovePathBeginning(LPCTSTR lpszBeginning, CZipString& szPath, ZIPSTRINGCOMPARE pCompareFunction);
01472
01492  void SetCaseSensitivity(bool bCaseSensitive)
01493  {
01494   m_bCaseSensitive = bCaseSensitive;
01495   m_pZipCompare = GetCZipStrCompFunc(bCaseSensitive);
01496  }
01497
01502  void GetCentralDirInfo(CZipCentralDir::Info& info)const;
01503
01504
01510  DWORD GetCentralDirSize(bool bWhole = true) const
01511  {
01512   return m_centralDir.GetSize(bWhole);
01513  }
01514
01519  bool IsReadOnly(){return m_storage.IsReadOnly();}
01520
01521
01529  void SetIgnoreCRC(bool bIgnore = true){m_bIgnoreCRC = bIgnore;}
01530
01536  class ZIP_API CWildcard
01537  {
01538  public:
01539
01540
01541   enum Match
01542   {
01543    matchNone,
01544    matchValid,
01545    matchEnd,
01546    matchAbort,
01547    matchRange,
01548    matchLiteral,
01549    matchPattern
01550   };
01551
01552   enum Pattern
01553   {
01554    patternEmpty = -4,
01555    patternClose,
01556    patternRange,
01557    patternEsc,
01558    patternValid,
01559   };
01560
01561
01573   bool IsMatch(LPCTSTR lpszText, int* iRetCode = NULL);
01574
01582   static bool IsPattern(LPCTSTR lpszPattern);
01583
01594   static bool IsPatternValid(LPCTSTR lpszPattern, int* iErrorType = NULL);
01595
01608   static int Match(LPCTSTR lpszPattern, LPCTSTR lpszText);
01609
01610   CWildcard(){}
01615   CWildcard(LPCTSTR lpszPattern, bool bCaseSensitive)
01616   {
01617    SetPattern(lpszPattern, bCaseSensitive);
01618   }
01619   virtual ~CWildcard(){}
01620
01640   void SetPattern(LPCTSTR lpszPattern, bool bCaseSensitive)
01641   {
01642    m_szPattern = lpszPattern;
01643    m_bCaseSensitive=bCaseSensitive;
01644    if (!bCaseSensitive)
01645     m_szPattern.MakeLower();
01646   }
01647   operator LPCTSTR()
01648   {
01649    return (LPCTSTR)m_szPattern;
01650   }
01651  protected:
01652   bool m_bCaseSensitive;
01653   static int MatchAfterStar(LPCTSTR p , LPCTSTR t);
01654   CZipString m_szPattern;
01655  };
01656
01657
01674  void FindMatches(LPCTSTR lpszPattern, CZipWordArray& ar, bool bFullPath = true)const;
01675
01676
01689  bool RenameFile(WORD uIndex, LPCTSTR lpszNewName);
01690
01698  bool m_bRemoveDriveLetter;
01699
01700 protected:
01701
01707  void MakeSpaceForReplace(int iReplaceIndex, DWORD uTotal, LPCTSTR lpszFileName);
01712  struct ZIP_API CZipSmClrPass
01713  {
01714   void ClearPasswordSmartly(CZipArchive* pZip)
01715   {
01716    m_pZip = pZip;
01717    m_szPass = pZip->GetPassword();
01718    if (!m_szPass.IsEmpty())
01719     pZip->SetPassword();
01720   }
01721   ~CZipSmClrPass()
01722   {
01723    if (!m_szPass.IsEmpty())
01724     m_pZip->SetPassword(m_szPass);
01725   }
01726   CZipString m_szPass;
01727   CZipArchive* m_pZip;
01728  };
01729
01734  struct ZIP_API CZipDeleteInfo
01735  {
01736   CZipDeleteInfo(){m_pHeader = NULL; m_bDelete = false;}
01737   CZipDeleteInfo(CZipFileHeader* pHeader, bool bDelete)
01738    :m_pHeader(pHeader), m_bDelete (bDelete){}
01739   CZipFileHeader* m_pHeader;
01740   bool m_bDelete;
01741  };
01742
01743
01748  struct ZIP_API CZipClbckStrg : public CZipMap<CallbackType, CZipActionCallback*>
01749  {
01750   void Set(CZipActionCallback* pCallback, CallbackType iType)
01751   {
01752    if (pCallback)
01753    {
01754     SetAt(iType, pCallback);
01755    }
01756    else
01757     RemoveKey(iType);
01758   }
01759   CZipActionCallback* Get(CallbackType iType)
01760   {
01761    CZipActionCallback* pCallback = NULL;
01762    if (Lookup(iType, pCallback))
01763    {
01764     pCallback->m_iType = iType;
01765     return pCallback;
01766    }
01767    else
01768     return NULL;
01769   }
01770
01771  };
01772
01773
01777  CZipClbckStrg m_callbacks;
01778
01779
01783  void WriteCentralDirectory(bool bFlush = true);
01784
01789  bool m_bCaseSensitive;
01790
01797  ZIPSTRINGCOMPARE m_pZipCompare;
01798
01803  CZipInternalInfo m_info;
01804
01805
01810  CZipStorage m_storage;
01811
01816  CZipCentralDir m_centralDir;
01817
01821  enum OpenFileType
01822  {
01823   extract = -1,
01824   nothing,
01825   compress
01826  };
01827
01831  char m_iFileOpened;
01832
01839  bool m_bAutoFlush;
01840
01844  bool m_bIgnoreCRC;
01845
01846
01847
01854  CZipString m_szRootPath;
01855
01862  CZipString m_szTempPath;
01863
01871  void OpenInternal(int iMode);
01872
01881  int m_iArchiveSystCompatib;
01882
01887  void EmptyPtrList();
01888
01889
01890
01896  void MovePackedFiles(DWORD uStartOffset, DWORD uEndOffset, DWORD uMoveBy, CZipActionCallback* pCallback, bool bForward = false);
01897
01903  bool RemoveLast(bool bRemoveAnyway = false);
01904
01908  bool GetFromArchive(CZipArchive& zip, WORD uIndex, int iReplaceIndex, bool bKeepSystComp, CZipActionCallback* pCallback);
01909
01913  bool UpdateReplaceIndex(int& iReplaceIndex, LPCTSTR lpszNewFileName);
01914
01919  CZipFileHeader* CurrentFile();
01920
01927  void CheckForError(int iErr);
01928
01929
01939  void ThrowError(int err, bool bZlib = false);
01940
01941
01942  typedef CZipPtrList<void*>::iterator CZipPtrListIter;
01943  CZipPtrList<void*> m_list;
01944
01945
01946  static void* _zliballoc(void* opaque, UINT items, UINT size);
01947  static void _zlibfree(void* opaque, void* address);
01948
01949
01958  bool m_bDetectZlibMemoryLeaks;
01959
01960
01964  static const TCHAR m_gszCopyright[];
01965
01972
01979  void CryptDecodeBuffer(DWORD uCount);
01985  void CryptEncodeBuffer();
01986
01991  void CryptEncode(char &c);
02003  void CryptCryptHeader(long iCrc, CZipAutoBuffer& buf);
02008  DWORD CryptCRC32(DWORD l, char c);
02012  void CryptDecode(char &c);
02016  char CryptDecryptByte();
02017
02024  bool CryptCheck();
02028  void CryptUpdateKeys(char c);
02032  void CryptInitKeys();
02036  CZipAutoBuffer m_pszPassword;
02037
02043  DWORD m_keys[3];
02044
02046 };
02047
02048
02049
02050 #endif // !defined(AFX_ZIPARCHIVE_H__A7F528A6_1872_4071_BE66_D56CC2DDE0E6__INCLUDED_)
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipAutoBuffer.h Source File

ZipAutoBuffer.h

Go to the documentation of this file.
00001
00002 // $Workfile: ZipAutoBuffer.h $
00003 // $Archive: /ZipArchive/ZipAutoBuffer.h $
00004 // $Date: 21-01-04 19:01 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyright 2000-2004 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // For the licensing details see the file License.txt
00016
00023 #if !defined(AFX_ZIPAUTOBUFFER_H__DEC28C20_83FE_11D3_B7C3_EDEC47A8A86C__INCLUDED_)
00024 #define AFX_ZIPAUTOBUFFER_H__DEC28C20_83FE_11D3_B7C3_EDEC47A8A86C__INCLUDED_
00025
00026 #if _MSC_VER > 1000
00027 #pragma once
00028 #endif // _MSC_VER > 1000
00029
00030 #include "ZipExport.h"
00034 class ZIP_API CZipAutoBuffer
00035 {
00036 public:
00037  operator char*()
00038  {
00039   return m_pBuffer;
00040  }
00041 #ifndef __BORLANDC__
00042  operator const char*() const  // Borland seems to have problems with this
00043  {
00044   return m_pBuffer;
00045  }
00046 #endif
00047
00048
00049
00050
00051
00052  // may produce ambiguity on some compilers
00053 //   operator const char*() const
00054 //    {
00055 //      return m_pBuffer;
00056 //     }
00057  const char* GetBuffer() const {return m_pBuffer;}
00058  char* Allocate(DWORD iSize, bool bZeroMemory = false);
00059  void Release();
00060  DWORD GetSize() const
00061  {
00062   return m_iSize;
00063  }
00064  bool IsAllocated() const
00065  {
00066   return (m_pBuffer != NULL);
00067  }
00068  CZipAutoBuffer(DWORD iSize, bool bZeroMemory = false);
00069  CZipAutoBuffer();
00070  CZipAutoBuffer(const CZipAutoBuffer& buffer);
00071  virtual ~CZipAutoBuffer();
00072  CZipAutoBuffer& operator=(const CZipAutoBuffer& buffer);
00073 protected:
00074  char* m_pBuffer;
00075  DWORD m_iSize;
00076 };
00077
00078 #endif // !defined(AFX_ZIPAUTOBUFFER_H__DEC28C20_83FE_11D3_B7C3_EDEC47A8A86C__INCLUDED_)
00079
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipCentralDir.h Source File

ZipCentralDir.h

Go to the documentation of this file.
00001
00002 // $Workfile: ZipCentralDir.h $
00003 // $Archive: /ZipArchive/ZipCentralDir.h $
00004 // $Date: 04-03-06 19:25 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyright 2000-2004 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // For the licensing details see the file License.txt
00016
00023 #if !defined(AFX_CENTRALDIR_H__859029E8_8927_4717_9D4B_E26E5DA12BAE__INCLUDED_)
00024 #define AFX_CENTRALDIR_H__859029E8_8927_4717_9D4B_E26E5DA12BAE__INCLUDED_
00025
00026 #if _MSC_VER > 1000
00027 #pragma once
00028 #endif // _MSC_VER > 1000
00029
00030 #if (_MSC_VER > 1000) && (defined ZIP_HAS_DLL)
00031  #pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class
00032 #endif
00033
00034 #include "ZipException.h"
00035 #include "ZipFileHeader.h"
00036 #include "ZipAutoBuffer.h"
00037 #include "ZipCollections.h"
00038 #include "ZipCompatibility.h"
00039 #include "ZipExport.h"
00040 #define ZIPARCHIVE_DATADESCRIPTOR_LEN 12
00041
00045 class ZIP_API CZipCentralDir
00046 {
00047 public:
00056  struct ZIP_API CZipFindFast
00057  {
00058   CZipFindFast()
00059   {
00060    m_uIndex = 0;
00061    m_pHeader= NULL;
00062   }
00063   CZipFindFast(CZipFileHeader* pHeader, WORD uIndex):m_pHeader(pHeader), m_uIndex(uIndex){}
00067   CZipFileHeader* m_pHeader;
00068
00072   WORD m_uIndex;
00073  };
00074
00075
00079  struct ZIP_API Info
00080  {
00081   DWORD m_uCentrDirPos;
00082   DWORD m_uBytesBeforeZip;
00083   WORD m_uThisDisk;
00084   WORD m_uDiskWithCD;
00085   WORD m_uDiskEntriesNo;
00086   WORD m_uEntriesNumber;
00087   DWORD m_uSize;
00088   DWORD m_uOffset;
00089
00090
00091   bool m_bOnDisk;
00092
00093  protected:
00094   friend class CZipCentralDir;
00095   bool CheckIfOK_1()
00096   {
00097    return ((DWORD)m_uCentrDirPos >= m_uOffset + m_uSize);
00098   }
00099   void SetBytesBeforeZip(bool bIsSpan)
00100   {
00101    m_uBytesBeforeZip = bIsSpan ? 0 : m_uCentrDirPos - m_uSize - m_uOffset;
00102   }
00103   bool CheckIfOK_2()
00104   {
00105    return (m_uSize || !m_uEntriesNumber) && (m_uEntriesNumber || !m_uSize);
00106   }
00107   void DiskChange(int iCurrentDisk)
00108   {
00109    m_uThisDisk = (WORD)iCurrentDisk;
00110    if (m_uEntriesNumber)
00111    {
00112     m_uDiskEntriesNo = 0;
00113    }
00114    else
00115    {
00116     m_uDiskWithCD = m_uThisDisk;
00117     m_uOffset = 0;
00118    }
00119   }
00120  };
00121
00122  CZipCentralDir();
00123  virtual ~CZipCentralDir();
00124
00125  static char m_gszSignature[];
00126
00127  char m_szSignature[4];
00128
00129  CZipAutoBuffer m_pszComment;
00130  CZipAutoBuffer m_pLocalExtraField;
00131  CZipFileHeader* m_pOpenedFile;
00132
00136  void Init();
00137
00142  void Read();
00143
00150  void OpenFile(WORD uIndex);
00151
00158  bool IsValidIndex(int uIndex)const;
00159
00168  void RemoveFile(CZipFileHeader* pHeader, int iIndex = -1, bool bShift = true);
00169
00170
00175  void RemoveLastFile(CZipFileHeader* pHeader = NULL, int iIndex = -1)
00176  {
00177   if (iIndex == -1)
00178   {
00179    iIndex = m_headers.GetSize() - 1;
00180    if (iIndex == -1)
00181     return;
00182   }
00183   if (!pHeader)
00184    pHeader = m_headers[iIndex];
00185   DWORD uNewSize = pHeader->m_uOffset + GetBytesBefore();
00186   // then remove
00187   RemoveFile(pHeader, iIndex);
00188
00189   m_pStorage->Flush();
00190   m_pStorage->m_pFile->SetLength(uNewSize);
00191   m_info.m_bOnDisk = false; // it is true when AutoFlush is set to true
00192  }
00193
00194
00199  void RemoveAll();
00209  void Clear(bool bEverything = true);
00210
00219  CZipFileHeader* AddNewFile(const CZipFileHeader & header, int iReplaceIndex = -1);
00220
00224  CZipString GetProperHeaderFileName(const CZipFileHeader* pHeader) const
00225  {
00226   if (!m_bConvertAfterOpen)
00227   {
00228    CZipFileHeader fh = *pHeader;
00229    ConvertFileName(true, false, &fh);
00230    return fh.GetFileName();
00231   }
00232   else
00233    return pHeader->GetFileName();
00234  }
00235
00241  void RemoveFromDisk();
00242
00250  DWORD GetSize(bool bWhole = false) const;
00251
00257  void CloseFile(bool bAfterException = false);
00258
00263  void CloseNewFile();
00264
00269  void Write(CZipActionCallback* pCallback);
00270
00274  void EnableFindFast(bool bEnable, bool bCaseSensitive);
00275
00280  int FindFile(LPCTSTR lpszFileName, bool bCaseSensitive, bool bSporadically, bool bFileNameOnly);
00281
00282
00286  int GetFindFastIndex(int iFindFastIndex)const
00287  {
00288   if (!IsValidIndex(iFindFastIndex) || !m_bFindFastEnabled)
00289   {
00290  //   ASSERT(FALSE); //
00291    return -1;
00292   }
00293
00294   return m_findarray[iFindFastIndex].m_uIndex;
00295  }
00296
00300  CZipStorage* m_pStorage;
00301
00302
00310  int m_iBufferSize;
00311
00312
00313
00314
00319  CZipArray<CZipFileHeader*> m_headers;
00320
00321  CZipFileHeader* operator[](int iIndex)
00322  {
00323   return m_headers[iIndex];
00324  }
00325  const CZipFileHeader* operator[](int iIndex) const
00326  {
00327   return m_headers[iIndex];
00328  }
00329
00330
00348  bool m_bConvertAfterOpen;
00349
00350
00365  void ConvertFileName(bool bFromZip, bool bAfterOpen, CZipFileHeader* pHeader = NULL) const
00366  {
00367   if (bAfterOpen != m_bConvertAfterOpen)
00368    return;
00369   if (!pHeader)
00370   {
00371    pHeader = m_pOpenedFile;
00372    ASSERT(pHeader);
00373   }
00374   ZipCompatibility::FileNameUpdate(*pHeader, bFromZip);
00375  }
00376
00382  void ConvertAll();
00383
00392  int FindFileNameIndex(LPCTSTR lpszFileName) const;
00393
00394  DWORD GetBytesBefore() const {return m_info.m_uBytesBeforeZip;}
00398  void GetInfo(Info& info) const {info = m_info;}
00402  bool IsFindFastEnabled(){return m_bFindFastEnabled;}
00406  void RenameFile(WORD uIndex, LPCTSTR lpszNewName);
00407 protected:
00411  void SortHeaders();
00412  static int CompareHeaders(const void *pArg1, const void *pArg2)
00413  {
00414   CZipFileHeader* pw1 = *(CZipFileHeader**)pArg1;
00415   CZipFileHeader* pw2 = *(CZipFileHeader**)pArg2;
00416   if ((pw1->m_uOffset < pw2->m_uOffset && pw1->m_uDiskStart == pw2->m_uDiskStart)
00417    || (pw1->m_uDiskStart < pw2->m_uDiskStart))
00418    return -1;
00419   else if ((pw1->m_uOffset > pw2->m_uOffset && pw1->m_uDiskStart == pw2->m_uDiskStart)
00420    || (pw1->m_uDiskStart > pw2->m_uDiskStart))
00421    return 1;
00422   else
00423   {
00424    ASSERT(FALSE);
00425    // two files with the same offsets on the same disk???
00426    CZipException::Throw(CZipException::badZipFile);
00427    return 0; // just for the compiler comfort
00428   }
00429  }
00430
00431
00435  void BuildFindFastArray( bool bCaseSensitive );
00436
00443  CZipArray<CZipFindFast> m_findarray;
00444
00455  bool m_bFindFastEnabled;
00456
00457
00458
00472  int CompareElement(LPCTSTR lpszFileName, WORD uIndex) const
00473  {
00474   return (m_findarray[uIndex].m_pHeader->GetFileName().*m_pCompare)(lpszFileName);
00475  }
00480  void InsertFindFastElement(CZipFileHeader* pHeader, WORD uIndex);
00481
00482
00483
00490  ZIPSTRINGCOMPARE m_pCompare;
00491
00495  bool m_bCaseSensitive;
00496
00500  Info m_info;
00501
00506  DWORD Locate();
00511  void ReadHeaders();
00512
00516  void RemoveHeaders();
00528  bool RemoveDataDescr(bool bFromBuffer);
00533  void WriteHeaders(CZipActionCallback* pCallback, bool bOneDisk);
00539  DWORD WriteCentralEnd();
00540
00546  void ThrowError(int err) const;
00547
00548
00549 };
00550
00551
00552 #endif // !defined(AFX_CENTRALDIR_H__859029E8_8927_4717_9D4B_E26E5DA12BAE__INCLUDED_)
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipCompatibility.h Source File

ZipCompatibility.h

Go to the documentation of this file.
00001
00002 // $Workfile: ZipCompatibility.h $
00003 // $Archive: /ZipArchive/ZipCompatibility.h $
00004 // $Date: 21-01-04 19:01 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyright 2000-2004 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // For the licensing details see the file License.txt
00016
00017
00024 #if !defined(AFX_ZIPCOMPATIBILITY_H__8E8B9904_84C7_4B22_B364_A10ED0E7DAD6__INCLUDED_)
00025 #define AFX_ZIPCOMPATIBILITY_H__8E8B9904_84C7_4B22_B364_A10ED0E7DAD6__INCLUDED_
00026
00027 #if _MSC_VER > 1000
00028 #pragma once
00029 #endif // _MSC_VER > 1000
00030
00031 class CZipAutoBuffer;
00032 class CZipFileHeader;
00033
00038 namespace ZipCompatibility
00039 {
00046  enum ZipPlatforms
00047  {
00048       zcDosFat,
00049                zcAmiga,
00050                zcVaxVms,
00051                zcUnix,
00052                zcVmCms,
00053                zcAtari,
00054                zcOs2Hpfs,
00055                zcMacintosh,
00056                zcZsystem,
00057                zcCpm,
00058                zcNtfs
00059  };
00060
00067  bool IsPlatformSupported(int iCode);
00068
00069
00083  DWORD ConvertToSystem(DWORD uAttr, int iFromSystem, int iToSystem);
00084  void FileNameUpdate(CZipFileHeader& header, bool bFromZip);
00096
00103  void SlashBackslashChg(CZipAutoBuffer& buffer, bool bReplaceSlash);
00104
00105 };
00106
00107 #endif // !defined(AFX_ZIPCOMPATIBILITY_H__8E8B9904_84C7_4B22_B364_A10ED0E7DAD6__INCLUDED_)
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipException.h Source File

ZipException.h

Go to the documentation of this file.
00001
00002 // $Workfile: ZipException.h $
00003 // $Archive: /ZipArchive/ZipException.h $
00004 // $Date: 21-01-04 19:01 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyright 2000-2004 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // For the licensing details see the file License.txt
00016
00024 #if !defined(AFX_ZIPEXCEPTION_H__E3546921_D728_11D3_B7C7_E77339672847__INCLUDED_)
00025 #define AFX_ZIPEXCEPTION_H__E3546921_D728_11D3_B7C7_E77339672847__INCLUDED_
00026
00027 #if _MSC_VER > 1000
00028 #pragma once
00029 #pragma warning( push )
00030 #pragma warning (disable:4702) // disable "Unreachable code" warning in Throw function in the Release mode
00031 #endif // _MSC_VER > 1000
00032
00033
00034 #include "ZipString.h"
00035 #include "ZipBaseException.h"
00036 #include "ZipExport.h"
00037
00038 #define ZIP_ENABLE_ERROR_DESCRIPTION
00039
00045 class ZIP_API CZipException : public CZipBaseException
00046 {
00047 public:
00048
00055   CZipException(int iCause = generic, LPCTSTR lpszZipName = NULL);
00056
00057   CZipException::CZipException(CZipException& e)
00058   {
00059    m_szFileName = e.m_szFileName;
00060    m_iCause = e.m_iCause;
00061   }
00062
00078  static void Throw(int iZipError = CZipException::generic, LPCTSTR lpszZipName = NULL)
00079  {
00080   #ifdef _MFC_VER
00081    throw new CZipException(iZipError, lpszZipName);
00082   #else
00083    CZipException e(iZipError, lpszZipName);
00084    throw e;
00085   #endif
00086  }
00087
00088
00096  static int ZlibErrToZip(int iZlibError);
00097
00098
00099 #ifdef ZIP_ENABLE_ERROR_DESCRIPTION
00100
00109  CZipString GetErrorDescription();
00110
00111
00135  BOOL GetErrorMessage(LPTSTR lpszError, UINT nMaxError, UINT* = NULL);
00136
00137 #endif //ZIP_ENABLE_ERROR_DESCRIPTION
00138
00142  CZipString m_szFileName;
00143
00147  enum ZipErrors
00148  {
00149   noError,
00150 //     1 - 42 reserved for errno (from STL) values - used only in non-MFC versions
00151 //     43 - 99 reserved
00152   generic  = 100,
00153   badZipFile,
00154   badCrc,
00155   noCallback,
00156   aborted,
00157   abortedAction,
00158   abortedSafely,
00159   nonRemovable,
00160   tooManyVolumes,
00161   tooLongFileName,
00162   badPassword,
00163   dirWithSize,
00164   internal,
00165   notRemoved,
00166   notRenamed,
00167   platfNotSupp,
00168   cdirNotFound,
00169   streamEnd = 500,
00170   needDict,
00171   errNo,
00172   streamError,
00173   dataError,
00174   memError,
00175   bufError,
00176   versionError,
00177  };
00178
00179
00180
00184  int m_iCause;
00185
00186
00187  virtual ~CZipException() throw();
00188 protected:
00189
00190 #ifdef ZIP_ENABLE_ERROR_DESCRIPTION
00191
00192
00202  CZipString GetInternalErrorDescription(int iCause, bool bNoLoop = false);
00203
00204
00211  CZipString GetSystemErrorDescription();
00212
00213
00214 #endif //ZIP_ENABLE_ERROR_DESCRIPTION
00215
00216 #ifdef _MFC_VER
00217  DECLARE_DYNAMIC(CZipException)
00218  #pragma warning( pop )
00219 #endif
00220 };
00221
00222
00223 #endif // !defined(AFX_ZIPEXCEPTION_H__E3546921_D728_11D3_B7C7_E77339672847__INCLUDED_)
00224
00225
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipFileHeader.h Source File

ZipFileHeader.h

Go to the documentation of this file.
00001
00002 // $Workfile: ZipFileHeader.h $
00003 // $Archive: /ZipArchive/ZipFileHeader.h $
00004 // $Date: 21-01-04 19:01 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyright 2000-2004 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // For the licensing details see the file License.txt
00016
00023 #if !defined(AFX_FILEHEADER_H__0081FC65_C9C9_4D48_AF72_DBF37DF5E0CF__INCLUDED_)
00024 #define AFX_FILEHEADER_H__0081FC65_C9C9_4D48_AF72_DBF37DF5E0CF__INCLUDED_
00025
00026 #if _MSC_VER > 1000
00027 #pragma once
00028 #endif // _MSC_VER > 1000
00029
00030 #include "ZipExport.h"
00031 #include "ZipStorage.h"
00032 #include "ZipAutoBuffer.h"
00033 #include "sys/types.h"
00034 #include "ZipCompatibility.h"
00035 #define ZIPARCHIVE_ENCR_HEADER_LEN 12
00036
00045 class ZIP_API CZipFileHeader
00046 {
00047  friend class CZipCentralDir;
00048  friend class CZipArchive;
00049  friend void ZipCompatibility::FileNameUpdate(CZipFileHeader&, bool);
00050 public:
00051  CZipFileHeader();
00052  virtual ~CZipFileHeader();
00053
00054
00055 //
00065  WORD GetFileNameSize()const {return (WORD)m_pszFileName.GetSize();}
00066
00070  WORD GetCommentSize() const {return (WORD)m_pszComment.GetSize();}
00071
00075  WORD GetExtraFieldSize()const{return (WORD)m_pExtraField.GetSize();}
00076
00080  CZipString GetFileName()const;
00081
00090  bool SetFileName(LPCTSTR lpszFileName);
00091
00095  CZipString GetComment() const;
00096
00106  bool SetComment(LPCTSTR lpszComment);
00107
00111  bool IsDataDescr()const { return (m_uFlag & (WORD) 8) != 0;}
00112
00113
00118  DWORD GetEffComprSize()
00119  {
00120   return m_uComprSize - (IsEncrypted() ? ZIPARCHIVE_ENCR_HEADER_LEN : 0);
00121  }
00126  bool CompressionEfficient()
00127  {
00128   DWORD uBefore = m_uUncomprSize;
00129   // ignore the length of encryption header
00130   DWORD uAfter = GetEffComprSize();
00131   return  uAfter <= uBefore;
00132  }
00133
00137  float GetCompressionRatio()
00138  {
00139   return m_uUncomprSize ? ((float)m_uComprSize) * 100 / m_uUncomprSize : 0;
00140  }
00141
00146  bool IsEncrypted()const { return (m_uFlag & (WORD) 1) != 0;}
00147
00148  char m_szSignature[4];
00149  WORD m_uVersionMadeBy;
00150  WORD m_uVersionNeeded;
00151  WORD m_uFlag;
00152  WORD m_uMethod;
00153  WORD m_uModTime;
00154  WORD m_uModDate;
00155  DWORD m_uCrc32;
00156  DWORD m_uComprSize;
00157  DWORD m_uUncomprSize;
00158 //         filename length                 2 bytes
00159 //  WORD m_uFileNameSize;
00160 //         extra field length              2 bytes
00161 //  WORD m_uExtraFieldSize;
00162 //         file comment length             2 bytes
00163 //  WORD m_uCommentSize;
00164  WORD m_uDiskStart;
00165  WORD m_uInternalAttr;
00166 protected:
00167  DWORD m_uExternalAttr;
00168 public:
00169  DWORD m_uOffset;
00170  CZipAutoBuffer m_pExtraField;
00171  static char m_gszSignature[];
00172  static char m_gszLocalSignature[];
00173
00174
00181  void SetTime(const time_t& ttime);
00182
00187  time_t GetTime()const;
00188
00194  DWORD GetSize(bool bLocal = false)const;
00195
00207  int GetSystemCompatibility()const
00208  {
00209   return (m_uVersionMadeBy & 0xFF00) >> 8;
00210  }
00211
00220  DWORD GetSystemAttr()const;
00221
00226  DWORD GetOriginalAttributes() const {return m_uExternalAttr;}
00227
00233  bool IsDirectory()const;
00234
00235
00236 protected:
00237
00244  void SetSystemCompatibility(int iSystemID)
00245  {
00246   m_uVersionMadeBy &= 0x00FF;
00247   m_uVersionMadeBy |= (WORD)(iSystemID << 8);
00248  }
00249
00261  void SetSystemAttr(DWORD uAttr);
00262
00267  void SetVersion(WORD uVersion)
00268  {
00269   if ((m_uVersionMadeBy & 0x00FF) != (uVersion & 0x00FF))
00270   {
00271    m_uVersionMadeBy &= 0xFF00;
00272    m_uVersionMadeBy |= (WORD)(uVersion & 0x00FF);
00273   }
00274  }
00275
00279  CZipAutoBuffer m_pszFileName;
00280
00284  CZipAutoBuffer m_pszComment;
00285
00292  void GetCrcAndSizes(char* pBuffer)const;
00293
00302  bool CheckCrcAndSizes(char* pBuf) const;
00303
00304
00317  bool PrepareData(int iLevel, bool bSpan, bool bEncrypted);
00323  void WriteLocal(CZipStorage& storage);
00324
00332  bool Read(CZipStorage *pStorage);
00341  bool ReadLocal(CZipStorage *pStorage, WORD& iLocExtrFieldSize);
00348  DWORD Write(CZipStorage *pStorage);
00349
00350 };
00351
00352 #endif // !defined(AFX_FILEHEADER_H__0081FC65_C9C9_4D48_AF72_DBF37DF5E0CF__INCLUDED_)
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipMemFile.h Source File

ZipMemFile.h

Go to the documentation of this file.
00001
00002 // $Workfile: ZipMemFile.h $
00003 // $Archive: /ZipArchive/ZipMemFile.h $
00004 // $Date: 21-01-04 19:01 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyright 2000-2004 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // For the licensing details see the file License.txt
00016
00022 #if !defined(AFX_ZIPMEMFILE_H__EA73AB25_6B51_4C5E_8D78_BAC95812598F__INCLUDED_)
00023 #define AFX_ZIPMEMFILE_H__EA73AB25_6B51_4C5E_8D78_BAC95812598F__INCLUDED_
00024
00025 #if _MSC_VER > 1000
00026 #pragma once
00027 #endif // _MSC_VER > 1000
00028 #include "ZipAbstractFile.h"
00029 #include "ZipString.h"
00030 #include "ZipExport.h"
00031
00036 class ZIP_API CZipMemFile : public CZipAbstractFile
00037 {
00038 protected:
00039  size_t m_nGrowBy, m_nPos;
00040  size_t m_nBufSize, m_nDataSize;
00041  BYTE* m_lpBuf;
00042  bool m_bAutoDelete;
00043  void Free()
00044  {
00045   if (m_lpBuf)
00046   {
00047    free(m_lpBuf);
00048    m_lpBuf = NULL;
00049   }
00050  }
00051  void Init()
00052  {
00053   m_nGrowBy = m_nPos = 0;
00054   m_nBufSize = m_nDataSize = 0;
00055   m_lpBuf = NULL;
00056
00057  }
00058  void Grow(size_t nBytes);
00059 public:
00060  bool IsClosed() const { return m_lpBuf == NULL;}
00061  void Flush(){}
00062
00063  ZIP_ULONGLONG Seek(ZIP_LONGLONG lOff, int nFrom);
00064  ZIP_ULONGLONG GetLength() const {return m_nDataSize;}
00065  void Write(const void* lpBuf, UINT nCount);
00066  UINT Read(void* lpBuf, UINT nCount);
00067  void SetLength(ZIP_ULONGLONG nNewLen);
00068  CZipString GetFilePath() const  {return _T("");}
00069  CZipMemFile(long nGrowBy = 1024)
00070  {
00071   Init();
00072   m_nGrowBy = nGrowBy;
00073   m_bAutoDelete = true;
00074  }
00075
00076  CZipMemFile(BYTE* lpBuf, UINT nBufSize, long nGrowBy = 0)
00077  {
00078   Init();
00079   Attach(lpBuf, nBufSize, nGrowBy);
00080  }
00081  ZIP_ULONGLONG GetPosition() const { return m_nPos;}
00082  void Attach(BYTE* lpBuf, UINT nBufSize, long nGrowBy = 0)
00083  {
00084   Close();
00085   m_lpBuf = lpBuf;
00086   m_nGrowBy = nGrowBy;
00087   m_nBufSize = nBufSize;
00088   m_nDataSize = nGrowBy == 0 ? nBufSize : 0;
00089   m_bAutoDelete = false;
00090  }
00091  BYTE* Detach()
00092  {
00093   BYTE* b = m_lpBuf;
00094   Init();
00095   return b;
00096  }
00097  void Close()
00098  {
00099   if (m_bAutoDelete)
00100    Free();
00101   Init();
00102  }
00103  virtual ~CZipMemFile(){Close();}
00104
00105 };
00106
00107 #endif // !defined(AFX_ZIPMEMFILE_H__EA73AB25_6B51_4C5E_8D78_BAC95812598F__INCLUDED_)
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipPathComponent.h Source File

ZipPathComponent.h

Go to the documentation of this file.
00001
00002 // $Workfile: ZipPathComponent.h $
00003 // $Archive: /ZipArchive/ZipPathComponent.h $
00004 // $Date: 21-01-04 19:01 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyright 2000-2004 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // For the licensing details see the file License.txt
00016
00022 #if !defined(AFX_ZIPPATHCOMPONENT_H__9B222C08_AD11_4138_96CC_1237511E3E37__INCLUDED_)
00023 #define AFX_ZIPPATHCOMPONENT_H__9B222C08_AD11_4138_96CC_1237511E3E37__INCLUDED_
00024
00025 #if _MSC_VER > 1000
00026 #pragma once
00027 #endif // _MSC_VER > 1000
00028 #include "ZipString.h"
00029 #include "ZipExport.h"
00030
00034 class ZIP_API CZipPathComponent
00035 {
00036 public:
00037  CZipPathComponent(){}
00038  virtual ~CZipPathComponent();
00039
00040  static const TCHAR m_cSeparator;
00041
00044  static void AppendSeparator(CZipString& szPath)
00045  {
00046   RemoveSeparators(szPath);
00047   szPath += m_cSeparator;
00048  }
00049
00053  static void RemoveSeparators(CZipString& szPath)
00054  {
00055 //   szPath.TrimRight(m_cSeparator);
00056   szPath.TrimRight(_T("\\/"));
00057  }
00058
00064  static void RemoveSeparatorsLeft(CZipString& szPath)
00065  {
00066   szPath.TrimLeft(_T("\\/"));
00067  }
00068
00069
00076  static bool IsSeparator(TCHAR c)
00077  {
00078   return c == _T('\\') || c == _T('/');
00079  }
00080
00084  static bool HasEndingSeparator(const CZipString& szPath)
00085  {
00086   int iLen = szPath.GetLength();
00087   if (iLen)
00088    return IsSeparator(szPath[iLen - 1]);
00089   else
00090    return false;
00091  }
00092
00099  CZipPathComponent(LPCTSTR lpszFullPath)
00100  {
00101   SetFullPath(lpszFullPath);
00102  }
00103
00104  // full path of the file (not a directory alone)
00111  void SetFullPath(LPCTSTR lpszFullPath);
00112
00116  CZipString GetFileTitle() const { return m_szFileTitle;}
00117
00124  void SetFileTitle(LPCTSTR lpszFileTitle) { m_szFileTitle = lpszFileTitle;}
00125
00126
00132  void SetExtension(LPCTSTR lpszExt)
00133  {
00134   m_szFileExt = lpszExt;
00135   m_szFileExt.TrimLeft(_T('.'));
00136  }
00137
00141  CZipString GetFileExt() const { return m_szFileExt;}
00145  CZipString GetFileDrive() const { return m_szDrive;}
00149  CZipString GetNoDrive() const ;
00150
00154  CZipString GetFileName() const
00155  {
00156   CZipString szFullFileName = m_szFileTitle;
00157   if (!m_szFileExt.IsEmpty())
00158   {
00159    szFullFileName += _T(".");
00160    szFullFileName += m_szFileExt;
00161   }
00162   return szFullFileName;
00163  }
00167  CZipString GetFullPath() const
00168  {
00169   CZipString szFullPath = GetFilePath();
00170   CZipString szFileName = GetFileName();
00171   if (!szFileName.IsEmpty())
00172   {
00173    szFullPath  += m_cSeparator;
00174    szFullPath  += szFileName;
00175   }
00176   return szFullPath;
00177
00178  }
00182  CZipString GetFilePath() const
00183  {
00184    CZipString szDrive = m_szDrive;
00185    CZipString szDir = m_szDirectory;
00186    if (!szDrive.IsEmpty() && !szDir.IsEmpty())
00187     szDrive += m_cSeparator;
00188
00189    return m_szPrefix + szDrive + szDir;
00190
00191  }
00192 protected:
00197  CZipString m_szDirectory,
00198   m_szFileTitle,
00199   m_szFileExt,
00200   m_szDrive,
00201   m_szPrefix;
00202
00203
00204 };
00205
00206 #endif // !defined(AFX_ZIPPATHCOMPONENT_H__9B222C08_AD11_4138_96CC_1237511E3E37__INCLUDED_)
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipPlatform.h Source File

ZipPlatform.h

Go to the documentation of this file.
00001
00002 // $Workfile: ZipPlatform.h $
00003 // $Archive: /ZipArchive/ZipPlatform.h $
00004 // $Date: 21-01-04 19:01 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyright 2000-2004 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // For the licensing details see the file License.txt
00016
00022 #if !defined(AFX_ZipPlatform_H__E2FE6343_9D03_4F3C_A1F7_706C9F0ED978__INCLUDED_)
00023 #define AFX_ZipPlatform_H__E2FE6343_9D03_4F3C_A1F7_706C9F0ED978__INCLUDED_
00024
00025 #if _MSC_VER > 1000
00026 #pragma once
00027 #endif // _MSC_VER > 1000
00028 class CZipFileHeader;
00029 class CZipAutoBuffer;
00030 #include "ZipString.h"
00031 #include "ZipPathComponent.h"
00032 #include <sys/types.h>
00033 #include "ZipExport.h"
00034
00039 namespace ZipPlatform
00040 {
00041
00045  ZIP_API bool GetSystemCaseSensitivity();
00046
00052  ZIP_API int GetSystemID();
00053
00057  ZIP_API DWORD GetDefaultAttributes();
00058
00062  ZIP_API DWORD GetDefaultDirAttributes();
00063
00067  ZIP_API DWORD GetDeviceFreeSpace(LPCTSTR lpszPath);
00068
00073  ZIP_API CZipString GetTmpFileName(LPCTSTR lpszPath = NULL, DWORD iSizeNeeded = DWORD(-1));
00080  ZIP_API bool GetCurrentDirectory(CZipString& sz);
00081  ZIP_API bool ChangeDirectory(LPCTSTR lpDirectory);
00082  ZIP_API bool SetFileAttr(LPCTSTR lpFileName, DWORD uAttr);
00083  ZIP_API bool GetFileAttr(LPCTSTR lpFileName, DWORD& uAttr);
00084  ZIP_API bool GetFileModTime(LPCTSTR lpFileName, time_t & ttime);
00085  ZIP_API bool GetFileSize(LPCTSTR lpszFileName, DWORD& dSize);
00086  ZIP_API bool SetFileModTime(LPCTSTR lpFileName, time_t ttime);
00087  ZIP_API bool CreateDirectory(LPCTSTR lpDirectory);
00088  ZIP_API bool SetVolLabel(LPCTSTR lpszPath, LPCTSTR lpszLabel);
00089  ZIP_API bool ForceDirectory(LPCTSTR lpDirectory);
00090  ZIP_API bool RemoveFile(LPCTSTR lpszFileName, bool bThrow = true);
00091  ZIP_API bool RenameFile( LPCTSTR lpszOldName, LPCTSTR lpszNewName, bool bThrow = true);
00092
00093 #ifndef _MFC_VER
00094  ZIP_API bool TruncateFile(int iDes, DWORD iSize);
00095  ZIP_API int OpenFile(LPCTSTR lpszFileName, UINT iMode, int iShareMode);
00096  ZIP_API bool FlushFile(int iDes);
00097  ZIP_API int GetFileSystemHandle(int iDes);
00098 #endif
00099
00100
00106  ZIP_API bool DirectoryExists(LPCTSTR lpszDir);
00113  ZIP_API bool IsDriveRemovable(LPCTSTR lpszFilePath);
00119  ZIP_API bool IsDirectory(DWORD uAttr);
00120
00135  ZIP_API void AnsiOem(CZipAutoBuffer& buffer, bool bAnsiToOem);
00145  ZIP_API int FileExists(LPCTSTR lpszName);
00146
00147
00148 #ifdef _UNICODE
00149
00159  ZIP_API int WideToSingle(LPCTSTR lpWide, CZipAutoBuffer &szSingle);
00170  ZIP_API int SingleToWide(const CZipAutoBuffer &szSingle, CZipString& szWide);
00171 #endif
00172 };
00173
00174
00175 #endif // !defined(AFX_ZipPlatform_H__E2FE6343_9D03_4F3C_A1F7_706C9F0ED978__INCLUDED_)
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.


ZipStorage.h Source File

ZipStorage.h

Go to the documentation of this file.
00001
00002 // $Workfile: ZipStorage.h $
00003 // $Archive: /ZipArchive/ZipStorage.h $
00004 // $Date: 21-01-04 19:01 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyright 2000-2004 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // For the licensing details see the file License.txt
00016
00023 #if !defined(AFX_ZIPSTORAGE_H__941824FE_3320_4794_BDE3_BE334ED8984B__INCLUDED_)
00024 #define AFX_ZIPSTORAGE_H__941824FE_3320_4794_BDE3_BE334ED8984B__INCLUDED_
00025
00026 #if _MSC_VER > 1000
00027 #pragma once
00028 #endif // _MSC_VER > 1000
00029
00030 #include "ZipFile.h"
00031 #include "ZipAutoBuffer.h"
00032 #include "ZipString.h"
00033 #include "ZipMemFile.h"
00034 #include "ZipExport.h"
00035
00036
00037
00044 struct ZIP_API CZipCallback
00045 {
00062  virtual bool Callback(int iProgress) = 0;
00063
00064
00065  CZipString m_szExternalFile;
00066 };
00067
00084 struct ZIP_API CZipSpanCallback : public CZipCallback
00085 {
00086  DWORD m_uDiskNeeded;
00087 };
00088
00089
00090
00101 struct ZIP_API CZipActionCallback : public CZipCallback
00102 {
00103
00104  CZipActionCallback()
00105  {
00106   m_uTotalToDo = 0;
00107   m_uTotalSoFar = 0;
00108  }
00109
00114  int m_iType;
00115
00120  virtual void Init(LPCTSTR lpszFileInZip = NULL, LPCTSTR lpszExternalFile = NULL)
00121  {
00122   m_szFileInZip = lpszFileInZip;
00123   m_szExternalFile = lpszExternalFile;
00124   m_uTotalToDo = 0;  // not yet known
00125   m_uTotalSoFar = 0; // nothing yet done
00126  }
00127
00133  virtual void SetTotal(DWORD uTotalToDo)
00134  {
00135   m_uTotalToDo = uTotalToDo;
00136 //   m_uTotalSoFar = 0; // already done in CZipArchive::CZipClbckStrg::Get
00137  }
00138
00139
00140
00151  DWORD m_uTotalToDo;
00152  DWORD m_uTotalSoFar;
00153  CZipString m_szFileInZip;
00154
00155
00159  DWORD LeftToDo() {return m_uTotalToDo - m_uTotalSoFar;}
00160
00161
00166  virtual void CallbackEnd()
00167  {
00168   ASSERT(m_uTotalSoFar == m_uTotalToDo);
00169  };
00170
00174  virtual bool operator()(int iProgress)
00175  {
00176   m_uTotalSoFar += iProgress;
00177   return Callback(iProgress);
00178  }
00179
00188  static int m_iStep;
00189
00190
00194  int GetStep(){return m_iStep ? m_iStep : 1;} // do not allow 0 (crash)
00195
00196 };
00197
00198
00202 class ZIP_API CZipStorage
00203 {
00204  friend class CZipCentralDir;
00205 public:
00206
00211  enum ZipSpanMode {
00212   noSpan,
00213   pkzipSpan,
00214   tdSpan,
00215
00220   suggestedAuto,
00225   suggestedTd
00226  };
00227
00228  CZipStorage();
00229  virtual ~CZipStorage();
00230
00240  void Open(CZipMemFile& mf, int iMode);
00241
00252  void Open(LPCTSTR szPathName, int iMode, int iVolumeSize);
00253
00254
00258  void FinalizeSpan();
00259
00260
00268  void UpdateSpanMode(WORD uLastDisk);
00269
00270
00282  void Write(const void *pBuf, DWORD iSize, bool bAtOnce);
00283
00295  DWORD Read(void* pBuf, DWORD iSize, bool bAtOnce);
00296
00301  DWORD GetPosition() const {return (DWORD)(m_pFile->GetPosition()) + m_uBytesInWriteBuffer;}
00302
00303
00308  void Flush();
00309
00310
00314  void FlushFile()
00315  {
00316   if (!m_bInMemory && !IsReadOnly())
00317    m_pFile->Flush();
00318  }
00319
00328  void NextDisk(int iNeeded, LPCTSTR lpszFileName = NULL);
00329
00330
00334  int GetCurrentDisk() const {return m_iCurrentDisk;}
00335
00336
00343  void ChangeDisk(int iNumber);
00344
00353  int IsSpanMode() const
00354  {
00355   return m_iSpanMode == noSpan ? 0 : (m_bNewSpan ? 1 : -1);
00356  }
00357
00361  bool IsReadOnly()
00362  {
00363   return m_bReadOnly || IsSpanMode() < 0;
00364  }
00365
00376  CZipString Close(bool bAfterException);
00377
00378
00386  int m_iWriteBufferSize;
00387
00388
00394  CZipFile m_internalfile;
00395
00405  CZipAbstractFile* m_pFile;
00406
00410  int m_iSpanMode;
00411
00417  CZipSpanCallback* m_pChangeDiskFunc;
00418
00422  static char m_gszExtHeaderSignat[];
00423 protected:
00424
00428  void EmptyWriteBuffer()
00429  {
00430   m_uBytesInWriteBuffer = 0;
00431  }
00432
00443  bool OpenFile(LPCTSTR lpszName, UINT uFlags, bool bThrow = true);
00449  void ThrowError(int err);
00450
00454  DWORD VolumeLeft() const;
00455
00459  CZipString RenameLastFileInTDSpan();
00468  void WriteInternalBuffer(const char *pBuf, DWORD uSize);
00469
00473  DWORD GetFreeVolumeSpace() const;
00474
00487  void CallCallback(int iCode, CZipString szTemp);
00488
00489
00499  CZipString GetTdVolumeName(bool bLast, LPCTSTR lpszZipName = NULL) const;
00500
00504  CZipString ChangeTdRead();
00505
00509  CZipString ChangePkzipRead();
00510
00511
00522  int m_iTdSpanData;
00523
00527  CZipString m_szSpanExtension;
00528
00532  DWORD GetFreeInBuffer() const {return m_pWriteBuffer.GetSize() - m_uBytesInWriteBuffer;}
00533
00537  DWORD m_uBytesInWriteBuffer;
00538
00545  DWORD m_uCurrentVolSize;
00546
00547
00551  DWORD m_uVolumeFreeInBuffer;
00552
00556  CZipAutoBuffer m_pWriteBuffer;
00557
00558
00563  DWORD m_iBytesWritten;
00564
00568  bool m_bNewSpan;
00569
00574  int m_iCurrentDisk;
00575
00579  bool m_bInMemory;
00580
00584  bool m_bReadOnly;
00585
00586 };
00587
00588 #endif // !defined(AFX_ZIPSTORAGE_H__941824FE_3320_4794_BDE3_BE334ED8984B__INCLUDED_)
ZipArchive Copyright © 2000-2004 Tadeusz Dracz . Generated at Sat Jun 19 09:04:59 2004.