Zip64 Format: Crossing the Limits of File Sizes and Number of Files and Segments
Introduction
The Zip64 format is an extension to the standard zip format that practically removes limits in sizes and the number of filesinside of a zip archive.
The ZipArchive Library automatically uses the Zip64 extensions when the regular zip archivelimits are exceeded. The ZipArchive Library will not otherwise include the extensions in the archive, even if theextensions are enabled (see the paragraph below). The extensions will be removed from the archive when due to modificationsthey are not needed anymore. The library also automatically detects an archive in the Zip64 format.
To detect if an archive is in Zip64 format, request the central directory information with theCZipArchive::GetCentralDirInfo()method and call the
CZipCentralDir::CInfo::IsZip64() method.
Enabling Zip64 Extensions in the ZipArchive Library
To use the Zip64 extensions, you need to make sure that
_ZIP_ZIP64 is defined in the
_features.h file. It is enabled by default. Rebuild the ZipArchive Library and your application, if you modifythis definition. You should keep the extensions disabled, if you don't use them, otherwise the library will use
64-bit types and perform some additional processing, which may slow down your application.
Limits Compared: the Standard Format Versus Zip64 Format
The maximum values allowed in each format are summarized below:
| Standard Format | Zip64 Format |
Number of Files Inside an Archive | 65,535 | 2^64 - 1 |
Size of a File Inside an Archive [bytes] | 4,294,967,295 | 2^64 - 1 |
Size of an Archive [bytes] | 4,294,967,295 | 2^64 - 1 |
Number of Segments in a Segmented Archive | 999 (spanning) 65,535 (splitting) | 4,294,967,295 - 1 |
Central Directory Size [bytes] | 4,294,967,295 | 2^64 - 1 |
Large Collections
The maximum number of items a collection can hold, limits the maximum number of files in an archive that the ZipArchiveLibrary can process. This limit can be determined by examining the
ZIP_ARRAY_SIZE_TYPE definition.This is defined as:
size_t
in the STL versionINT_PTR
in the MFC version
The MFC version also depends on
size_t
type when sorting.
These types are usually defined as unsigned
32-bit integer types. You may need to use a
64-bit compiler for a larger collections support.
Additional Considerations