unit dzip;

{$MODE FPC}
{$MODESWITCH DEFAULTPARAMETERS}
{$MODESWITCH OUT}
{$MODESWITCH RESULT}

interface

const
  // Signatures
  ZIP_SIGNATURE = {$IF Defined(ENDIAN_LITTLE)}$04034B50{$ELSE}$504B0304{$ENDIF};
  ZIP_CENRALDIR = {$IF Defined(ENDIAN_LITTLE)}$02014B50{$ELSE}$504B0102{$ENDIF};

  // Compression methods
  ZIP_COMPRESSION_NO                = 0;
  ZIP_COMPRESSION_SHRUNK            = 1;
  ZIP_COMPRESSION_FACTOR1           = 2;
  ZIP_COMPRESSION_FACTOR2           = 3;
  ZIP_COMPRESSION_FACTOR3           = 4;
  ZIP_COMPRESSION_FACTOR4           = 5;
  ZIP_COMPRESSION_IMPLODED          = 6;
  ZIP_COMPRESSION_DEFLATED          = 8;
  ZIP_COMPRESSION_ENHANCED_DEFLATED = 9;
  ZIP_COMPRESSION_DCL_IMPLODED      = 10;
  ZIP_COMPRESSION_BZIP2             = 12;
  ZIP_COMPRESSION_LZMA              = 14;
  ZIP_COMPRESSION_TERSE             = 18;
  ZIP_COMPRESSION_LZ77              = 19;
  ZIP_COMPRESSION_PPMD              = 98;

type
PZipLocalFileHeader = ^TZipLocalFileHeader;
TZipLocalFileHeader = packed record
  Signature: UInt32;
  Version: UInt16;
  Flags: UInt16;
  Compression: UInt16;
  ModTime: UInt16;
  ModDate: UInt16;
  CRC32: UInt32;
  CompressedSize: UInt32;
  UncompressedSize: UInt32;
  FileNameLen: UInt16;
  ExtraFieldLen: UInt16;
end;

TZipCentralDirectoryFileHeader = packed record
  Signature: UInt32;
  Version: UInt16;
  VersionNeeded: UInt16;
  Flags: UInt16;
  Compression: UInt16;
  ModTime: UInt16;
  ModDate: UInt16;
  CRC32: UInt32;
  CompressedSize: UInt32;
  UncompressedSize: UInt32;
  FileNameLen: UInt16;
  ExtraFieldLen: UInt16;
  FileCommLen: UInt16;
  DiskStart: UInt16;
  InternalAttr: UInt16;
  ExternalAttr: UInt32;
  OffsetOfLocalHeader: UInt32;
end;

implementation

end.
