Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

616 lines
22 KiB

  1. /*
  2. * Title
  3. *
  4. * exe386.h
  5. * Wieslaw Kalkus
  6. * (C) Copyright Microsoft Corp 1988-1992
  7. * 5 August 1988
  8. *
  9. * Description
  10. *
  11. * Data structure definitions for the OS/2
  12. * executable file format (flat model).
  13. *
  14. * Modification History
  15. *
  16. * 88/08/05 Wieslaw Kalkus Initial version
  17. */
  18. #ifndef _VC_VER_INC
  19. #include "..\include\vcver.h"
  20. #endif
  21. /*_________________________________________________________________*
  22. | |
  23. | |
  24. | OS/2 .EXE FILE HEADER DEFINITION - 386 version 0:32 |
  25. | |
  26. |_________________________________________________________________|
  27. * */
  28. #define BITPERWORD 16
  29. #define BITPERBYTE 8
  30. #define OBJPAGELEN 4096
  31. #define E32MAGIC1 'L' /* New magic number "LE" */
  32. #define E32MAGIC2 'E' /* New magic number "LE" */
  33. #define E32MAGIC 0x454c /* New magic number "LE" */
  34. #define E32RESBYTES1 0 /* First bytes reserved */
  35. #define E32RESBYTES2 0 /* Second bytes reserved */
  36. #define E32RESBYTES3 24 /* Third bytes reserved */
  37. #define E32LEBO 0x00 /* Little Endian Byte Order */
  38. #define E32BEBO 0x01 /* Big Endian Byte Order */
  39. #define E32LEWO 0x00 /* Little Endian Word Order */
  40. #define E32BEWO 0x01 /* Big Endian Word Order */
  41. #define E32LEVEL 0L /* 32-bit EXE format level */
  42. #define E32CPU286 0x001 /* Intel 80286 or upwardly compatibile */
  43. #define E32CPU386 0x002 /* Intel 80386 or upwardly compatibile */
  44. #define E32CPU486 0x003 /* Intel 80486 or upwardly compatibile */
  45. struct e32_exe { /* New 32-bit .EXE header */
  46. unsigned char e32_magic[2]; /* Magic number E32_MAGIC */
  47. unsigned char e32_border; /* The byte ordering for the .EXE */
  48. unsigned char e32_worder; /* The word ordering for the .EXE */
  49. unsigned long e32_level; /* The EXE format level for now = 0 */
  50. unsigned short e32_cpu; /* The CPU type */
  51. unsigned short e32_os; /* The OS type */
  52. unsigned long e32_ver; /* Module version */
  53. unsigned long e32_mflags; /* Module flags */
  54. unsigned long e32_mpages; /* Module # pages */
  55. unsigned long e32_startobj; /* Object # for instruction pointer */
  56. unsigned long e32_eip; /* Extended instruction pointer */
  57. unsigned long e32_stackobj; /* Object # for stack pointer */
  58. unsigned long e32_esp; /* Extended stack pointer */
  59. unsigned long e32_pagesize; /* .EXE page size */
  60. unsigned long e32_lastpagesize;/* Last page size in .EXE */
  61. unsigned long e32_fixupsize; /* Fixup section size */
  62. unsigned long e32_fixupsum; /* Fixup section checksum */
  63. unsigned long e32_ldrsize; /* Loader section size */
  64. unsigned long e32_ldrsum; /* Loader section checksum */
  65. unsigned long e32_objtab; /* Object table offset */
  66. unsigned long e32_objcnt; /* Number of objects in module */
  67. unsigned long e32_objmap; /* Object page map offset */
  68. unsigned long e32_itermap; /* Object iterated data map offset */
  69. unsigned long e32_rsrctab; /* Offset of Resource Table */
  70. unsigned long e32_rsrccnt; /* Number of resource entries */
  71. unsigned long e32_restab; /* Offset of resident name table */
  72. unsigned long e32_enttab; /* Offset of Entry Table */
  73. unsigned long e32_dirtab; /* Offset of Module Directive Table */
  74. unsigned long e32_dircnt; /* Number of module directives */
  75. unsigned long e32_fpagetab; /* Offset of Fixup Page Table */
  76. unsigned long e32_frectab; /* Offset of Fixup Record Table */
  77. unsigned long e32_impmod; /* Offset of Import Module Name Table */
  78. unsigned long e32_impmodcnt; /* Number of entries in Import Module Name Table */
  79. unsigned long e32_impproc; /* Offset of Import Procedure Name Table */
  80. unsigned long e32_pagesum; /* Offset of Per-Page Checksum Table */
  81. unsigned long e32_datapage; /* Offset of Enumerated Data Pages */
  82. unsigned long e32_preload; /* Number of preload pages */
  83. unsigned long e32_nrestab; /* Offset of Non-resident Names Table */
  84. unsigned long e32_cbnrestab; /* Size of Non-resident Name Table */
  85. unsigned long e32_nressum; /* Non-resident Name Table Checksum */
  86. unsigned long e32_autodata; /* Object # for automatic data object */
  87. unsigned long e32_debuginfo; /* Offset of the debugging information */
  88. unsigned long e32_debuglen; /* The length of the debugging info. in bytes */
  89. unsigned long e32_instpreload;/* Number of instance pages in preload section of .EXE file */
  90. unsigned long e32_instdemand; /* Number of instance pages in demand load section of .EXE file */
  91. unsigned long e32_heapsize; /* Size of heap - for 16-bit apps */
  92. unsigned char e32_res3[E32RESBYTES3 - 4 - 8];
  93. /* Pad structure to 192 bytes */
  94. unsigned long e32_winresoff ;
  95. unsigned long e32_winreslen ;
  96. unsigned short Dev386_Device_ID;
  97. /* Device ID for VxD */
  98. unsigned short Dev386_DDK_Version;
  99. /* DDK version for VxD */
  100. };
  101. #define E32_MAGIC1(x) (x).e32_magic[0]
  102. #define E32_MAGIC2(x) (x).e32_magic[1]
  103. #define E32_BORDER(x) (x).e32_border
  104. #define E32_WORDER(x) (x).e32_worder
  105. #define E32_LEVEL(x) (x).e32_level
  106. #define E32_CPU(x) (x).e32_cpu
  107. #define E32_OS(x) (x).e32_os
  108. #define E32_VER(x) (x).e32_ver
  109. #define E32_MFLAGS(x) (x).e32_mflags
  110. #define E32_MPAGES(x) (x).e32_mpages
  111. #define E32_STARTOBJ(x) (x).e32_startobj
  112. #define E32_EIP(x) (x).e32_eip
  113. #define E32_STACKOBJ(x) (x).e32_stackobj
  114. #define E32_ESP(x) (x).e32_esp
  115. #define E32_PAGESIZE(x) (x).e32_pagesize
  116. #define E32_LASTPAGESIZE(x) (x).e32_lastpagesize
  117. #define E32_FIXUPSIZE(x) (x).e32_fixupsize
  118. #define E32_FIXUPSUM(x) (x).e32_fixupsum
  119. #define E32_LDRSIZE(x) (x).e32_ldrsize
  120. #define E32_LDRSUM(x) (x).e32_ldrsum
  121. #define E32_OBJTAB(x) (x).e32_objtab
  122. #define E32_OBJCNT(x) (x).e32_objcnt
  123. #define E32_OBJMAP(x) (x).e32_objmap
  124. #define E32_ITERMAP(x) (x).e32_itermap
  125. #define E32_RSRCTAB(x) (x).e32_rsrctab
  126. #define E32_RSRCCNT(x) (x).e32_rsrccnt
  127. #define E32_RESTAB(x) (x).e32_restab
  128. #define E32_ENTTAB(x) (x).e32_enttab
  129. #define E32_DIRTAB(x) (x).e32_dirtab
  130. #define E32_DIRCNT(x) (x).e32_dircnt
  131. #define E32_FPAGETAB(x) (x).e32_fpagetab
  132. #define E32_FRECTAB(x) (x).e32_frectab
  133. #define E32_IMPMOD(x) (x).e32_impmod
  134. #define E32_IMPMODCNT(x) (x).e32_impmodcnt
  135. #define E32_IMPPROC(x) (x).e32_impproc
  136. #define E32_PAGESUM(x) (x).e32_pagesum
  137. #define E32_DATAPAGE(x) (x).e32_datapage
  138. #define E32_PRELOAD(x) (x).e32_preload
  139. #define E32_NRESTAB(x) (x).e32_nrestab
  140. #define E32_CBNRESTAB(x) (x).e32_cbnrestab
  141. #define E32_NRESSUM(x) (x).e32_nressum
  142. #define E32_AUTODATA(x) (x).e32_autodata
  143. #define E32_DEBUGINFO(x) (x).e32_debuginfo
  144. #define E32_DEBUGLEN(x) (x).e32_debuglen
  145. #define E32_INSTPRELOAD(x) (x).e32_instpreload
  146. #define E32_INSTDEMAND(x) (x).e32_instdemand
  147. #define E32_HEAPSIZE(x) (x).e32_heapsize
  148. /*
  149. * Format of E32_MFLAGS(x):
  150. *
  151. * Low word has the following format:
  152. *
  153. * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - bit no
  154. * | | | | | | | |
  155. * | | | | | | | +------- Per-Process Library Initialization
  156. * | | | | | | +----------- No Internal Fixups for Module in .EXE
  157. * | | | | | +------------- No External Fixups for Module in .EXE
  158. * | | | | +------------------- Incompatible with PM Windowing
  159. * | | | +--------------------- Compatible with PM Windowing
  160. * | | +----------------------- Uses PM Windowing API
  161. * | +-------------------------------- Module not Loadable
  162. * +-------------------------------------- Library Module
  163. */
  164. #define E32NOTP 0x8000L /* Library Module - used as NENOTP */
  165. #define E32NOLOAD 0x2000L /* Module not Loadable */
  166. #define E32PMAPI 0x0300L /* Uses PM Windowing API */
  167. #define E32PMW 0x0200L /* Compatible with PM Windowing */
  168. #define E32NOPMW 0x0100L /* Incompatible with PM Windowing */
  169. #define E32NOEXTFIX 0x0020L /* NO External Fixups in .EXE */
  170. #define E32NOINTFIX 0x0010L /* NO Internal Fixups in .EXE */
  171. #define E32LIBINIT 0x0004L /* Per-Process Library Initialization */
  172. #define E32APPMASK 0x0700L /* Aplication Type Mask */
  173. /*
  174. * Format of E32_MFLAGS(x):
  175. *
  176. * High word has the following format:
  177. *
  178. * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - bit no
  179. * | |
  180. * | +--- Protected memory library module
  181. * +----- Device driver
  182. */
  183. #define E32PROTDLL 0x10000L // Protected memory library module
  184. #define E32DEVICE 0x20000L // Device driver
  185. #define E32MODEXE 0x00000L // .EXE module
  186. #define E32MODDLL 0x08000L // .DLL module
  187. #define E32MODPROTDLL 0x18000L // Protected memory library module
  188. #define E32MODPDEV 0x20000L // Physical device driver
  189. #define E32MODVDEV 0x28000L // Virtual device driver
  190. #define E32MODVDEVDYN 0x38000L // Virtual device driver (dynamic)
  191. #define E32MODMASK 0x38000L // Module type mask
  192. /*
  193. * RELOCATION DEFINITIONS - RUN-TIME FIXUPS
  194. */
  195. #pragma pack(1) /* This data must be packed */
  196. typedef union _offset
  197. {
  198. unsigned short offset16;
  199. unsigned long offset32;
  200. }
  201. offset; /* 16-bit or 32-bit offset */
  202. /***ET+ r32_rlc - Relocation item */
  203. struct r32_rlc { /* Relocation item */
  204. unsigned char nr_stype; /* Source type - shared with new_rlc */
  205. unsigned char nr_flags; /* Flag byte - shared with new_rlc */
  206. short r32_soff; /* Source page offset */
  207. unsigned short r32_objmod; /* Target obj. no. or Module ordinal */
  208. union targetid { /* BEGIN UNION */
  209. unsigned long intref; /* Internal fixup offset */
  210. unsigned long proc; /* Procedure name offset */
  211. unsigned long ord; /* Procedure ordinal */
  212. } r32_target; /* END UNION */
  213. unsigned long addval; /* Value added to the address */
  214. unsigned short r32_srccount; /* Number of chained fixup records */
  215. unsigned short r32_chain; /* Chain head */
  216. };
  217. #pragma pack() /* Stop packing */
  218. /*
  219. * In 32-bit .EXE file run-time relocations are written as varying size
  220. * records, so we need many size definitions.
  221. */
  222. #define RINTSIZE16 8
  223. #define RINTSIZE32 10
  224. #define RORDSIZE 8
  225. #define RNAMSIZE16 8
  226. #define RNAMSIZE32 10
  227. #define RADDSIZE16 10
  228. #define RADDSIZE32 12
  229. #if FALSE
  230. /*
  231. * Access macros defined in NEWEXE.H !!!
  232. */
  233. #define NR_STYPE(x) (x).nr_stype
  234. #define NR_FLAGS(x) (x).nr_flags
  235. #endif
  236. #define R32_SOFF(x) (x).r32_soff
  237. #define R32_OBJNO(x) (x).r32_objmod
  238. #define R32_MODORD(x) (x).r32_objmod
  239. #define R32_OFFSET(x) (x).r32_target.intref
  240. #define R32_PROCOFF(x) (x).r32_target.proc
  241. #define R32_PROCORD(x) (x).r32_target.ord
  242. #define R32_ADDVAL(x) (x).addval
  243. #define R32_SRCCNT(x) (x).r32_srccount
  244. #define R32_CHAIN(x) (x).r32_chain
  245. /*
  246. * Format of NR_STYPE(x)
  247. *
  248. * 7 6 5 4 3 2 1 0 - bit no
  249. * | | | | | |
  250. * | | +-+-+-+--- Source type
  251. * | +----------- Fixup to 16:16 alias
  252. * +------------- List of source offset follows fixup record
  253. */
  254. #if FALSE
  255. /* DEFINED in newexe.h !!! */
  256. #define NRSTYP 0x0f /* Source type mask */
  257. #define NRSBYT 0x00 /* lo byte (8-bits)*/
  258. #define NRSSEG 0x02 /* 16-bit segment (16-bits) */
  259. #define NRSPTR 0x03 /* 16:16 pointer (32-bits) */
  260. #define NRSOFF 0x05 /* 16-bit offset (16-bits) */
  261. #define NRPTR48 0x06 /* 16:32 pointer (48-bits) */
  262. #define NROFF32 0x07 /* 32-bit offset (32-bits) */
  263. #define NRSOFF32 0x08 /* 32-bit self-relative offset (32-bits) */
  264. #endif
  265. #define NRSRCMASK 0x0f /* Source type mask */
  266. #define NRALIAS 0x10 /* Fixup to alias */
  267. #define NRCHAIN 0x20 /* List of source offset follows */
  268. /* fixup record, source offset field */
  269. /* in fixup record contains number */
  270. /* of elements in list */
  271. /*
  272. * Format of NR_FLAGS(x) and R32_FLAGS(x):
  273. *
  274. * 7 6 5 4 3 2 1 0 - bit no
  275. * | | | | | | |
  276. * | | | | | +-+--- Reference type
  277. * | | | | +------- Additive fixup
  278. * | | | +----------- 32-bit Target Offset Flag (1 - 32-bit; 0 - 16-bit)
  279. * | | +------------- 32-bit Additive Flag (1 - 32-bit; 0 - 16-bit)
  280. * | +--------------- 16-bit Object/Module ordinal (1 - 16-bit; 0 - 8-bit)
  281. * +----------------- 8-bit import ordinal (1 - 8-bit;
  282. * 0 - NR32BITOFF toggles
  283. * between 16 and 32 bit
  284. * ordinal)
  285. */
  286. #if FALSE
  287. /* DEFINED in newexe.h !!! */
  288. #define NRADD 0x04 /* Additive fixup */
  289. #define NRRTYP 0x03 /* Reference type mask */
  290. #define NRRINT 0x00 /* Internal reference */
  291. #define NRRORD 0x01 /* Import by ordinal */
  292. #define NRRNAM 0x02 /* Import by name */
  293. #endif
  294. #define NRRENT 0x03 /* Internal entry table fixup */
  295. #define NR32BITOFF 0x10 /* 32-bit Target Offset */
  296. #define NR32BITADD 0x20 /* 32-bit Additive fixup */
  297. #define NR16OBJMOD 0x40 /* 16-bit Object/Module ordinal */
  298. #define NR8BITORD 0x80 /* 8-bit import ordinal */
  299. /*end*/
  300. /*
  301. * Data structures for storing run-time fixups in linker virtual memory.
  302. *
  303. * Each object has a list of Object Page Directories which specify
  304. * fixups for given page. Each page has its own hash table which is
  305. * used to detect fixups to the same target.
  306. */
  307. #define PAGEPERDIR 62
  308. #define LG2DIR 7
  309. typedef struct _OBJPAGEDIR
  310. {
  311. DWORD next; /* Virtual pointer to next dir on list */
  312. WORD ht[PAGEPERDIR]; /* Pointers to individual hash tables */
  313. }
  314. OBJPAGEDIR;
  315. /*
  316. * OBJECT TABLE
  317. */
  318. /***ET+ o32_obj Object Table Entry */
  319. struct o32_obj /* Flat .EXE object table entry */
  320. {
  321. unsigned long o32_size; /* Object virtual size */
  322. unsigned long o32_base; /* Object base virtual address */
  323. unsigned long o32_flags; /* Attribute flags */
  324. unsigned long o32_pagemap; /* Object page map index */
  325. unsigned long o32_mapsize; /* Number of entries in object page map */
  326. unsigned long o32_reserved; /* Reserved */
  327. };
  328. #define O32_SIZE(x) (x).o32_size
  329. #define O32_BASE(x) (x).o32_base
  330. #define O32_FLAGS(x) (x).o32_flags
  331. #define O32_PAGEMAP(x) (x).o32_pagemap
  332. #define O32_MAPSIZE(x) (x).o32_mapsize
  333. #define O32_RESERVED(x) (x).o32_reserved
  334. /*
  335. * Format of O32_FLAGS(x)
  336. *
  337. * High word of dword flag field is not used for now.
  338. * Low word has the following format:
  339. *
  340. * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - bit no
  341. * | | | | | | | | | | | | | | |
  342. * | | | | | | | | | | | | | | +--- Readable Object
  343. * | | | | | | | | | | | | | +----- Writeable Object
  344. * | | | | | | | | | | | | +------- Executable Object
  345. * | | | | | | | | | | | +--------- Resource Object
  346. * | | | | | | | | | | +----------- Object is Discardable
  347. * | | | | | | | | | +------------- Object is Shared
  348. * | | | | | | | | +--------------- Object has preload pages
  349. * | | | | | | | +----------------- Object has invalid pages
  350. * | | | | | | +------------------- Object is permanent and swappable
  351. * | | | | | +--------------------- Object is permanent and resident
  352. * | | | | +----------------------- Object is permanent and long lockable
  353. * | | | +----------------------------- 16:16 alias required (80x86 specific)
  354. * | | +-------------------------------- Big/Default bit setting (80x86 specific)
  355. * | +----------------------------------- Object is conforming for code (80x86 specific)
  356. * +-------------------------------------- Object I/O privilege level (80x86 specific)
  357. *
  358. */
  359. #define OBJREAD 0x0001L /* Readable Object */
  360. #define OBJWRITE 0x0002L /* Writeable Object */
  361. #define OBJRSRC 0x0008L /* Resource Object */
  362. #define OBJINVALID 0x0080L /* Object has invalid pages */
  363. #define OBJNONPERM 0x0600L /* Object is nonpermanent - should be */
  364. /* zero in the .EXE but internally we use 6 */
  365. #define OBJPERM 0x0100L /* Object is permanent and swappable */
  366. #define OBJRESIDENT 0x0200L /* Object is permanent and resident */
  367. #define OBJCONTIG 0x0300L /* Object is resident and contiguous */
  368. #define OBJDYNAMIC 0x0400L /* Object is permanent and long locable */
  369. #define OBJTYPEMASK 0x0700L /* Object type mask */
  370. #define OBJALIAS16 0x1000L /* 16:16 alias required (80x86 specific) */
  371. #define OBJBIGDEF 0x2000L /* Big/Default bit setting (80x86 specific) */
  372. #define OBJIOPL 0x8000L /* Object I/O privilege level (80x86 specific) */
  373. #define OBJDISCARD 0x0010L /* Object is Discardable */
  374. #define OBJSHARED 0x0020L /* Object is Shared */
  375. #define OBJPRELOAD 0x0040L /* Object has preload pages */
  376. #define OBJEXEC 0x0004L /* Executable Object */
  377. #define OBJCONFORM 0x4000L /* Object is conforming for code (80x86 specific) */
  378. /*
  379. * Life will be easier, if we keep the same names for the following flags:
  380. */
  381. #define NSDISCARD OBJDISCARD /* Object is Discardable */
  382. #define NSMOVE NSDISCARD /* Moveable object is for sure Discardable */
  383. #define NSSHARED OBJSHARED /* Object is Shared */
  384. #define NSPRELOAD OBJPRELOAD /* Object has preload pages */
  385. #define NSEXRD OBJEXEC /* Executable Object */
  386. #define NSCONFORM OBJCONFORM /* Object is conforming for code (80x86 specific) */
  387. /*end*/
  388. /***ET+ o32_map - Object Page Map entry */
  389. struct o32_map /* Object Page Map entry */
  390. {
  391. unsigned char o32_pageidx[3]; /* 24-bit page # in .EXE file */
  392. unsigned char o32_pageflags; /* Per-Page attributes */
  393. };
  394. #define GETPAGEIDX(x) ((((unsigned long)((x).o32_pageidx[0])) << BITPERWORD) + \
  395. (((x).o32_pageidx[1]) << BITPERBYTE) + \
  396. (x).o32_pageidx[2])
  397. #define PUTPAGEIDX(x,i) ((x).o32_pageidx[0] = (unsigned char) ((unsigned long)(i) >> BITPERWORD), \
  398. (x).o32_pageidx[1] = (unsigned char) ((i) >> BITPERBYTE), \
  399. (x).o32_pageidx[2] = (unsigned char) ((i) & 0xff))
  400. #define PAGEFLAGS(x) (x).o32_pageflags
  401. #define VALID 0x00 /* Valid Physical Page in .EXE */
  402. #define ITERDATA 0x01 /* Iterated Data Page */
  403. #define INVALID 0x02 /* Invalid Page */
  404. #define ZEROED 0x03 /* Zero Filled Page */
  405. #define RANGE 0x04 /* Range of pages */
  406. /*end*/
  407. /*
  408. * RESOURCE TABLE
  409. */
  410. /***ET+ rsrc32 - Resource Table Entry */
  411. struct rsrc32 /* Resource Table Entry */
  412. {
  413. unsigned short type; /* Resource type */
  414. unsigned short name; /* Resource name */
  415. unsigned long cb; /* Resource size */
  416. unsigned short obj; /* Object number */
  417. unsigned long offset; /* Offset within object */
  418. };
  419. /*end*/
  420. #pragma pack(1) /* This data must be packed */
  421. /*
  422. * ENTRY TABLE DEFINITIONS
  423. */
  424. /***ET+ b32_bundle - Entry Table */
  425. struct b32_bundle
  426. {
  427. unsigned char b32_cnt; /* Number of entries in this bundle */
  428. unsigned char b32_type; /* Bundle type */
  429. unsigned short b32_obj; /* Object number */
  430. }; /* Follows entry types */
  431. struct e32_entry
  432. {
  433. unsigned char e32_flags; /* Entry point flags */
  434. union entrykind
  435. {
  436. offset e32_offset; /* 16-bit/32-bit offset entry */
  437. struct
  438. {
  439. unsigned short offset; /* Offset in segment */
  440. unsigned short callgate; /* Callgate selector */
  441. }
  442. e32_callgate; /* 286 (16-bit) call gate */
  443. struct
  444. {
  445. unsigned short modord; /* Module ordinal number */
  446. unsigned long value; /* Proc name offset or ordinal */
  447. }
  448. e32_fwd; /* Forwarder */
  449. }
  450. e32_variant; /* Entry variant */
  451. };
  452. #pragma pack() /* Stop packing */
  453. #define B32_CNT(x) (x).b32_cnt
  454. #define B32_TYPE(x) (x).b32_type
  455. #define B32_OBJ(x) (x).b32_obj
  456. #define E32_EFLAGS(x) (x).e32_flags
  457. #define E32_OFFSET16(x) (x).e32_variant.e32_offset.offset16
  458. #define E32_OFFSET32(x) (x).e32_variant.e32_offset.offset32
  459. #define E32_GATEOFF(x) (x).e32_variant.e32_callgate.offset
  460. #define E32_GATE(x) (x).e32_variant.e32_callgate.callgate
  461. #define E32_MODORD(x) (x).e32_variant.e32_fwd.modord
  462. #define E32_VALUE(x) (x).e32_variant.e32_fwd.value
  463. #define FIXENT16 3
  464. #define FIXENT32 5
  465. #define GATEENT16 5
  466. #define FWDENT 7
  467. /*
  468. * BUNDLE TYPES
  469. */
  470. #define EMPTY 0x00 /* Empty bundle */
  471. #define ENTRY16 0x01 /* 16-bit offset entry point */
  472. #define GATE16 0x02 /* 286 call gate (16-bit IOPL) */
  473. #define ENTRY32 0x03 /* 32-bit offset entry point */
  474. #define ENTRYFWD 0x04 /* Forwarder entry point */
  475. #define TYPEINFO 0x80 /* Typing information present flag */
  476. /*
  477. * Format for E32_EFLAGS(x)
  478. *
  479. * 7 6 5 4 3 2 1 0 - bit no
  480. * | | | | | | | |
  481. * | | | | | | | +--- exported entry
  482. * | | | | | | +----- uses shared data
  483. * +-+-+-+-+-+------- parameter word count
  484. */
  485. #define E32EXPORT 0x01 /* Exported entry */
  486. #define E32SHARED 0x02 /* Uses shared data */
  487. #define E32PARAMS 0xf8 /* Parameter word count mask */
  488. /*
  489. * Flags for forwarders only:
  490. */
  491. #define FWD_ORDINAL 0x01 /* Imported by ordinal */
  492. /*end*/
  493. struct VxD_Desc_Block {
  494. ULONG DDB_Next; /* VMM RESERVED FIELD */
  495. USHORT DDB_SDK_Version; /* INIT <DDK_VERSION> RESERVED FIELD */
  496. USHORT DDB_Req_Device_Number; /* INIT <UNDEFINED_DEVICE_ID> */
  497. UCHAR DDB_Dev_Major_Version; /* INIT <0> Major device number */
  498. UCHAR DDB_Dev_Minor_Version; /* INIT <0> Minor device number */
  499. USHORT DDB_Flags; /* INIT <0> for init calls complete */
  500. UCHAR DDB_Name[8]; /* AINIT <" "> Device name */
  501. ULONG DDB_Init_Order; /* INIT <UNDEFINED_INIT_ORDER> */
  502. ULONG DDB_Control_Proc; /* Offset of control procedure */
  503. ULONG DDB_V86_API_Proc; /* INIT <0> Offset of API procedure */
  504. ULONG DDB_PM_API_Proc; /* INIT <0> Offset of API procedure */
  505. ULONG DDB_V86_API_CSIP; /* INIT <0> CS:IP of API entry point */
  506. ULONG DDB_PM_API_CSIP; /* INIT <0> CS:IP of API entry point */
  507. ULONG DDB_Reference_Data; /* Reference data from real mode */
  508. ULONG DDB_Service_Table_Ptr; /* INIT <0> Pointer to service table */
  509. ULONG DDB_Service_Table_Size; /* INIT <0> Number of services */
  510. ULONG DDB_Win32_Service_Table; /* INIT <0> Pointer to Win32 services */
  511. ULONG DDB_Prev; /* INIT <'Prev'> Ptr to prev 4.0 DDB */
  512. ULONG DDB_Reserved0; /* INIT <0> Reserved */
  513. ULONG DDB_Reserved1; /* INIT <'Rsv1'> Reserved */
  514. ULONG DDB_Reserved2; /* INIT <'Rsv2'> Reserved */
  515. ULONG DDB_Reserved3; /* INIT <'Rsv3'> Reserved */
  516. };