home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 February / PCO_0299.ISO / filesbbs / os2 / i2htm091.arj / I2HTM091.ZIP / source / inf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-11-11  |  7.1 KB  |  168 lines

  1.  
  2. /*
  3.  * inf.h:
  4.  *      typedef's for structures in INF files
  5.  *
  6.  *      Credits: Most of the information for creating this stems
  7.  *      from the article in EDM/2 vol. 3 no. 8 about INF internals.
  8.  *      Big thanks go out to Peter Childs for this.
  9.  *      His work in turn is based on that of others. See inf03.txt
  10.  *      for details.
  11.  *
  12.  *      Copyright (C) 1997-98 Ulrich Möller.
  13.  *      This file is part of the INF2HTML package.
  14.  *      INF2HTML is free software; you can redistribute it and/or modify
  15.  *      it under the terms of the GNU General Public License as published
  16.  *      by the Free Software Foundation, in version 2 as it comes in the
  17.  *      "COPYING" file of INF2HTML distribution.
  18.  *      This program is distributed in the hope that it will be useful,
  19.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  *      GNU General Public License for more details.
  22.  */
  23.  
  24. // pack all structures, i.e. do not align on
  25. // 4-byte borders
  26. #pragma pack (1)
  27.  
  28. // INF header at beginning of file
  29. typedef struct _INFHEADER
  30. {
  31.     USHORT usMagicID;           // ID magic word (5348h = "HS")
  32.     BYTE   bUnknown1;           // unknown purpose, could be third letter of ID
  33.     BYTE   bFlags;              // probably a flag word... bit0 if INF, bit 4 if HLP
  34.     USHORT usHdrsize;           // total size of header
  35.     USHORT usUnknown2;          // unknown purpose
  36.     USHORT usNToc;              // number of entries in the tocarray
  37.     ULONG  ulTocStrTableStart;  // file offset of the start of the strings for the table-of-contents
  38.     ULONG  ulTocStrLen;         // number of bytes in file occupied by the table-of-contents strings
  39.     ULONG  ulTocStart;          // file offset of the start of tocarray
  40.     USHORT usNRes;              // number of panels with ressource numbers
  41.     ULONG  ulResStart;          // file offset of ressource number table
  42.     USHORT usNName;             // number of panels with textual name
  43.     ULONG  ulNameStart;         // file offset to panel name table
  44.     USHORT usNIndex;            // number of index entries
  45.     ULONG  ulIndexStart;        // file offset to index table
  46.     ULONG  ulIndexLen;          // size of index table
  47.     CHAR   acUnknown3[10] ;     // unknown purpose
  48.     ULONG  ulSearchStart;       // file offset of full text search table
  49.     ULONG  ulSearchLen;         // size of full text search table
  50.     USHORT usNSlots;            // number of "slots"
  51.     ULONG  ulSlotsStart;        // file offset of the slots array
  52.     ULONG  ulDictLen;           // number of bytes occupied by the "dictionary"
  53.     USHORT usNDict;             // number of entries in the dictionary
  54.     ULONG  ulDictStart;         // file offset of the start of the dictionary
  55.     ULONG  ulImgStart;          // file offset of image data
  56.     BYTE   bUnknown4;           // unknown purpose
  57.     ULONG  ulNlsStart;          // file offset of NLS table
  58.     ULONG  ulNlsLen;            // size of NLS table
  59.     ULONG  ulExtStart;          // file offset of extended data block
  60.     CHAR   acUnknown5[12];      // unknown purpose
  61.     CHAR   szTitle[48];         // ASCII title of database
  62. } INFHEADER, *PINFHEADER;
  63.  
  64. // Table of Contents (TOC) entry. The TOC starts at file
  65. // offset ulTocStart in the INF header.
  66. typedef struct _TOCENTRY
  67. {
  68.     BYTE bLen;                  // length of the entry including this byte
  69.     BYTE bFlags;                // flag byte:
  70.                                 //      0x80    fHasChildren:
  71.                                 //              following nodes are a higher level
  72.                                 //      0x40    fHidden:
  73.                                 //              entry is not shown in VIEW.EXE TOC
  74.                                 //      0x20    fExtended:
  75.                                 //              extended TOC structure format (see below)
  76.                                 //      0x10    unknown
  77.                                 // The lower four bits (0x0F) show the TOC level
  78.                                 // of this entry.
  79.     BYTE bNTocSlots;            // number of slots occupied by the text for
  80.                                 // this toc entry
  81.  
  82. } TOCENTRY, *PTOCENTRY;
  83.  
  84. /*  if the "extended" bit is 0, this is immediately followed by
  85.     {
  86.         USHORT usTocslots[ntocslots];   // indices of the slots that make up
  87.                                         // the article for this entry
  88.         CHAR  achTitle[];               // the remainder of the tocentry
  89.                                         // until bLen bytes have been used [not
  90.                                         // zero terminated]
  91.     }
  92.  
  93.     if extended is 1 there are intervening bytes that (I think) describe
  94.     the kind, size and position of the window in which to display the
  95.     article.  I haven't decoded these bytes, though in most cases the
  96.     following tells how many there are.  Overlay the following on the next
  97.     two bytes
  98.         {
  99.            int8 w1;
  100.            int8 w2;
  101.         }
  102.     Here's a C code fragment for computing the number of bytes to skip
  103.         int bytestoskip = 0;
  104.         if (w1 & 0x8) { bytestoskip += 2 };
  105.         if (w1 & 0x1) { bytestoskip += 5 };
  106.         if (w1 & 0x2) { bytestoskip += 5 };
  107.         if (w2 & 0x4) { bytestoskip += 2 };
  108.  
  109.     skip over bytestoskip bytes (after w2) and find the tocslots and title
  110.     as in the non-extended case. */
  111.  
  112. // Slot entry structure. Each article (i.e. INF page) consists
  113. // of one or more slots. The encoded "text" starts at abText[];
  114. // each byte is an offset into the local dictionary, which in
  115. // turn contains offsets into the global dictionary.
  116. typedef struct _SLOT
  117. {
  118.     BYTE   bUnknown;            // ?? [always seen 0]
  119.     ULONG  ulLocalDictStart;    // file offset  of  the  local dictionary
  120.     BYTE   bNLocalDict;         // number of entries in  the local dictionary
  121.     USHORT usNText;             // number of bytes in the text
  122.     BYTE   abText[1];           // encoded text of the article (usNText bytes)
  123. } SLOT, *PSLOT;
  124.  
  125. typedef struct _DICTENTRY
  126. {
  127.     BYTE    bLength;
  128.     CHAR    achEntry[1];
  129. } DICTENTRY, *PDICTENTRY;
  130.  
  131. typedef struct _LOCALDICT
  132. {
  133.     USHORT  usEntries[1];       // with Slot.bNLocalDict entries
  134. } LOCALDICT, *PLOCALDICT;
  135.  
  136. #define BFT_bMAP 0x4d62
  137.  
  138. // bitmaps
  139. typedef struct _INFBITMAPHEADER
  140. { // BITMAP FILE HEADER
  141.     USHORT    usType;      // = 'bM';
  142.     ULONG     cbSize;
  143.     USHORT    xHotspot;
  144.     USHORT    yHotspot;
  145.     ULONG     offBits;     // =size(hdr)+size(colortbl)
  146.     // BITMAP INFO HEADER
  147.     ULONG     cbFix;       // =size(info_hdr) (usually = 12?)
  148.     USHORT    cx;          // x size
  149.     USHORT    cy;          // y size
  150.     USHORT    cPlanes;     // color planes
  151.     CHAR      cBitCount;
  152. } INFBITMAPHEADER, *PINFBITMAPHEADER;
  153.  
  154. typedef struct _BMPDATAHEADER {
  155.     ULONG ulTotalSize;
  156.     USHORT usUncompPerBlock;
  157. } BMPDATAHEADER, *PBMPDATAHEADER;
  158.  
  159. typedef struct _BMPDATABLOCK {
  160.     USHORT usCompressedSize;
  161.     UCHAR  ucCompressionType;
  162.     BYTE   Data;
  163. } BMPDATABLOCK, *PBMPDATABLOCK;
  164.  
  165. #pragma pack()
  166.  
  167.  
  168.