| 1 | /* $Id $ */
 | 
|---|
| 2 | 
 | 
|---|
| 3 | #ifndef __kLdrModLX_h__
 | 
|---|
| 4 | #define __kLdrModLX_h__
 | 
|---|
| 5 | 
 | 
|---|
| 6 | 
 | 
|---|
| 7 | #ifndef IMAGE_OS2_SIGNATURE_LX
 | 
|---|
| 8 | /** LX signature ("LX") */
 | 
|---|
| 9 | # define IMAGE_LX_SIGNATURE  KLDRHLP_LE2H_U16('L' | ('X' << 8))
 | 
|---|
| 10 | #endif
 | 
|---|
| 11 | 
 | 
|---|
| 12 | #pragma pack(1)
 | 
|---|
| 13 | 
 | 
|---|
| 14 | /**
 | 
|---|
| 15 |  * Linear eXecutable header.
 | 
|---|
| 16 |  * This structure is exactly 196 bytes long.
 | 
|---|
| 17 |  */
 | 
|---|
| 18 | struct e32_exe
 | 
|---|
| 19 | {
 | 
|---|
| 20 |     uint8_t             e32_magic[2];
 | 
|---|
| 21 |     uint8_t             e32_border;
 | 
|---|
| 22 |     uint8_t             e32_worder;
 | 
|---|
| 23 |     uint32_t            e32_level;
 | 
|---|
| 24 |     uint16_t            e32_cpu;
 | 
|---|
| 25 |     uint16_t            e32_os;
 | 
|---|
| 26 |     uint32_t            e32_ver;
 | 
|---|
| 27 |     uint32_t            e32_mflags;
 | 
|---|
| 28 |     uint32_t            e32_mpages;
 | 
|---|
| 29 |     uint32_t            e32_startobj;
 | 
|---|
| 30 |     uint32_t            e32_eip;
 | 
|---|
| 31 |     uint32_t            e32_stackobj;
 | 
|---|
| 32 |     uint32_t            e32_esp;
 | 
|---|
| 33 |     uint32_t            e32_pagesize;
 | 
|---|
| 34 |     uint32_t            e32_pageshift;
 | 
|---|
| 35 |     /** The size of the fixup section.
 | 
|---|
| 36 |      * The fixup section consists of the fixup page table, the fixup record table,
 | 
|---|
| 37 |      * the import module table, and the import procedure name table.
 | 
|---|
| 38 |      */
 | 
|---|
| 39 |     uint32_t            e32_fixupsize;
 | 
|---|
| 40 |     uint32_t            e32_fixupsum;
 | 
|---|
| 41 |     /** The size of the resident loader section.
 | 
|---|
| 42 |      * This includes the object table, the object page map table, the resource table, the resident name table,
 | 
|---|
| 43 |      * the entry table, the module format directives table, and the page checksum table (?). */
 | 
|---|
| 44 |     uint32_t            e32_ldrsize;
 | 
|---|
| 45 |     /** The checksum of the loader section. 0 if not calculated. */
 | 
|---|
| 46 |     uint32_t            e32_ldrsum;
 | 
|---|
| 47 |     /** The offset of the object table relative to this structure. */
 | 
|---|
| 48 |     uint32_t            e32_objtab;
 | 
|---|
| 49 |     /** Count of objects. */
 | 
|---|
| 50 |     uint32_t            e32_objcnt;
 | 
|---|
| 51 |     /** The offset of the object page map table relative to this structure. */
 | 
|---|
| 52 |     uint32_t            e32_objmap;
 | 
|---|
| 53 |     /** The offset of the object iterated pages (whatever this is used for) relative to the start of the file. */
 | 
|---|
| 54 |     uint32_t            e32_itermap;
 | 
|---|
| 55 |     /** The offset of the resource table relative to this structure. */
 | 
|---|
| 56 |     uint32_t            e32_rsrctab;
 | 
|---|
| 57 |     /** The number of entries in the resource table. */
 | 
|---|
| 58 |     uint32_t            e32_rsrccnt;
 | 
|---|
| 59 |     /** The offset of the resident name table relative to this structure. */
 | 
|---|
| 60 |     uint32_t            e32_restab;
 | 
|---|
| 61 |     /** The offset of the entry (export) table relative to this structure. */
 | 
|---|
| 62 |     uint32_t            e32_enttab;
 | 
|---|
| 63 |     /** The offset of the module format directives table relative to this structure. */
 | 
|---|
| 64 |     uint32_t            e32_dirtab;
 | 
|---|
| 65 |     /** The number of entries in the module format directives table. */
 | 
|---|
| 66 |     uint32_t            e32_dircnt;
 | 
|---|
| 67 |     /** The offset of the fixup page table relative to this structure. */
 | 
|---|
| 68 |     uint32_t            e32_fpagetab;
 | 
|---|
| 69 |     /** The offset of the fixup record table relative to this structure. */
 | 
|---|
| 70 |     uint32_t            e32_frectab;
 | 
|---|
| 71 |     /** The offset of the import module name table relative to this structure. */
 | 
|---|
| 72 |     uint32_t            e32_impmod;
 | 
|---|
| 73 |     /** The number of entries in the import module name table. */
 | 
|---|
| 74 |     uint32_t            e32_impmodcnt;
 | 
|---|
| 75 |     /** The offset of the import procedure name table relative to this structure. */
 | 
|---|
| 76 |     uint32_t            e32_impproc;
 | 
|---|
| 77 |     /** The offset of the page checksum table relative to this structure. */
 | 
|---|
| 78 |     uint32_t            e32_pagesum;
 | 
|---|
| 79 |     /** The offset of the data pages relative to the start of the file. */
 | 
|---|
| 80 |     uint32_t            e32_datapage;
 | 
|---|
| 81 |     /** The number of preload pages (ignored). */
 | 
|---|
| 82 |     uint32_t            e32_preload;
 | 
|---|
| 83 |     /** The offset of the non-resident name table relative to the start of the file. */
 | 
|---|
| 84 |     uint32_t            e32_nrestab;
 | 
|---|
| 85 |     /** The size of the non-resident name table. */
 | 
|---|
| 86 |     uint32_t            e32_cbnrestab;
 | 
|---|
| 87 |     uint32_t            e32_nressum;
 | 
|---|
| 88 |     uint32_t            e32_autodata;
 | 
|---|
| 89 |     uint32_t            e32_debuginfo;
 | 
|---|
| 90 |     uint32_t            e32_debuglen;
 | 
|---|
| 91 |     uint32_t            e32_instpreload;
 | 
|---|
| 92 |     uint32_t            e32_instdemand;
 | 
|---|
| 93 |     uint32_t            e32_heapsize;
 | 
|---|
| 94 |     uint32_t            e32_stacksize;
 | 
|---|
| 95 |     uint8_t             e32_res3[20];
 | 
|---|
| 96 | };
 | 
|---|
| 97 | 
 | 
|---|
| 98 | /** e32_magic[0] */
 | 
|---|
| 99 | #define E32MAGIC1       'L'
 | 
|---|
| 100 | /** e32_magic[1] */
 | 
|---|
| 101 | #define E32MAGIC2       'X'
 | 
|---|
| 102 | /** MAKEWORD(e32_magic[0], e32_magic[1]) */
 | 
|---|
| 103 | #define E32MAGIC        0x584c
 | 
|---|
| 104 | /** e32_border - little endian */
 | 
|---|
| 105 | #define E32LEBO         0
 | 
|---|
| 106 | /** e32_border - big endian */
 | 
|---|
| 107 | #define E32BEBO         1
 | 
|---|
| 108 | /** e32_worder - little endian */
 | 
|---|
| 109 | #define E32LEWO         0
 | 
|---|
| 110 | /** e32_worder - big endian */
 | 
|---|
| 111 | #define E32BEWO         1
 | 
|---|
| 112 | /** e32_level */
 | 
|---|
| 113 | #define E32LEVEL        UINT32_C(0)
 | 
|---|
| 114 | /** e32_cpu - 80286 */
 | 
|---|
| 115 | #define E32CPU286       1
 | 
|---|
| 116 | /** e32_cpu - 80386 */
 | 
|---|
| 117 | #define E32CPU386       2
 | 
|---|
| 118 | /** e32_cpu - 80486 */
 | 
|---|
| 119 | #define E32CPU486       3
 | 
|---|
| 120 | /** e32_pagesize */
 | 
|---|
| 121 | #define OBJPAGELEN      UINT32_C(0x1000)
 | 
|---|
| 122 | 
 | 
|---|
| 123 | 
 | 
|---|
| 124 | /** @name e32_mflags
 | 
|---|
| 125 |  * @{ */
 | 
|---|
| 126 | /** App Type: Fullscreen only. */
 | 
|---|
| 127 | #define E32NOPMW         UINT32_C(0x00000100)
 | 
|---|
| 128 | /** App Type: PM API. */
 | 
|---|
| 129 | #define E32PMAPI         UINT32_C(0x00000300)
 | 
|---|
| 130 | /** App Type: PM VIO compatible. */
 | 
|---|
| 131 | #define E32PMW           UINT32_C(0x00000200)
 | 
|---|
| 132 | /** Application type mask. */
 | 
|---|
| 133 | #define E32APPMASK       UINT32_C(0x00000300)
 | 
|---|
| 134 | /** Executable module. */
 | 
|---|
| 135 | #define E32MODEXE        UINT32_C(0x00000000)
 | 
|---|
| 136 | /** Dynamic link library (DLL / library) module. */
 | 
|---|
| 137 | #define E32MODDLL        UINT32_C(0x00008000)
 | 
|---|
| 138 | /** Protected memory DLL. */
 | 
|---|
| 139 | #define E32PROTDLL       UINT32_C(0x00010000)
 | 
|---|
| 140 | /** Physical Device Driver. */
 | 
|---|
| 141 | #define E32MODPDEV       UINT32_C(0x00020000)
 | 
|---|
| 142 | /** Virtual Device Driver. */
 | 
|---|
| 143 | #define E32MODVDEV       UINT32_C(0x00028000)
 | 
|---|
| 144 | /** Device driver */
 | 
|---|
| 145 | #define E32DEVICE        E32MODPDEV
 | 
|---|
| 146 | /** Dynamic link library (DLL / library) module. */
 | 
|---|
| 147 | #define E32NOTP          E32MODDLL
 | 
|---|
| 148 | /** Protected memory DLL. */
 | 
|---|
| 149 | #define E32MODPROTDLL    (E32MODDLL | E32PROTDLL)
 | 
|---|
| 150 | /** Module Type mask. */
 | 
|---|
| 151 | #define E32MODMASK       UINT32_C(0x00038000)
 | 
|---|
| 152 | /** Not loadable (linker error). */
 | 
|---|
| 153 | #define E32NOLOAD        UINT32_C(0x00002000)
 | 
|---|
| 154 | /** No internal fixups. */
 | 
|---|
| 155 | #define E32NOINTFIX      UINT32_C(0x00000010)
 | 
|---|
| 156 | /** No external fixups (i.e. imports). */
 | 
|---|
| 157 | #define E32NOEXTFIX      UINT32_C(0x00000020)
 | 
|---|
| 158 | /** System DLL, no internal fixups. */
 | 
|---|
| 159 | #define E32SYSDLL        UINT32_C(0x00000008)
 | 
|---|
| 160 | /** Global (set) or per instance (cleared) library initialization. */
 | 
|---|
| 161 | #define E32LIBINIT       UINT32_C(0x00000004)
 | 
|---|
| 162 | /** Global (set) or per instance (cleared) library termination. */
 | 
|---|
| 163 | #define E32LIBTERM       UINT32_C(0x40000000)
 | 
|---|
| 164 | /** Indicates when set in an executable that the process isn't SMP safe. */
 | 
|---|
| 165 | #define E32NOTMPSAFE     UINT32_C(0x00080000)
 | 
|---|
| 166 | /** @} */
 | 
|---|
| 167 | 
 | 
|---|
| 168 | /** @name Relocations (aka Fixups).
 | 
|---|
| 169 |  * @{ */
 | 
|---|
| 170 | typedef union _offset
 | 
|---|
| 171 | {
 | 
|---|
| 172 |     uint16_t            offset16;
 | 
|---|
| 173 |     uint32_t            offset32;
 | 
|---|
| 174 | } offset;
 | 
|---|
| 175 | 
 | 
|---|
| 176 | /** A relocation.
 | 
|---|
| 177 |  * @remark this structure isn't very usable since LX relocations comes in too many size variations.
 | 
|---|
| 178 |  */
 | 
|---|
| 179 | struct r32_rlc
 | 
|---|
| 180 | {
 | 
|---|
| 181 |     uint8_t             nr_stype;
 | 
|---|
| 182 |     uint8_t             nr_flags;
 | 
|---|
| 183 |     int16_t             r32_soff;
 | 
|---|
| 184 |     uint16_t            r32_objmod;
 | 
|---|
| 185 | 
 | 
|---|
| 186 |     union targetid
 | 
|---|
| 187 |     {
 | 
|---|
| 188 |         offset          intref;
 | 
|---|
| 189 |         union extfixup
 | 
|---|
| 190 |         {
 | 
|---|
| 191 |             offset      proc;
 | 
|---|
| 192 |             uint32_t    ord;
 | 
|---|
| 193 |         } extref;
 | 
|---|
| 194 |         struct addfixup
 | 
|---|
| 195 |         {
 | 
|---|
| 196 |             uint16_t    entry;
 | 
|---|
| 197 |             offset      addval;
 | 
|---|
| 198 |         } addfix;
 | 
|---|
| 199 |     } r32_target;
 | 
|---|
| 200 |     uint16_t            r32_srccount;
 | 
|---|
| 201 |     uint16_t            r32_chain;
 | 
|---|
| 202 | };
 | 
|---|
| 203 | 
 | 
|---|
| 204 | /** @name Some attempt at size constanstants.
 | 
|---|
| 205 |  * @{
 | 
|---|
| 206 |  */
 | 
|---|
| 207 | #define RINTSIZE16      8
 | 
|---|
| 208 | #define RINTSIZE32      10
 | 
|---|
| 209 | #define RORDSIZE        8
 | 
|---|
| 210 | #define RNAMSIZE16      8
 | 
|---|
| 211 | #define RNAMSIZE32      10
 | 
|---|
| 212 | #define RADDSIZE16      10
 | 
|---|
| 213 | #define RADDSIZE32      12
 | 
|---|
| 214 | /** @} */
 | 
|---|
| 215 | 
 | 
|---|
| 216 | /** @name nr_stype (source flags)
 | 
|---|
| 217 |  * @{ */
 | 
|---|
| 218 | #define NRSBYT          0x00
 | 
|---|
| 219 | #define NRSSEG          0x02
 | 
|---|
| 220 | #define NRSPTR          0x03
 | 
|---|
| 221 | #define NRSOFF          0x05
 | 
|---|
| 222 | #define NRPTR48         0x06
 | 
|---|
| 223 | #define NROFF32         0x07
 | 
|---|
| 224 | #define NRSOFF32        0x08
 | 
|---|
| 225 | #define NRSTYP          0x0f
 | 
|---|
| 226 | #define NRSRCMASK       0x0f
 | 
|---|
| 227 | #define NRALIAS         0x10
 | 
|---|
| 228 | #define NRCHAIN         0x20
 | 
|---|
| 229 | /** @} */
 | 
|---|
| 230 | 
 | 
|---|
| 231 | /** @name nr_flags (target flags)
 | 
|---|
| 232 |  * @{ */
 | 
|---|
| 233 | #define NRRINT          0x00
 | 
|---|
| 234 | #define NRRORD          0x01
 | 
|---|
| 235 | #define NRRNAM          0x02
 | 
|---|
| 236 | #define NRRENT          0x03
 | 
|---|
| 237 | #define NRRTYP          0x03
 | 
|---|
| 238 | #define NRADD           0x04
 | 
|---|
| 239 | #define NRICHAIN        0x08
 | 
|---|
| 240 | #define NR32BITOFF      0x10
 | 
|---|
| 241 | #define NR32BITADD      0x20
 | 
|---|
| 242 | #define NR16OBJMOD      0x40
 | 
|---|
| 243 | #define NR8BITORD       0x80
 | 
|---|
| 244 | /** @} */
 | 
|---|
| 245 | 
 | 
|---|
| 246 | /** @} */
 | 
|---|
| 247 | 
 | 
|---|
| 248 | 
 | 
|---|
| 249 | /** @name The Object Table (aka segment table)
 | 
|---|
| 250 |  * @{ */
 | 
|---|
| 251 | 
 | 
|---|
| 252 | /** The Object Table Entry. */
 | 
|---|
| 253 | struct o32_obj
 | 
|---|
| 254 | {
 | 
|---|
| 255 |     /** The size of the object. */
 | 
|---|
| 256 |     uint32_t            o32_size;
 | 
|---|
| 257 |     /** The base address of the object. */
 | 
|---|
| 258 |     uint32_t            o32_base;
 | 
|---|
| 259 |     /** Object flags. */
 | 
|---|
| 260 |     uint32_t            o32_flags;
 | 
|---|
| 261 |     /** Page map index. */
 | 
|---|
| 262 |     uint32_t            o32_pagemap;
 | 
|---|
| 263 |     /** Page map size. (doesn't need to be o32_size >> page shift). */
 | 
|---|
| 264 |     uint32_t            o32_mapsize;
 | 
|---|
| 265 |     /** Reserved */
 | 
|---|
| 266 |     uint32_t            o32_reserved;
 | 
|---|
| 267 | };
 | 
|---|
| 268 | 
 | 
|---|
| 269 | /** @name o32_flags
 | 
|---|
| 270 |  * @{ */
 | 
|---|
| 271 | /** Read access. */
 | 
|---|
| 272 | #define OBJREAD         UINT32_C(0x00000001)
 | 
|---|
| 273 | /** Write access. */
 | 
|---|
| 274 | #define OBJWRITE        UINT32_C(0x00000002)
 | 
|---|
| 275 | /** Execute access. */
 | 
|---|
| 276 | #define OBJEXEC         UINT32_C(0x00000004)
 | 
|---|
| 277 | /** Resource object. */
 | 
|---|
| 278 | #define OBJRSRC         UINT32_C(0x00000008)
 | 
|---|
| 279 | /** The object is discarable (i.e. don't swap, just load in pages from the executable).
 | 
|---|
| 280 |  * This overlaps a bit with object type. */
 | 
|---|
| 281 | #define OBJDISCARD      UINT32_C(0x00000010)
 | 
|---|
| 282 | /** The object is shared. */
 | 
|---|
| 283 | #define OBJSHARED       UINT32_C(0x00000020)
 | 
|---|
| 284 | /** The object has preload pages. */
 | 
|---|
| 285 | #define OBJPRELOAD      UINT32_C(0x00000040)
 | 
|---|
| 286 | /** The object has invalid pages. */
 | 
|---|
| 287 | #define OBJINVALID      UINT32_C(0x00000080)
 | 
|---|
| 288 | /** Non-permanent, link386 bug. */
 | 
|---|
| 289 | #define LNKNONPERM      UINT32_C(0x00000600)
 | 
|---|
| 290 | /** Non-permanent, correct 'value'. */
 | 
|---|
| 291 | #define OBJNONPERM      UINT32_C(0x00000000)
 | 
|---|
| 292 | /** Obj Type: The object is permanent and swappable. */
 | 
|---|
| 293 | #define OBJPERM         UINT32_C(0x00000100)
 | 
|---|
| 294 | /** Obj Type: The object is permanent and resident (i.e. not swappable). */
 | 
|---|
| 295 | #define OBJRESIDENT     UINT32_C(0x00000200)
 | 
|---|
| 296 | /** Obj Type: The object is resident and contigious. */
 | 
|---|
| 297 | #define OBJCONTIG       UINT32_C(0x00000300)
 | 
|---|
| 298 | /** Obj Type: The object is permanent and long locable. */
 | 
|---|
| 299 | #define OBJDYNAMIC      UINT32_C(0x00000400)
 | 
|---|
| 300 | /** Object type mask. */
 | 
|---|
| 301 | #define OBJTYPEMASK     UINT32_C(0x00000700)
 | 
|---|
| 302 | /** x86: The object require an 16:16 alias. */
 | 
|---|
| 303 | #define OBJALIAS16      UINT32_C(0x00001000)
 | 
|---|
| 304 | /** x86: Big/Default selector setting, i.e. toggle 32-bit or 16-bit. */
 | 
|---|
| 305 | #define OBJBIGDEF       UINT32_C(0x00002000)
 | 
|---|
| 306 | /** x86: conforming selector setting (weird stuff). */
 | 
|---|
| 307 | #define OBJCONFORM      UINT32_C(0x00004000)
 | 
|---|
| 308 | /** x86: IOPL. */
 | 
|---|
| 309 | #define OBJIOPL         UINT32_C(0x00008000)
 | 
|---|
| 310 | /** @} */
 | 
|---|
| 311 | 
 | 
|---|
| 312 | /** A Object Page Map Entry. */
 | 
|---|
| 313 | struct o32_map
 | 
|---|
| 314 | {
 | 
|---|
| 315 |     /** The file offset of the page. */
 | 
|---|
| 316 |     uint32_t            o32_pagedataoffset;
 | 
|---|
| 317 |     /** The number of bytes of raw page data. */
 | 
|---|
| 318 |     uint16_t            o32_pagesize;
 | 
|---|
| 319 |     /** Per page flags describing how the page is encoded in the file. */
 | 
|---|
| 320 |     uint16_t            o32_pageflags;
 | 
|---|
| 321 | };
 | 
|---|
| 322 | 
 | 
|---|
| 323 | /** @name o32 o32_pageflags
 | 
|---|
| 324 |  * @{
 | 
|---|
| 325 |  */
 | 
|---|
| 326 | /** Raw page (uncompressed) in the file. */
 | 
|---|
| 327 | #define VALID           UINT16_C(0x0000)
 | 
|---|
| 328 | /** RLE encoded page in file. */
 | 
|---|
| 329 | #define ITERDATA        UINT16_C(0x0001)
 | 
|---|
| 330 | /** Invalid page, nothing in the file. */
 | 
|---|
| 331 | #define INVALID         UINT16_C(0x0002)
 | 
|---|
| 332 | /** Zero page, nothing in file. */
 | 
|---|
| 333 | #define ZEROED          UINT16_C(0x0003)
 | 
|---|
| 334 | /** range of pages (what is this?) */
 | 
|---|
| 335 | #define RANGE           UINT16_C(0x0004)
 | 
|---|
| 336 | /** Compressed page in file. */
 | 
|---|
| 337 | #define ITERDATA2       UINT16_C(0x0005)
 | 
|---|
| 338 | /** @} */
 | 
|---|
| 339 | 
 | 
|---|
| 340 | 
 | 
|---|
| 341 | /** Iteration Record format (RLE compressed page). */
 | 
|---|
| 342 | struct LX_Iter
 | 
|---|
| 343 | {
 | 
|---|
| 344 |     /** Number of iterations. */
 | 
|---|
| 345 |     uint16_t            LX_nIter;
 | 
|---|
| 346 |     /** The number of bytes that's being iterated. */
 | 
|---|
| 347 |     uint16_t            LX_nBytes;
 | 
|---|
| 348 |     /** The bytes. */
 | 
|---|
| 349 |     uint8_t             LX_Iterdata;
 | 
|---|
| 350 | };
 | 
|---|
| 351 | 
 | 
|---|
| 352 | /** @} */
 | 
|---|
| 353 | 
 | 
|---|
| 354 | 
 | 
|---|
| 355 | /** A Resource Table Entry */
 | 
|---|
| 356 | struct rsrc32
 | 
|---|
| 357 | {
 | 
|---|
| 358 |     /** Resource Type. */
 | 
|---|
| 359 |     uint16_t            type;
 | 
|---|
| 360 |     /** Resource ID. */
 | 
|---|
| 361 |     uint16_t            name;
 | 
|---|
| 362 |     /** Resource size in bytes. */
 | 
|---|
| 363 |     uint32_t            cb;
 | 
|---|
| 364 |     /** The index of the object containing the resource. */
 | 
|---|
| 365 |     uint16_t            obj;
 | 
|---|
| 366 |     /** Offset of the resource that within the object. */
 | 
|---|
| 367 |     uint32_t            offset;
 | 
|---|
| 368 | };
 | 
|---|
| 369 | 
 | 
|---|
| 370 | 
 | 
|---|
| 371 | /** @name The Entry Table (aka Export Table)
 | 
|---|
| 372 |  * @{ */
 | 
|---|
| 373 | 
 | 
|---|
| 374 | /** Entry bundle.
 | 
|---|
| 375 |  * Header descripting up to 255 entries that follows immediatly after this structure. */
 | 
|---|
| 376 | struct b32_bundle
 | 
|---|
| 377 | {
 | 
|---|
| 378 |     /** The number of entries. */
 | 
|---|
| 379 |     uint8_t             b32_cnt;
 | 
|---|
| 380 |     /** The type of bundle. */
 | 
|---|
| 381 |     uint8_t             b32_type;
 | 
|---|
| 382 |     /** The index of the object containing these entry points. */
 | 
|---|
| 383 |     uint16_t            b32_obj;
 | 
|---|
| 384 | };
 | 
|---|
| 385 | 
 | 
|---|
| 386 | /** @name b32_type
 | 
|---|
| 387 |  * @{ */
 | 
|---|
| 388 | /** Empty bundle, filling up unused ranges of ordinals. */
 | 
|---|
| 389 | #define EMPTY           0x00
 | 
|---|
| 390 | /** 16-bit offset entry point. */
 | 
|---|
| 391 | #define ENTRY16         0x01
 | 
|---|
| 392 | /** 16-bit callgate entry point. */
 | 
|---|
| 393 | #define GATE16          0x02
 | 
|---|
| 394 | /** 32-bit offset entry point. */
 | 
|---|
| 395 | #define ENTRY32         0x03
 | 
|---|
| 396 | /** Forwarder entry point. */
 | 
|---|
| 397 | #define ENTRYFWD        0x04
 | 
|---|
| 398 | /** Typing information present indicator. */
 | 
|---|
| 399 | #define TYPEINFO        0x80
 | 
|---|
| 400 | /** @} */
 | 
|---|
| 401 | 
 | 
|---|
| 402 | 
 | 
|---|
| 403 | /** Entry point. */
 | 
|---|
| 404 | struct e32_entry
 | 
|---|
| 405 | {
 | 
|---|
| 406 |     /** Entry point flags */
 | 
|---|
| 407 |     uint8_t             e32_flags;      /* Entry point flags */
 | 
|---|
| 408 |     union entrykind
 | 
|---|
| 409 |     {
 | 
|---|
| 410 |         /** ENTRY16 or ENTRY32. */
 | 
|---|
| 411 |         offset          e32_offset;
 | 
|---|
| 412 |         /** GATE16 */
 | 
|---|
| 413 |         struct callgate
 | 
|---|
| 414 |         {
 | 
|---|
| 415 |             /** Offset into segment. */
 | 
|---|
| 416 |             uint16_t    offset;
 | 
|---|
| 417 |             /** The callgate selector */
 | 
|---|
| 418 |             uint16_t    callgate;
 | 
|---|
| 419 |         } e32_callgate;
 | 
|---|
| 420 |         /** ENTRYFWD */
 | 
|---|
| 421 |         struct fwd
 | 
|---|
| 422 |         {
 | 
|---|
| 423 |             /** Module ordinal number (i.e. into the import module table). */
 | 
|---|
| 424 |             uint16_t    modord;
 | 
|---|
| 425 |             /** Procedure name or ordinal number. */
 | 
|---|
| 426 |             uint32_t    value;
 | 
|---|
| 427 |         } e32_fwd;
 | 
|---|
| 428 |     } e32_variant;
 | 
|---|
| 429 | };
 | 
|---|
| 430 | 
 | 
|---|
| 431 | /** @name e32_flags
 | 
|---|
| 432 |  * @{ */
 | 
|---|
| 433 | /** Exported entry (set) or private entry (clear). */
 | 
|---|
| 434 | #define E32EXPORT       0x01
 | 
|---|
| 435 | /** Uses shared data. */
 | 
|---|
| 436 | #define E32SHARED       0x02
 | 
|---|
| 437 | /** Parameter word count mask. */
 | 
|---|
| 438 | #define E32PARAMS       0xf8
 | 
|---|
| 439 | /** ENTRYFWD: Imported by ordinal (set) or by name (clear). */
 | 
|---|
| 440 | #define FWD_ORDINAL     0x01
 | 
|---|
| 441 | /** @} */
 | 
|---|
| 442 | 
 | 
|---|
| 443 | /** @name dunno
 | 
|---|
| 444 |  * @{ */
 | 
|---|
| 445 | #define FIXENT16        3
 | 
|---|
| 446 | #define FIXENT32        5
 | 
|---|
| 447 | #define GATEENT16       5
 | 
|---|
| 448 | #define FWDENT          7
 | 
|---|
| 449 | /** @} */
 | 
|---|
| 450 | 
 | 
|---|
| 451 | #pragma pack()
 | 
|---|
| 452 | 
 | 
|---|
| 453 | #endif
 | 
|---|
| 454 | 
 | 
|---|