/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

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