ZipEndOfCentralDirectoryRecord
Previous  Top  Next

ZipEndOfCentralDirectoryRecord - The Central Directory of a Zip File.

Description

Each Zip File has also an End-of-Central-Directory Record at the very end of the Zip File, which has a pointer to the Start of the first Central Directory Record, which is also the Start of the Central Directory itself. This End-of-Central-Directory Record contains some additional information, like the number of (File) Entries and the Size of the Central Directory, an optional (Global) Zip File Comment and information that pertains to Zip Files that are "spanned" over multiple Disks (in individual Zip Files). This "Spanning" feature is not supported by the current XbZLib implementation, though. If the End-of-Central-Directory Record is missing, the Central Directory, and therefore the Local File Records and the Data cannot be found, and the Zip File is considered corrupted!  
 
This End-of-Central-Directory Record is represented as a Structure in the XbZLib implementation. The following is the format of the End-of-Central-Directory Record, as defined in the file "XbZLibSt.prg":  

STRUCTURE ZipEndOfCentralDirectoryRecord  
  CHAR  Signature       SIZE 4  // "PK" + chr(5) + chr(6)  
  UINT  DiskNumber              // Set to "0" (Currently IGNORED)  
  UINT  DiskNumWStartCD         // Set to "0" (Currently IGNORED)  
  UINT  EntriesThisDisk         // Same as Entries (Currently IGNORED)  
  UINT  Entries                 // Same as EntriesThisDisk (Currently IGNORED)  
  ULONG SizeOfCD  
  ULONG StartOfCD  
  UINT  CommentLen  
  CHAR  Comment  
ENDSTRUCT  

The "Spanning" of Zip Files over multiple Disks/Files is not supported, and the Disk Number and Disk Number with Start Central Directory fields are ignored and always set to Zero "0", while the Entries and Entries This Disk fields are also ignored (when reading a Zip File) and are always set to the same value when written! A future version of XbZLib might be able to handle "spanning" over multiple Disks/Files correctly, though.