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.

301 lines
9.0 KiB

  1. /*++ BUILD Version: 0001
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 1991, Microsoft Corporation
  6. *
  7. * TDB.H
  8. * 16-bit Kernel Task Data Block
  9. *
  10. * History:
  11. * Created 11-Feb-1992 by Matt Felton (mattfe) - from 16 bit tdb.inc
  12. * 7-apr-1992 mattfe updated to be win 3.1 compatible
  13. *
  14. --*/
  15. /* XLATOFF */
  16. #ifndef __TDB16_H
  17. #define __TDB16_H
  18. /* XLATON */
  19. /*
  20. * NewExeHdr struct offsets. WOW32 uses these for getting expected winversion
  21. * directly from the exehdr.
  22. *
  23. */
  24. #define NE_LOWINVER_OFFSET 0x3e
  25. #define NE_HIWINVER_OFFSET 0x0c
  26. #define FLAG_NE_PROPFONT 0x2000
  27. /*
  28. * Task Data Block - 16 Bit Kernel Data Structure
  29. *
  30. * Contains all 16 bit task specific data.
  31. *
  32. */
  33. #define numTaskInts 7
  34. #define THUNKELEM 8 // (62*8) = 512-16 (low arena overhead)
  35. #define THUNKSIZE 8
  36. /* XLATOFF */
  37. #pragma pack(2)
  38. /* XLATON */
  39. typedef struct TDB { /* tdb16 */
  40. WORD TDB_next ; // next task in dispatch queue
  41. WORD TDB_taskSP ; // Saved SS:SP for this task
  42. WORD TDB_taskSS ; //
  43. WORD TDB_nEvents ; // Task event counter
  44. BYTE TDB_priority ; // Task priority (0 is highest)
  45. #ifdef WOWONLY
  46. BYTE TDB_thread_ordinal ; // ordinal number of this thread
  47. WORD TDB_thread_next ; // next thread
  48. WORD TDB_thread_tdb ; // the real TDB for this task
  49. WORD TDB_thread_list ; // list of allocated thread structures
  50. #else // WOWONLY
  51. BYTE TDB_iMonitor; // USER maintains this field for multiple monitor support
  52. WORD TDB_Unused2; // BUGBUG - this field was only used for old looking glass (os/2 app support) stuff and should be removed
  53. DWORD TDB_Unused3; // BUGBUG - this field was only used for old looking glass (os/2 app support) stuff and should be removed
  54. #endif // else WOWONLY
  55. DWORD TDB_ptrace_appentry; // used for cvw support to break at app's entry
  56. //
  57. // COMPATIBILITY WARNING: the above field(s) used to be
  58. //
  59. // WORD TDB_thread_free ; // free list of availble thread structures
  60. // WORD TDB_thread_count ; // total count of tread structures
  61. WORD TDB_FCW ; // Floating point control word
  62. BYTE TDB_flags ; // Task flags
  63. BYTE TDB_filler ; // keep word aligned
  64. WORD TDB_ErrMode ; // Error mode for this task
  65. WORD TDB_ExpWinVer ; // Expected Windows version for this task
  66. WORD TDB_Module ; // Task module handle to free in killtask
  67. WORD TDB_pModule ; // Pointer to the module database.
  68. WORD TDB_Queue ; // Task Event Queue pointer
  69. WORD TDB_Parent ; // TDB of the task that started this up
  70. #ifdef WOWONLY
  71. WORD TDB_SigAction ; // Action for app task signal
  72. DWORD TDB_ASignalProc ; // App's Task Signal procedure address
  73. #else // WOWONLY
  74. WORD TDB_Unused5; // BUGBUG - this field was only used for old looking glass (os/2 app support) stuff and should be removed
  75. DWORD TDB_Unused6; // BUGBUG - this field was only used for old looking glass (os/2 app support) stuff and should be removed
  76. #endif // else WOWONLY
  77. DWORD TDB_USignalProc ; // User's Task Signal procedure address
  78. DWORD TDB_GNotifyProc ; // Task global discard notify proc.
  79. DWORD TDB_INTVECS[numTaskInts] ; // Task specfic harare interrupts
  80. WORD TDB_CompatFlags ; // Compatibility flags
  81. WORD TDB_CompatFlags2 ; // Upper 16 bits
  82. //
  83. // SEVERE COMPATIBILITY WARNING: The following five fields were
  84. // used by NT WOW, and stomps some MEoW fields, namely:
  85. // TDB_selTIB, TDB_ThreadHandle, TDB_selHeap32 and TDB_Unused7.
  86. // Those fields have been put at the end.
  87. //
  88. #ifdef WOW
  89. WORD TDB_CompatHandle ; // for dBase bug
  90. WORD TDB_WOWCompatFlagsEx ; // More WOW Compatibility flags
  91. WORD TDB_WOWCompatFlagsEx2 ; // Upper 16 bits
  92. BYTE TDB_Free[3] ; // Filler to keep TDB size unchanged
  93. BYTE TDB_cLibrary ; // tracks add/del of ALL libs in system EMS
  94. #else // WOW
  95. WORD TDB_selTIB; // Selector to thread/task's TIB
  96. DWORD TDB_ThreadHandle; // Win32 thread handle
  97. WORD TDB_selHeap32; // Win32 16-bit heap, for atoms
  98. WORD TDB_Unused7; // Filler to keep TDB size unchanged
  99. #endif // else WOW
  100. DWORD TDB_PHT ; // (HANDLE:OFFSET) to private handle table
  101. WORD TDB_PDB ; // MSDOS Process Data Block (PDB)
  102. DWORD TDB_DTA ; // MSDOS Disk Transfer Address
  103. BYTE TDB_Drive ; // MSDOS current drive
  104. BYTE TDB_Directory[65] ; // *** not used starting with win95
  105. // TDB_Directory is not used anymore and is not tracked
  106. // use TDB_LFNDirectory at end of structure.
  107. // This field is still kept intact as OLE might be depending on this
  108. #ifdef WOWONLY
  109. WORD TDB_Validity ; // initial AX to be passed to a task
  110. #else // WOWONLY
  111. WORD TDB_Unused8; // BUGBUG - this field was only used for old looking glass (os/2 app support) stuff and should be removed
  112. #endif // else WOWONLY
  113. WORD TDB_Yield_to ; // DirectedYield arg stored here
  114. WORD TDB_LibInitSeg ; // segment address of libraries to init
  115. WORD TDB_LibInitOff ; // MakeProcInstance thunks live here.
  116. WORD TDB_MPI_Sel ; // Code selector for thunks
  117. WORD TDB_MPI_Thunks[((THUNKELEM*THUNKSIZE)/2)]; //
  118. BYTE TDB_ModName[8] ; // Name of Module.
  119. WORD TDB_sig ; // Signature word to detect bogus code
  120. #ifndef WOW
  121. DWORD TDB_LastError; // Last error
  122. #endif // ndef WOW
  123. #ifdef WOW
  124. DWORD TDB_ThreadID ; // 32-Bit Thread ID for this Task (use TDB_Filler Above)
  125. DWORD TDB_hThread ; // 32-bit Thread Handle for this task
  126. WORD TDB_WOWCompatFlags; // WOW Compatibility flags
  127. WORD TDB_WOWCompatFlags2; // WOW Compatibility flags
  128. #ifdef FE_SB
  129. WORD TDB_WOWCompatFlagsJPN; // WOW Compatibility flags for JAPAN
  130. WORD TDB_WOWCompatFlagsJPN2; // WOW Compatibility flags for JAPAN
  131. #endif // FE_SB
  132. DWORD TDB_vpfnAbortProc; // printer AbortProc
  133. #endif // def WOW
  134. BYTE TDB_LFNDirectory[260]; // Long directory name
  135. #ifdef WOW
  136. #ifndef WOWONLY
  137. WORD TDB_selTIB; // Selector to thread/task's TIB
  138. DWORD TDB_ThreadHandle; // Win32 thread handle
  139. WORD TDB_selHeap32; // Win32 16-bit heap, for atoms
  140. WORD TDB_Unused7; // Filler to keep TDB size unchanged
  141. #endif // ndef WOWONLY
  142. #endif // def WOW
  143. } TDB16;
  144. typedef TDB16 UNALIGNED *PTDB16;
  145. typedef TDB16 *LPTDB16;
  146. #ifndef __KERNEL32_H
  147. /*ASM
  148. TDBsize = SIZE TDB
  149. */
  150. #endif // ndef__KERNEL32_H
  151. /* XLATOFF */
  152. #ifndef __KERNEL32_H
  153. #ifndef WOW32_EXTENSIONS
  154. typedef TDB16 TDB;
  155. typedef TDB UNALIGNED *PTDB;
  156. #endif // ndef WOW32_EXTENSIONS
  157. #endif // ndef__KERNEL32_H
  158. // NEW_EXE1 struc from core\inc\newexe.inc
  159. typedef struct tagNEW_EXE1 {
  160. WORD ne_blah1;
  161. WORD ne_usage;
  162. WORD ne_blah2;
  163. WORD ne_pnextexe;
  164. WORD ne_pautodata;
  165. WORD ne_pfileinfo; // OFSTRUCTEX offset in TDB_pModule
  166. } NEW_EXE1;
  167. // PDB16 comes from core\inc\pdb.inc
  168. typedef struct tagPDB16 {
  169. WORD PDB16_Exit_Call;
  170. WORD PDB16_block_len;
  171. BYTE PDB16_pad1;
  172. BYTE PDB16_CPM_Call[5];
  173. DWORD PDB16_Exit;
  174. DWORD PDB16_Ctrl_C;
  175. DWORD PDB16_Fatal_Abort;
  176. WORD PDB16_Parent_PID;
  177. BYTE PDB16_JFN_Table[20];
  178. WORD PDB16_environ;
  179. DWORD PDB16_User_stack;
  180. WORD PDB16_JFN_Length;
  181. DWORD PDB16_JFN_Pointer;
  182. DWORD PDB16_Next_PDB;
  183. BYTE PDB16_InterCon;
  184. BYTE PDB16_Append;
  185. BYTE PDB16_Novell_Used[2];
  186. WORD PDB16_Version;
  187. WORD PDB16_Chain;
  188. WORD PDB16_Partition;
  189. WORD PDB16_NextPDB;
  190. DWORD PDB16_GlobalHeap;
  191. DWORD PDB16_Entry_stack;
  192. BYTE PDB16_Call_system[5];
  193. BYTE PDB16_PAD2[5];
  194. WORD PDB16_DupRefCount;
  195. BYTE PDB16_5C_FCB[0x10];
  196. BYTE PDB16_6C_FCB[0x14];
  197. BYTE PDB16_DEF_DTA[0x80];
  198. } PDB16;
  199. /* XLATON */
  200. // signature word used to check validity of a TDB
  201. #define TDB_SIGNATURE 'DT'
  202. // TDB flags
  203. // GDI will clear the TDBF_HOOKINT2F bit when enabling/disabling the
  204. // DISPLAY driver, *dont* change or remove this bit without changing
  205. // GDI. Toddla
  206. //
  207. #define TDBF_WINOLDAP 01 /* This app is WinOldAp. */
  208. #define TDBF_EMSSHARE 02 /* This app shares EMS banks with MSDOS EXEC. */
  209. #define TDBF_CACHECHECK 04 /* Used in CacheCompact to prevent revisitation. */
  210. #ifdef WOWONLY
  211. #define TDBF_OS2APP 0x08 // This is an OS/2 app.
  212. #define TDBF_WIN32S 0x10 // This is Win32S app.
  213. #else ; WOWONLY
  214. #define TDBF_NEWTASK 0x08 // This task has not yet been scheduled
  215. #endif ; WOWONLY
  216. #define TDBF_KERNEL32 0x10 /* This is a Kernel32 thread */
  217. #define TDBF_HGCLEANUP 0x20 /* Win32 app has ganged handles to clean up */
  218. #define TDBF_HOOKINT21 0x40 // app hooks int 21H
  219. #define TDBF_HOOKINT2F 0x80 // app hooks int 2FH
  220. // This bit is defined for the TDB_Drive field
  221. #define TDB_DIR_VALID 0x80
  222. // NOTE TDB_ThreadID MUST be DWORD aligned or else it will fail on MIPS
  223. /* XLATOFF */
  224. #pragma pack()
  225. /* XLATON */
  226. /* XLATOFF */
  227. #endif // ndef __TDB16_H
  228. /* XLATON */