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.

215 lines
9.3 KiB

  1. /******************************************************************************
  2. *
  3. * (C) Copyright MICROSOFT Corp., 1989-1990
  4. *
  5. * Title: INT2FAPI.INC - Windows/386 V86 Application Program Interface
  6. *
  7. * Version: 3.00
  8. *
  9. * Date: 10-Mar-1989
  10. *
  11. * Author: RAL
  12. *
  13. *-----------------------------------------------------------------------------
  14. *
  15. * Change log:
  16. *
  17. * DATE REV DESCRIPTION
  18. * ----------- --- ----------------------------------------------------------
  19. * 10-Mar-1989 RAL Original for 3.0
  20. * 07-Apr-1989 RAL Added device broadcast equate
  21. * 19-Jun-1992 RJC Convert to H file
  22. *
  23. *=============================================================================
  24. *
  25. * For information on these APIs please refer to the Windows/386 DDK
  26. * appendix on the Int 2Fh Application Program Interface.
  27. *
  28. *****************************************************************************/
  29. /*
  30. * Interrupt 2Fh is used for Windows/386 API calls.
  31. */
  32. #define W386_API_Int 0x2F
  33. /*
  34. * All Windows/386 API Int 2Fh calls must be issued with AH = 16h
  35. */
  36. #define W386_Int_Multiplex 0x16
  37. /*
  38. * Values for AL for all Windows/386 API calls
  39. */
  40. #define W386_Get_Version 0x00 /* Install check/Get version */
  41. #define W386_Old_Get_VMID_API 0x02 /* Version 2.xx get VMID API call */
  42. #define W386_Startup 0x05 /* Broadcast when Win386 starting */
  43. #define W386_Exit 0x06 /* Broadcast when Win386 exited */
  44. #define W386_Device_Broadcast 0x07 /* Broadcast by virtual device */
  45. #define W386_Startup_Complete 0x08 /* Broadcast when Win386 start is complete */
  46. #define W386_Begin_Exit 0x09 /* Broadcast when Win386 is starting */
  47. /* a NORMAL exit sequence */
  48. #define W386_Windows_ID 0x0A /* Identify windows ver/type */
  49. #define W386_TSR_Identify 0x0B /* Identify TSRs */
  50. #define W386_ROM_Detect 0x0C /* Used by ROM win to detect ROMs */
  51. #define W386_WDEB 0x0D /* Used by wdeb386 */
  52. #define W386_Logo 0x0E /* IO.SYS service for logo management */
  53. #define W386_INT10 0x0F /* IO.SYS service to replace INT 10h hook */
  54. #define W386_Get_Shell 0x11 /* IO.SYS service to return shell info */
  55. #define W386_Get_BIOS_Data 0x12 /* IO.SYS service to return IO.SYS data */
  56. #define W386_Get_SYSDAT_Path 0x13 /* IO.SYS service to return path to SYSTEM.DAT */
  57. #define W386_Set_SYSDAT_Path 0x14 /* IO.SYS service to set path to SYSTEM.DAT */
  58. #define SAVE32_ID 0x1615 /* TSR Id for SAVE32.COM to save 32bit registers */
  59. #define W386_Sleep 0x7F /* Call Time_Slice_Sleep (DX=#ms) */
  60. #define W386_Release_Time 0x80 /* Release cur VM's time-slice */
  61. #define W386_Begin_Critical 0x81 /* Begin critical section */
  62. #define W386_End_Critical 0x82 /* End critical section */
  63. #define W386_Get_Cur_VMID 0x83 /* Returns BX = ID of current VM */
  64. #define W386_Get_Device_API 0x84 /* Returns ES:DI -> Device API */
  65. #define W386_Switch_And_Call 0x85 /* Change VMs and call-back */
  66. #define W386_Test_Int31_Avail 0x86 /* Returns AX=0 if Int 31 avail */
  67. #define W386_Get_PM_Switch_Addr 0x87 /* Get call-back addr for PM */
  68. #define W386_Get_LDT_Base_Sel 0x88 /* Get selector to LDT */
  69. #define W386_Win_Kernel_Idle 0x89 /* Windows kernel idle call */
  70. #define W386_DPMI_Extension 0x8A /* DPMI extension Int 2Fh */
  71. #define W386_Set_Focus 0x8B /* Set focus to specified VM */
  72. #define W386_Restart_Cmd 0x8C /* Win.Com execs specified app */
  73. #define W386_Get_Win32_API 0x8D /* Get Win32 API callback */
  74. #define W386_VM_Title 0x8E /* Assorted VM title APIs */
  75. #define W386_VM_Close 0x8F /* Assorted VM close APIs */
  76. #define W386_Return_RMD 0x90 /* return RMD list */
  77. /*
  78. * Structure for real mode device initialization API.
  79. */
  80. struct Win386_Startup_Info_Struc {
  81. BYTE SIS_Version[2]; /* AINIT <04h,01h> Structure version */
  82. DWORD SIS_Next_Ptr; /* Seg:Off of next dev in list */
  83. DWORD SIS_Virt_Dev_File_Ptr; /* INIT <0> PSZ of file name to load */
  84. DWORD SIS_Reference_Data; /* Data to be passed to device */
  85. DWORD SIS_Instance_Data_Ptr; /* INIT <0> Ptr to instance data list */
  86. DWORD SIS_Opt_Instance_Data_Ptr;/* INIT <0> Ptr to opt. instance data list */
  87. DWORD SIS_Reclaim_Data_Ptr; /* INIT <0> Ptr to reclaimable data list */
  88. };
  89. /*
  90. * Structure for instance data list. (List terminated with 0 dword).
  91. */
  92. struct Instance_Item_Struc {
  93. DWORD IIS_Ptr; /* Seg:Off of instance item */
  94. WORD IIS_Size; /* Size of instance item in bytes */
  95. };
  96. /*
  97. * Structure for reclaim data list. (List terminated with 0 Seg).
  98. */
  99. struct Reclaim_Item_Struc {
  100. WORD RIS_Seg; /* Seg of reclaimable item */
  101. WORD RIS_Paras; /* Size of item, in paragraphs */
  102. DWORD RIS_HookTable; /* Seg:Off of Reclaim_Hook_Table (0 if none) */
  103. WORD RIS_Flags; /* See RIS_* equates (below) */
  104. };
  105. #define RIS_RECLAIM 0x0001 /* segment can be reclaimed during Init_Complete */
  106. #define RIS_RESTORE 0x0002 /* segment contents must be restored prior to System_Exit */
  107. #define RIS_DOSARENA 0x0004 /* segment is a DOS memory block, add to DOS memory pool */
  108. /*
  109. * NOTE: If RIS_HookTable is non-zero, then it is interpreted as a
  110. * pointer to a Reclaim_Hook_Table, which provides a means
  111. * for the system to automatically unhook a component in a reclaimable
  112. * memory block from the rest of the system. It is also IMPORTANT to note
  113. * that if a Reclaim_Hook_Table is specified, then the memory block will
  114. * not be reclaimed UNLESS the RHT_DISABLED bit is also set. In other
  115. * words, if the hooks associated with a block have not been disabled
  116. * by the time the system attempts to reclaim the memory (Init_Complete),
  117. * then the memory containing those hooks cannot be reclaimed.
  118. *
  119. * RHT_Num_Hooks is the number of hooks to be unhooked/rehooked at
  120. * reclaim/restore time, RHT_Low_Seg is the segment of "stub code"
  121. * that is always resident, RHT_High_Seg is the segment of "driver code"
  122. * that is contained within (or identical to) RIS_Seg, and the entire
  123. * Reclaim_Hook_Table is followed by an array of Reclaim_Hook_Entry
  124. * structures, which contain pairs of offsets to dword vector addresses
  125. * that must be exchanged in order to disable or re-enable the hooks.
  126. * For each pair of offsets, the first is relative to RHT_Low_Seg and the
  127. * second is relative to RHT_High_Seg. RHT_Num_Hooks is the number of
  128. * Reclaim_Hook_Entry structures in the array.
  129. *
  130. * The system will only unhook all the hooks in a Reclaim_Hook_Table if
  131. * RHT_DISABLED bit is set and RHT_UNHOOKED is NOT set in RHT_Flags (meaning
  132. * that a Vxd or other component has assumed responsibility for the code
  133. * inside the hooks and has not unhooked them itself).
  134. *
  135. * Since the Reclaim_Hook_Table must be inside the segment being reclaimed,
  136. * it follows that unhooking will occur before memory reclamation, and that
  137. * memory restoration will occur before re-hooking.
  138. *
  139. * VxDs are free to perform their own real-mode vector hooking/unhooking
  140. * on their own. This mechanism is used by the DBLSPACE/DRVSPACE drivers,
  141. * and is simply exported as a convenience for other drivers.
  142. */
  143. /*
  144. * Structure for reclaim hook table.
  145. */
  146. struct Reclaim_Hook_Table {
  147. WORD RHT_Num_Hooks; /* number of RHE entries following */
  148. WORD RHT_Low_Seg; /* segment each RHE_Low_Off is relative to */
  149. WORD RHT_High_Seg; /* segment each RHE_High_Off is relative to */
  150. WORD RHT_Flags; /* see RHT_* equates (below) */
  151. };
  152. #define RHT_DISABLED 0x0001 /* hooks are disabled, can be unhooked now */
  153. #define RHT_UNHOOKED 0x0002 /* hooks are currently unhooked */
  154. /*
  155. * Structure for reclaim hook entries. There are RHT_Num_Hooks copies
  156. * of this structure immediately following the Reclaim_Hook_Table.
  157. */
  158. struct Reclaim_Hook_Entry {
  159. WORD RHE_Low_Off;
  160. WORD RHE_High_Off;
  161. };
  162. /*
  163. * Structure for return RMD API. See RMD.H for RMD definitions.
  164. */
  165. struct Return_RMD_Struc {
  166. DWORD RRS_RMD; /* Seg:Off of rmd chain */
  167. DWORD RRS_Next_Ptr; /* Seg:Off of next RMD chain in list */
  168. };
  169. /*
  170. * Flags passed to the Win_Kernel_Idle call to indicate state of Windows
  171. * in the BX register.
  172. */
  173. #define Win_Idle_Mouse_Busy 1
  174. #define Win_Idle_Mouse_Busy_Bit 0
  175. /*
  176. * Structure for TSR <-> Windows communication
  177. * (W386_TSR_Identify call, AL=0Bh)
  178. */
  179. struct TSR_Info_Struc {
  180. DWORD TSR_Next;
  181. WORD TSR_PSP_Segment;
  182. WORD TSR_API_Ver_ID; /* INIT <100h> */
  183. WORD TSR_Exec_Flags; /* INIT <0> */
  184. WORD TSR_Exec_Cmd_Show; /* INIT <0> */
  185. DWORD TSR_Exec_Cmd; /* INIT <0> */
  186. BYTE TSR_Reserved[4]; /* INIT <0> */
  187. DWORD TSR_ID_Block; /* INIT <0> */
  188. DWORD TSR_Data_Block; /* INIT <0> */
  189. };
  190. /*
  191. * TSR_Exec_Flags equates
  192. */
  193. #define TSR_WINEXEC 1
  194. #define TSR_LOADLIBRARY 2
  195. #define TSR_OPENDRIVER 4