PageRenderTime 23ms CodeModel.GetById 21ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/chm/src/itolitlstypes.pas

https://github.com/slibre/freepascal
Pascal | 157 lines | 112 code | 21 blank | 24 comment | 0 complexity | c64851690863c9d9b0b9c52eac138d73 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
  1{ Copyright (C) <2010> <Andrew Haines> itolitlstypes.pas
  2
  3  This library is free software; you can redistribute it and/or modify it
  4  under the terms of the GNU Library General Public License as published by
  5  the Free Software Foundation; either version 2 of the License, or (at your
  6  option) any later version.
  7
  8  This program is distributed in the hope that it will be useful, but WITHOUT
  9  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 10  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
 11  for more details.
 12
 13  You should have received a copy of the GNU Library General Public License
 14  along with this library; if not, write to the Free Software Foundation,
 15  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 16}
 17{
 18  See the file COPYING.modifiedLGPL, included in this distribution,
 19  for details about the copyright.
 20}
 21unit ITOLITLSTypes;
 22
 23{$mode objfpc}{$H+}
 24{$PACKRECORDS C}
 25
 26interface
 27
 28uses ChmBase;
 29
 30type
 31
 32  TSig = array[0..3] of char;
 33  TITOLITLSHeader = record
 34   Sig: Array [0..1] of TSig; //  ITLO/ITLS
 35   Version: DWord; // = 1
 36   HeaderSectionTableOffset: DWord;
 37   HeaderSectionEntryCount: DWord;
 38   PostHeaderTableSize: DWord;
 39   GUID: TGuid; // {0A9007C1-4076-11D3-8789-0000F8105754}
 40  end;
 41
 42  TITOLITLSHeaderSectionEntry = record
 43    OffSet: QWord; // From Start of ITLO/ITLS
 44    Length: QWord;
 45  end;
 46
 47  TChunkDirInfo = record
 48    TopAOLIChunkIndex: QWord; // -1 if none
 49    FirstAOLLChunkIndex,
 50    LastAOLLChunkIndex: QWord;
 51    Unknown0: QWord; // 0
 52    ChunkSize: DWord; // = $2000 if list $200 if Index
 53    QuickRefDensity: DWord; // = 2
 54    Unknown1: DWord; // = 0
 55    DirDepth: DWord; // 1 there is no index, 2 if there is one level of AOLI 3 if two index levels etc
 56    Unknown2: QWord; // 0
 57    DirEntryCount: QWord; // Number Of Directory Entries
 58  end;
 59
 60  TITSFHeaderV4= record
 61    ITSFsig: array [0..3] of char;
 62    Version: LongWord;
 63    HeaderLength: LongWord;
 64    Unknown_1: LongWord;
 65    Section0Offset: QWord;
 66    TimeStamp: LongWord; //bigendian
 67    LanguageID: LongWord;
 68  end;
 69
 70  TCAOLRec = record
 71    Sig: TSig; // CAOL
 72    Version: DWord; // 2
 73    CAOLSize: DWord; // includes ITSF section = $50
 74    CompilerID: array [0..1] of char; // = "HH"
 75    Unknown: Word; // 0
 76    Unknown1: DWord; // $43ED or 0
 77    DirChunkSize: DWord; // $2000
 78    DirIndexChunkSize: DWord; // $200
 79    Unknown2,       // $100000
 80    Unknown3: DWord;// $20000
 81    Unknown4,
 82    Unknown5,
 83    Unknown6: DWord; // = 0
 84    ITSFHeader: TITSFHeaderV4;
 85  end;
 86
 87  TITOLITLSPostHeader = record
 88    Version: DWord; // 2
 89    CAOLOffset: DWord; // usually $98 (is from start of PostHeader)
 90    ListChunkInfo,
 91    IndexChunkInfo: TChunkDirInfo;
 92    Unknown3: DWord; // = $100000
 93    Unknown4: Dword; // =  $20000
 94    Unknown5: QWord; // 0
 95
 96  end;
 97
 98  THeaderSection0 = TITSPHeaderPrefix;
 99
100  TIFCMRec = record
101    SIG: TSig; // = IFCM
102    Version: DWord; // = 1
103    ChunkSize: DWord; // = $2000
104    UnKnown: DWord; // = $100000
105    Unknown1: DWord; // = -1
106    Unknown2: DWord; // = -1
107    ChunkCount: Dword;//
108    Unknown3: DWord; // = 0
109  end;
110
111  TAOLLChunkHeader = record
112    Sig: TSig; // = AOLL
113    QuickRefSize: DWord;
114    ChunkIndex: QWord; // must be correct in the order written
115    PrevChunkIndex: QWord;
116    NextChunkIndex: QWord;
117    FirstEntryIndex: QWord;
118    Unknown0,       // = 1
119    Unknown1: DWord;// = 0
120    // entries
121  end;
122
123  TAOLIChunkHeader = record
124   Sig: TSig; // = AOLI
125   QuickRefSize: DWord;//    Length of quickref area at end of directory chunk
126   ChunkIndex: QWord;//    Directory chunk number
127   // entries
128  end;
129
130  const
131    ITOLITLSGuid: TGuid = '{0A9007C1-4076-11D3-8789-0000F8105754}';
132
133  type
134  TLZXv3ControlData = record
135    Sig: TSig;
136    Version: DWord;
137    ResetInterval: Dword;
138    WindowSize: DWord;
139    CacheSize: Dword;
140    Unknown1,
141    Unknown2: DWord; // 0
142  end;
143
144  TLZXv3ResetTable = record
145    Version: Dword;
146    EntryCount: DWord;
147    EntrySize: DWord;
148    EntryStart: DWord;
149    UnCompressedSize,
150    CompressedSize: QWord;
151    BlockSize: QWord; // $8000
152  end;
153
154
155implementation
156
157end.