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.

815 lines
36 KiB

  1. /*****************************************************************************
  2. * RING0.H
  3. *
  4. * Ring 0 equates to be used with VxDCall#
  5. *
  6. * This file should be replaced by references into the file
  7. * dev\inc\vmmwin32.inc once vmm.h is fixed to allow the No_VxD
  8. * option to include the Begin_Win32_Services macro.
  9. *
  10. * Created:
  11. * 9-Sep-92 [JonT]
  12. * History:
  13. * 25-Sep-92 [FelixA] Added defines and macros for the exported mem funcs
  14. * 25-Sep-92 [JonT] Added equates for VWin32.386
  15. *
  16. ****************************************************************************/
  17. // Equates for VCOND functions
  18. #ifdef WOW
  19. #define MEOW_NEED_BOP 0x80000000
  20. #define MEOW_NO_SUSPEND_OTHERS 0x40000000
  21. #else // WOW
  22. #define MEOW_NEED_BOP 0x00000000
  23. #define MEOW_NO_SUSPEND_OTHERS 0x00000000
  24. #endif // else WOW
  25. // VCOMM.386 ID numbers
  26. // (its device ID is 0x002B
  27. #define VCOMM_Device_ID 0x002B
  28. #define VCOMM_GetVersion (VCOMM_Device_ID << 16)
  29. #define VCOMM_OpenComm VCOMM_GetVersion + 1
  30. #define VCOMM_SetupComm VCOMM_OpenComm + 1
  31. #define VCOMM_EscapeCommFunction VCOMM_SetupComm + 1
  32. #define VCOMM_GetCommMask VCOMM_EscapeCommFunction + 1
  33. #define VCOMM_GetCommProp VCOMM_GetCommMask + 1
  34. #define VCOMM_GetCommState VCOMM_GetCommProp + 1
  35. #define VCOMM_GetCommTimeouts VCOMM_GetCommState + 1
  36. #define VCOMM_PurgeComm VCOMM_GetCommTimeouts + 1
  37. #define VCOMM_SetCommMask VCOMM_PurgeComm + 1
  38. #define VCOMM_SetCommState VCOMM_SetCommMask + 1
  39. #define VCOMM_SetCommTimeouts VCOMM_SetCommState + 1
  40. #define VCOMM_TransmitCommChar VCOMM_SetCommTimeouts + 1
  41. #define VCOMM_WaitCommEvent VCOMM_TransmitCommChar + 1
  42. #define VCOMM_GetCommModemStatus VCOMM_WaitCommEvent + 1
  43. #define VCOMM_WriteComm VCOMM_GetCommModemStatus+1
  44. #define VCOMM_ReadComm VCOMM_WriteComm+1
  45. #define VCOMM_ClearCommError VCOMM_ReadComm + 1
  46. #define VCOMM_CloseComm VCOMM_ClearCommError + 1
  47. #define VCOMM_GetLastError VCOMM_CloseComm + 1
  48. #define VCOMM_DequeueRequest VCOMM_GetLastError + 1
  49. #define VCOMM_QueryFriendlyName VCOMM_DequeueRequest + 1
  50. #define VCOMM_GetCommConfig VCOMM_QueryFriendlyName + 1
  51. #define VCOMM_SetCommConfig VCOMM_GetCommConfig + 1
  52. #define VCOMM_GetWin32Error VCOMM_SetCommConfig + 1
  53. #define VCOMM_FlushFileBuffers VCOMM_GetWin32Error + 1
  54. #define VCOMM_DeviceIOControl VCOMM_FlushFileBuffers + 1
  55. #ifndef NTKERN_DEVICE_ID
  56. #define NTKERN_DEVICE_ID 0x004B
  57. #endif
  58. #define NtKern_Get_Version (NTKERN_DEVICE_ID << 16)
  59. #define Nt_CreateFile (NtKern_Get_Version + 1)
  60. #define Nt_CloseHandle (Nt_CreateFile + 1)
  61. #define Nt_WriteFile (Nt_CloseHandle + 1)
  62. #define Nt_ReadFile (Nt_WriteFile + 1)
  63. #define Nt_IoControl (Nt_ReadFile + 1)
  64. #define Nt_FlushBuffersFile (Nt_IoControl + 1)
  65. #define Nt_CancelIo (Nt_FlushBuffersFile + 1)
  66. #define Nt_GetDevnodeFromFileHandle (Nt_CancelIo + 1 )
  67. #define Nt_RequestWakeupLatency (Nt_GetDevnodeFromFileHandle + 1)
  68. //
  69. // Now define calls to ACPI
  70. //
  71. #ifndef ACPI_DEVICE_ID
  72. #define ACPI_DEVICE_ID 0x004c
  73. #endif
  74. #define Acpi_GetVersion (ACPI_DEVICE_ID << 16 )
  75. #define Acpi_SetSystemIndicator ( Acpi_GetVersion + 1 )
  76. #define AcpiGetVersion() VxDCall0( Acpi_GetVersion )
  77. #define AcpiSetSystemIndicator( Indicator, Value )\
  78. VxDCall2( Acpi_SetSystemIndicator, Indicator, Value )
  79. //
  80. // definition for indicator
  81. //
  82. #define SystemStatus 0
  83. #define MessageWaiting 1
  84. #define VCOND_GETVERSION 0x00380000
  85. #define VCOND_EMITSTRING 0x00380001
  86. #define VCOND_CREATECONSOLE 0x00380002
  87. #define VCOND_READCHARINFO 0x00380003
  88. #define VCOND_READCHARS 0x00380004
  89. #define VCOND_READATTRS 0x00380005
  90. #define VCOND_WRITECHARINFO 0x00380006
  91. #define VCOND_WRITECHARS 0x00380007
  92. #define VCOND_WRITEATTRS 0x00380008
  93. #define VCOND_FILLATTRS 0x00380009
  94. #define VCOND_GETCURPOS 0x0038000a
  95. #define VCOND_GETCURATTR 0x0038000b
  96. #define VCOND_SETCURPOS 0x0038000c
  97. #define VCOND_SETCURATTR 0x0038000d
  98. #define VCOND_SETINPUTMODE 0x0038000e
  99. #define VCOND_GETINPUTMODE 0x0038000f
  100. #define VCOND_READINPUT 0x00380010
  101. #define VCOND_PEEKINPUT 0x00380011
  102. #define VCOND_WRITEINPUT 0x00380012
  103. #define VCOND_ATTACHPROCESS 0x00380013
  104. #define VCOND_DETACHPROCESS 0x00380014
  105. #define VCOND_DELETECONSOLE 0x00380015
  106. #define VCOND_GETNUMBEROFINPUTEVENTS 0x00380016
  107. #define VCOND_POSTMESSAGE 0x00380017
  108. #define VCOND_GETSCREENSIZE 0x00380018
  109. #define VCOND_FILLCHARS 0x00380019
  110. #define VCOND_FLUSHINPUT 0x0038001A
  111. #define VCOND_SETATTRIBUTE 0x0038001B
  112. #define VCOND_GETBUTTONCOUNT 0x0038001C
  113. #define VCOND_SETSCREENSIZE 0x0038001D
  114. #define VCOND_MATCHSCREENSIZE 0x0038001E
  115. #define VCOND_WAITFORNEWCONSOLE 0x0038001F
  116. #define VCOND_SPAWN 0x00380020
  117. #define VCOND_GETENVIRONMENT 0x00380021
  118. #define VCOND_GETLAUNCHINFO 0x00380022
  119. #define VCOND_INITAPCS 0x00380023
  120. #define VCOND_GRBREPAINTRECT 0x00380024
  121. #define VCOND_GRBMOVERECT 0x00380025
  122. #define VCOND_GRBSETWINDOWSIZE 0x00380026
  123. #define VCOND_GRBSETWINDOWORG 0x00380027
  124. #define VCOND_GRBSETSCREENSIZE 0x00380028
  125. #define VCOND_GRBSETCURSORPOSITION 0x00380029
  126. #define VCOND_GRBSETCURSORINFO 0x0038002A
  127. #define VCOND_GRBNOTIFYWOA 0x0038002B
  128. #define VCOND_GRBSYNC 0x0038002C
  129. #define VCOND_GRBTERMINATE 0x0038002D
  130. #define VCOND_DP32_CREATE 0x0038002E
  131. #define VCOND_DP32_GETWORK 0x0038002F
  132. #define VCOND_DP32_TERMINATE 0x00380030
  133. #define VCOND_DP32_WAITWORK 0x00380031
  134. #define VCOND_REDIRECTIONCOMPLETE 0x00380032
  135. #define VCOND_DP32_DESTROY 0x00380033
  136. #define VCOND_UNBLOCKRING3WITHFAILURE 0x00380034
  137. #ifdef BILINGUAL_CONSOLE
  138. #define VCOND_GETCP 0x00380035
  139. #endif
  140. // Special "exit-code" value for VCOND_Detach: This value means
  141. // "do not set the exit code."
  142. #define VCD_NOEXITCODE ((DWORD)0xffffffff)
  143. // Equates for VMM virtual memory functions
  144. #define W32_PageReserve 0x00010000
  145. #define W32_PageCommit 0x00010001
  146. #define W32_PageDecommit 0x00010002
  147. #define W32_PagerRegister 0x00010003
  148. #define W32_PagerQuery 0x00010004
  149. #define W32_HeapAllocate 0x00010005
  150. #define W32_ContextCreate 0x00010006
  151. #define W32_ContextDestroy 0x00010007
  152. #define W32_PageAttach 0x00010008
  153. #define W32_PageFlush 0x00010009
  154. #define W32_PageFree 0x0001000a
  155. #define W32_ContextSwitch 0x0001000b
  156. #define W32_HeapReAllocate 0x0001000c
  157. #define W32_PageModifyPermissions 0x0001000d
  158. #define W32_PageQuery 0x0001000e
  159. #define W32_GetCurrentContext 0x0001000f
  160. #define W32_HeapFree 0x00010010
  161. #define W32_RegOpenKey 0x00010011
  162. #define W32_RegCreateKey 0x00010012
  163. #define W32_RegCloseKey 0x00010013
  164. #define W32_RegDeleteKey 0x00010014
  165. #define W32_RegSetValue 0x00010015
  166. #define W32_RegDeleteValue 0x00010016
  167. #define W32_RegQueryValue 0x00010017
  168. #define W32_RegEnumKey 0x00010018
  169. #define W32_RegEnumValue 0x00010019
  170. #define W32_RegQueryValueEx 0x0001001a
  171. #define W32_RegSetValueEx 0x0001001b
  172. #define W32_RegFlushKey 0x0001001c
  173. #define W32_RegQueryInfoKey16 0x0001001d
  174. #define W32_GetDemandPageInfo 0x0001001e
  175. #define W32_BlockOnID 0x0001001f
  176. #define W32_SignalID 0x00010020
  177. #define W32_RegLoadKey 0x00010021
  178. #define W32_RegUnLoadKey 0x00010022
  179. #define W32_RegSaveKey 0x00010023
  180. #define W32_RegRemapPreDefKey 0x00010024
  181. #define W32_PageChangePager 0x00010025
  182. #define W32_RegQueryMultipleValues 0x00010026
  183. #define W32_RegReplaceKey 0x00010027
  184. #define W32_BoostFileCache 0x00010028
  185. #ifdef GANGLOAD
  186. #define W32_CacheAndDecommitPages (W32_BoostFileCache+1)
  187. #define W32_RegNotifyChangeKeyValue (W32_CacheAndDecommitPages+1)
  188. #else
  189. #define W32_RegNotifyChangeKeyValue (W32_BoostFileCache+1)
  190. #endif
  191. #define W32_PageOutPages (W32_RegNotifyChangeKeyValue+1)
  192. #define W32_mmSetCacheMidPoint (W32_PageOutPages+1)
  193. #ifdef WRITE_WATCH
  194. #define W32_mmGetWriteWatch (W32_mmSetCacheMidPoint+1)
  195. #define W32_mmResetWriteWatch (W32_mmGetWriteWatch+1)
  196. #endif // WRITE_WATCH
  197. // DEBUG Win32 API (debug device id is 0x0002)
  198. #define DEBUG_WIN32_FAULT 0x00020000
  199. // REBOOT.386 Win32 API (reboot device id is 0x0009)
  200. #define REBOOT_WIN32_INIT 0x00090000
  201. #define REBOOT_CHANGE_PHASE 0x00090001
  202. // VWIN32.386 ID numbers (vwin32 device ID is 0x002a)
  203. #define VW32_GetVersion 0x002A0000
  204. #define VW32_GetPager 0x002A0001
  205. #define VW32_GetTickCount 0x002A0002
  206. #define VW32_EnableExceptions 0x002A0003
  207. #define VW32_AllocSyncPrimitive 0x002A0006
  208. #define VW32_CreateThread (0x002A0008+MEOW_NEED_BOP)
  209. #define VW32_BlockThread 0x002A0009
  210. #define VW32_WakeThread 0x002A000A
  211. #define VW32_TerminateThread 0x002A000B
  212. #define VW32_Initialize 0x002A000C
  213. #define VW32_QueueUserAPC 0x002A000D
  214. #define VW32_CleanAPCList 0x002A000E
  215. #define VW32_QueueKernelAPC 0x002A000F
  216. #define VW32_Int21Dispatch (0x002A0010+MEOW_NO_SUSPEND_OTHERS)
  217. #define VW32_IFSMGR_DupHandle 0x002A0011
  218. #define VW32_AdjustThreadPri 0x002A0013
  219. #define VW32_GetThreadContext 0x002A0014
  220. #define VW32_SetThreadContext 0x002A0015
  221. #define VW32_ReadProcessMemory 0x002A0016
  222. #define VW32_WriteProcessMemory 0x002A0017
  223. #define VW32_GetCR0State 0x002A0018
  224. #define VW32_SetCR0State 0x002A0019
  225. #define VW32_SuspendThread 0x002A001A
  226. #define VW32_ResumeThread 0x002A001B
  227. #define VW32_DeliverPendingKernelAPCs (0x002A001C+MEOW_NEED_BOP)
  228. #define VW32_WaitCrst 0x002A001D
  229. #define VW32_WakeCrst 0x002A001E
  230. #define VW32_DeviceIOCtl 0x002A001F
  231. #define VW32_GetVMCPDVersion 0x002A0020
  232. #define VW32_SetWin32Priority 0x002A0021
  233. #define VW32_AttachThreadToGroup 0x002A0026
  234. #define VW32_Int31Dispatch 0x002A0029
  235. #define VW32_Int41Dispatch (0x002A002A+MEOW_NO_SUSPEND_OTHERS)
  236. #define VW32_BlockForTermination 0x002A002B
  237. #define VW32_TerminationHandler2 (0x002A002C+MEOW_NEED_BOP)
  238. #define VW32_BlockThreadEx 0x002A002D
  239. #define VW32_ReleaseSyncObject 0x002A0030
  240. #define VW32_UndoCrst 0x002A0032
  241. #ifndef WOW
  242. #define VW32_Ring0ThreadStart 0x002A0034
  243. #endif // ndef WOW
  244. #define VW32_EnableAPCService 0x002A0036
  245. #define VW32_FaultPop 0x002A0037
  246. #define VW32_ForceCrsts 0x002A0038
  247. #define VW32_RestoreCrsts 0x002A0039
  248. #define VW32_FreezeAllThreads 0x002A003A
  249. #define VW32_UnFreezeAllThreads 0x002A003B
  250. #define VW32_IFSMGR_CloseHandle 0x002A003C
  251. #define VW32_AttachConappThreadToVM 0x002A003D
  252. #define VW32_ActiveTimeBiasSet 0x002A003E
  253. #define VW32_ModifyPagePermission 0x002A003F
  254. #define VW32_QueryPage 0x002A0040
  255. #define VW32_ForceLeaveCrst 0x002A0041
  256. #define VW32_ForceEnterCrst 0x002A0042
  257. #define VW32_Get_FP_Instruction_Size 0x002A0043
  258. #define VW32_QueryPerformanceCounter 0x002A0044
  259. #define VW32_SetDeviceFocus 0x002A0045
  260. #define VW32_UnFreezeThread 0x002A0046
  261. #define VW32_VMM_Replace_Global_Env 0x002A0047
  262. #define VW32_SendKernelShutdown 0x002A0048
  263. #define VW32_RestoreSysCrst 0x002A0049
  264. #define VW32_AddSysCrst 0x002A004A
  265. #define VW32_SetTimeOut 0x002A004B
  266. #define VW32_CancelTimeOut 0x002A004C
  267. #define VW32_ThrowException 0x002A004D
  268. #define VW32_SimCtrlC 0x002A004E
  269. #define VW32_VMM_SystemControl 0x002A004F
  270. #define VW32_SetTimer 0x002A0050
  271. #define VW32_CancelTimer 0x002A0051
  272. #define VW32_GetNextResumeDueTime 0x002A0052
  273. #define VW32_BiosSupportsResumeTimers 0x002A0053
  274. #define VW32_SetResumeTimer 0x002A0054
  275. #define VW32_QueueUserApcEx 0x002A0055
  276. #define VW32_DisposeObject 0x002A0056
  277. #define VW32_DuplicateObject 0x002A0057
  278. #define VW32_UnuseTdbx 0x002A0058
  279. #define VW32_InterlockedAdd386 0x002A0059
  280. #define VW32_InterlockedCmpxchg386 0x002A005A
  281. #define VW32_InterlockedXadd386 0x002A005B
  282. #define VW32_WaitSingleObject 0x002A005C
  283. #define VW32_WaitMultipleObjects 0x002A005D
  284. #define VW32_ReleaseSem 0x002A005E
  285. #define VW32_ReleaseMutex 0x002A005F
  286. #define VW32_SetEvent 0x002A0060
  287. #define VW32_PulseEvent 0x002A0061
  288. #define VW32_ResetEvent 0x002A0062
  289. #define VW32_DisposeTimerR3Apc 0x002A0063
  290. #define VW32_SetWin32PriorityClass 0x002A0064
  291. #ifdef WOW
  292. #define MEOWService(dwID) ((dwID & 0x3FFF0000)==0x3FFF0000)
  293. #define MEOW_SetSelector 0x3FFF0000
  294. #define MEOW_LoadLibrary 0x3FFF0001
  295. #define MEOW_GetProcAddress 0x3FFF0002
  296. #define MEOW_FreeLibrary 0x3FFF0003
  297. #endif // def WOW
  298. // Allows use of MM* rather than VxDCall#( ..k
  299. #if !defined(WINBASEAPI)
  300. #if !defined(_KERNEL32_)
  301. #define WINBASEAPI __declspec(dllimport)
  302. #else
  303. #define WINBASEAPI
  304. #endif
  305. #endif
  306. extern WINBASEAPI DWORD __stdcall VxDCall0( ULONG );
  307. extern WINBASEAPI DWORD __stdcall VxDCall1( ULONG ,ULONG );
  308. extern WINBASEAPI DWORD __stdcall VxDCall2( ULONG ,ULONG ,ULONG );
  309. extern WINBASEAPI DWORD __stdcall VxDCall3( ULONG ,ULONG ,ULONG ,ULONG );
  310. extern WINBASEAPI DWORD __stdcall VxDCall4( ULONG ,ULONG ,ULONG ,ULONG ,ULONG );
  311. extern WINBASEAPI DWORD __stdcall VxDCall5( ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG );
  312. extern WINBASEAPI DWORD __stdcall VxDCall6( ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG );
  313. extern WINBASEAPI DWORD __stdcall VxDCall7( ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG );
  314. extern WINBASEAPI DWORD __stdcall VxDCall8( ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG );
  315. extern WINBASEAPI DWORD __stdcall VxDCall9( ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG, ULONG );
  316. extern WINBASEAPI DWORD __stdcall VxDCall10( ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG, ULONG, ULONG );
  317. extern WINBASEAPI DWORD __stdcall VxDCall11( ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG ,ULONG, ULONG, ULONG, ULONG );
  318. /* ASM
  319. VxDCall0 PROTO STDCALL, :DWORD
  320. VxDCall1 PROTO STDCALL, :DWORD, :DWORD
  321. VxDCall2 PROTO STDCALL, :DWORD, :DWORD, :DWORD
  322. VxDCall3 PROTO STDCALL, :DWORD, :DWORD, :DWORD, :DWORD
  323. VxDCall4 PROTO STDCALL, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
  324. VxDCall5 PROTO STDCALL, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
  325. VxDCall6 PROTO STDCALL, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
  326. VxDCall7 PROTO STDCALL, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
  327. VxDCall8 PROTO STDCALL, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
  328. VxDCall9 PROTO STDCALL, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
  329. VxDCall10 PROTO STDCALL, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
  330. VxDCall11 PROTO STDCALL, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
  331. */
  332. #define PageReserve(page, npages, flags) VxDCall3(W32_PageReserve,page, npages, flags)
  333. #ifdef WRITE_WATCH
  334. #define R0GetWriteWatch( ulFlags, pBaseAddr, dwRegionSize, pulAddr, pdwCount, pdwGranularity) \
  335. VxDCall6( W32_mmGetWriteWatch, ulFlags, pBaseAddr, dwRegionSize, pulAddr, pdwCount, pdwGranularity)
  336. #define R0ResetWriteWatch( pBaseAddr, dwRegionSize ) \
  337. VxDCall2( W32_mmResetWriteWatch, pBaseAddr, dwRegionSize )
  338. #endif // WRITEWATCH
  339. extern BOOL PageCommit(ULONG page, ULONG npages, ULONG hpd, ULONG pagerdata, ULONG flags);
  340. #define PageDecommit(page, npages, flags) VxDCall3(W32_PageDecommit, page, npages, flags)
  341. #define PagerRegister(ppd) VxDCall1(W32_PagerRegister, (ULONG)ppd)
  342. #define PagerQuery(hpd, ppd) VxDCall2(W32_PagerQuery, (ULONG)hpd, (ULONG)ppd)
  343. #define PageChangePager(page, npages, hpd, pagerdata, flags) \
  344. VxDCall5(W32_PageChangePager, (ULONG)page, (ULONG)npages, (ULONG)hpd, \
  345. (ULONG)pagerdata, (ULONG)flags)
  346. #define ContextCreate() VxDCall0(W32_ContextCreate)
  347. #define GetCurrentContext() VxDCall0(W32_GetCurrentContext)
  348. #define VMMHeapFree(p, f) VxDCall2(W32_HeapFree, (ULONG)(p), f)
  349. #define VMMHeapAllocate(p, f) VxDCall2(W32_HeapAllocate, (ULONG)(p), f)
  350. #define VMMHeapReAllocate(p, cb, f) VxDCall3(W32_HeapReAllocate, (ULONG)(p), cb, f)
  351. #define VMMBlockOnID(id, f) VxDCall2(W32_BlockOnID, (ULONG)(id), f)
  352. #define VMMSignalID(id) VxDCall1(W32_SignalID, (ULONG)(id))
  353. #define ContextDestroy(hcd) VxDCall1(W32_ContextDestroy, hcd)
  354. #define ContextSwitch(hcd) VxDCall1(W32_ContextSwitch, hcd)
  355. #define PageQuery(pbase, pmbi, cbmbi) VxDCall3(W32_PageQuery, (ULONG)pbase, (ULONG)pmbi, cbmbi)
  356. #define PageAttach(pagesrc, hcontextsrc, pagedst, cpg) VxDCall4(W32_PageAttach, pagesrc, hcontextsrc, pagedst, cpg)
  357. #define PageFlush(page, npages) VxDCall2(W32_PageFlush, page, npages)
  358. #define PageFree(laddr, flags) VxDCall2(W32_PageFree, (ULONG)laddr, flags)
  359. #define GetDemandPageInfo(laddr, flags) VxDCall2(W32_GetDemandPageInfo, (ULONG)laddr, flags)
  360. #define EnableExceptions(handler, selCS, selDS, hdlr1, hdlr2, hdlr3, hdlr4, thcb) \
  361. VxDCall8(VW32_EnableExceptions, (ULONG)handler, (ULONG)selCS, \
  362. (ULONG)selDS, (ULONG)hdlr1, (ULONG)hdlr2, (ULONG)hdlr3, \
  363. (ULONG)hdlr4, (ULONG)thcb)
  364. #define InitializeWin32VxD(pcdis) \
  365. VxDCall1(VW32_Initialize, (DWORD) pcdis)
  366. #ifdef WOW
  367. #define W32CreateThread(ThreadHandle, ProcessHandle, ContextHandle, \
  368. ThreadFlags, regEIP, pContext, dwStackSize, \
  369. ppStackTop, pptib, ppTDBX ) \
  370. VxDCall10(VW32_CreateThread, (ULONG)ThreadHandle, (ULONG)ProcessHandle, \
  371. (ULONG) ContextHandle, (ULONG) ThreadFlags, \
  372. (ULONG) regEIP, (ULONG) pContext, (ULONG) dwStackSize, \
  373. (ULONG) ppStackTop, (ULONG) pptib, (ULONG) ppTDBX )
  374. #else // WOW
  375. #define W32CreateThread(ThreadHandle, ProcessHandle, ContextHandle, \
  376. ThreadFlags, regCS, regEIP, regSS, regESP, ppTDBX ) \
  377. VxDCall9(VW32_CreateThread, (ULONG)ThreadHandle, (ULONG)ProcessHandle, \
  378. (ULONG) ContextHandle, (ULONG) ThreadFlags, (ULONG) regCS, \
  379. (ULONG) regEIP, (ULONG) regSS, (ULONG) regESP, (ULONG) ppTDBX )
  380. #endif // else WOW
  381. #define VxDTerminateThread(ThreadHandle, ApcData) \
  382. VxDCall2(VW32_TerminateThread, (DWORD) ThreadHandle, (DWORD) ApcData)
  383. #define VxDSuspendThread(ThreadHandle) \
  384. VxDCall1(VW32_SuspendThread, (DWORD) ThreadHandle)
  385. #define VxDResumeThread(ThreadHandle) \
  386. VxDCall1(VW32_ResumeThread, (DWORD) ThreadHandle)
  387. #define VW32DeliverPendingKernelAPCs() \
  388. VxDCall0(VW32_DeliverPendingKernelAPCs)
  389. // Registry Macros
  390. #define W32RegOpenKey(hKey,SubKey,lphKey) VxDCall3(W32_RegOpenKey,(ULONG)hKey,(ULONG)SubKey,(ULONG)lphKey)
  391. #define W32RegCreateKey(hKey,SubKey,lphKey) VxDCall3(W32_RegCreateKey,(ULONG)hKey,(ULONG)SubKey,(ULONG)lphKey)
  392. #define W32RegCloseKey(hKey) VxDCall1(W32_RegCloseKey,(ULONG)hKey)
  393. #define W32RegFlushKey(hKey) VxDCall1(W32_RegFlushKey,(ULONG)hKey)
  394. #define W32RegDeleteKey(hKey,SubKey) VxDCall2(W32_RegDeleteKey,(ULONG)hKey,(ULONG)SubKey)
  395. #define W32RegDeleteValue(hKey,ValName) VxDCall2(W32_RegDeleteValue,(ULONG)hKey,(ULONG)ValName)
  396. #define W32RegEnumKey(hKey,dwIdx,lpbBuf,dwcbBuf) VxDCall4(W32_RegEnumKey,(ULONG)hKey,dwIdx,(ULONG)lpbBuf,dwcbBuf)
  397. #define W32RegQueryValue(hKey,szSubKey,lpszVal,lpcbVal) VxDCall4(W32_RegQueryValue,(ULONG)hKey,(ULONG)szSubKey,(ULONG)lpszVal,(ULONG)lpcbVal)
  398. #define W32RegSetValue(hKey,szSubKey,dwType,lpszVal,cbVal) VxDCall5(W32_RegSetValue,(ULONG)hKey,(ULONG)szSubKey,dwType,(ULONG)lpszVal,cbVal)
  399. #define W32RegEnumValue(hKey,iVal,lpszVal,lpcbVal,lpdwRes,lpdwType,lpbData,lpcbData) \
  400. VxDCall8(W32_RegEnumValue,(ULONG)hKey,(ULONG)iVal,(ULONG)lpszVal,(ULONG)lpcbVal,(ULONG)lpdwRes,(ULONG)lpdwType,(ULONG)lpbData,(ULONG)lpcbData)
  401. #define W32RegQueryValueEx(hKey,lpszVal,lpdwRes,lpdwType,lpbData,lpcbData) \
  402. VxDCall6(W32_RegQueryValueEx,(ULONG)hKey,(ULONG)lpszVal,(ULONG)lpdwRes,(ULONG)lpdwType,(ULONG)lpbData,(ULONG)lpcbData)
  403. #define W32RegSetValueEx(hKey,lpszVal,dwRes,dwType,lpbData,lpcbData) \
  404. VxDCall6(W32_RegSetValueEx,(ULONG)hKey,(ULONG)lpszVal,dwRes,dwType,(ULONG)lpbData,(ULONG)lpcbData)
  405. #define W32RegQueryInfoKey( hKey, lpcSubKeys, lpcbMaxSubKeyLen, \
  406. lpcValues, lpcbMaxValueNameLen, lpcbMaxValueLen) \
  407. VxDCall6(W32_RegQueryInfoKey16, (ULONG)hKey,(ULONG) lpcSubKeys, \
  408. (ULONG) lpcbMaxSubKeyLen,(ULONG) lpcValues, \
  409. (ULONG) lpcbMaxValueNameLen,(ULONG) lpcbMaxValueLen)
  410. #define W32RegLoadKey(hKey, lpszSubKey, lpszFile) \
  411. VxDCall3(W32_RegLoadKey, (ULONG)hKey, (ULONG)lpszSubKey, (ULONG)lpszFile)
  412. #define W32RegUnLoadKey(hKey, lpszSubKey) \
  413. VxDCall2(W32_RegUnLoadKey, (ULONG)hKey, (ULONG)lpszSubKey)
  414. #define W32RegSaveKey(hKey, lpszFile, lpsa) \
  415. VxDCall3(W32_RegSaveKey, (ULONG)hKey, (ULONG)lpszFile, (ULONG)lpsa)
  416. #define W32RegRemapPreDefKey(hKey,hkRootKey) VxDCall2(W32_RegRemapPreDefKey,(ULONG)hKey,(ULONG)hkRootKey)
  417. #define W32RegQueryMultipleValues(hKey, val_list, num_vals, \
  418. lpValueBuf, ldwTotsize)\
  419. VxDCall5(W32_RegQueryMultipleValues, (ULONG)hKey, (ULONG)val_list, \
  420. (ULONG)num_vals, (ULONG)lpValueBuf, (ULONG)ldwTotsize)
  421. #define W32RegReplaceKey(hKey, lpszSubKey, lpszReplaceFile, lpszBackupFile) \
  422. VxDCall4(W32_RegReplaceKey, (ULONG)hKey, (ULONG)lpszSubKey, \
  423. (ULONG)lpszReplaceFile, (ULONG)lpszBackupFile)
  424. #define W32BoostFileCache() VxDCall0(W32_BoostFileCache)
  425. #define W32RegNotifyChangeKeyValue(hKey, fWatchSubtree, dwNotifyFilter, hEvent) \
  426. VxDCall4(W32_RegNotifyChangeKeyValue, (ULONG)hKey, (ULONG)fWatchSubtree, \
  427. (ULONG)dwNotifyFilter, (ULONG)hEvent)
  428. // low level APC function interface
  429. #define W32CleanAPCList() VxDCall0( VW32_CleanAPCList )
  430. #define W32QueueUserAPC( pfnRing3APC, dwParam, ThreadHandle ) \
  431. VxDCall3( VW32_QueueUserAPC, (ULONG)(pfnRing3APC), \
  432. (ULONG)(dwParam), (ULONG)(ThreadHandle) )
  433. #define W32QueueKernelAPC( pfnRing0APC, dwParam, ThreadHandle, ulFlags ) \
  434. VxDCall4( VW32_QueueKernelAPC, (ULONG)pfnRing0APC, dwParam, \
  435. (ULONG)ThreadHandle, ulFlags )
  436. #define W32QueueUserApcEx( pfnRing3APC, dwParam, ThreadHandle, R0RunDown ) \
  437. VxDCall4( VW32_QueueUserApcEx, (ULONG)(pfnRing3APC), \
  438. (ULONG)(dwParam), (ULONG)(ThreadHandle), (ULONG)(R0RunDown))
  439. // Thread priority adjusting
  440. #define AdjustThreadPriority( R0ThreadHandle, PriBoost ) \
  441. VxDCall2(VW32_AdjustThreadPri,R0ThreadHandle,(DWORD)(PriBoost))
  442. // Way to get to IFSMGR's Win32_DupHandle thru vwin32
  443. #define W32_IFSMGR_DupHandle(pdbSrc, pdbDst, phandle, flags, \
  444. bogusnetxattachhandle, pfSpecialNetxDup) \
  445. VxDCall6(VW32_IFSMGR_DupHandle, pdbSrc, pdbDst, phandle, \
  446. flags, bogusnetxattachhandle, pfSpecialNetxDup)
  447. // Close a ring0 file handle
  448. #define W32_IFSMGR_CloseHandle(handle) \
  449. VxDCall1(VW32_IFSMGR_CloseHandle, handle)
  450. // Prototype #define's for VWin32 functions
  451. #define VWIN32GetVersion() \
  452. ((USHORT)VxDCall0(VW32_GetVersion))
  453. #define FVW32GetPager(pR0_dwWaitSingleObject, \
  454. pR0_bSetPevt, \
  455. pR0_EnterCrst, pR0_LeaveCrst, \
  456. pR0_BlockOnID, pR0_SignalID, \
  457. pR0_OpenFile, pR0_CloseDosFileHandle, pmmfPageOut, \
  458. ppfmdArray) \
  459. VxDCall10(VW32_GetPager, pR0_dwWaitSingleObject, \
  460. pR0_bSetPevt, \
  461. pR0_EnterCrst, pR0_LeaveCrst, \
  462. pR0_BlockOnID, pR0_SignalID, \
  463. pR0_OpenFile, pR0_CloseDosFileHandle, pmmfPageOut, \
  464. ppfmdArray)
  465. #define PageModifyPermissions(page, npages, permand, permor) VxDCall4(W32_PageModifyPermissions, page, npages, permand, permor)
  466. #define ModifyPagePermission(R0Thread, lpvAddr, cbSize, fperAnd, fperOr) \
  467. VxDCall5(VW32_ModifyPagePermission, \
  468. (DWORD)R0Thread, \
  469. (DWORD)lpvAddr, \
  470. cbSize, \
  471. fperAnd, \
  472. fperOr)
  473. #define VWIN32QueryPage(R0Thread, lpvAddr, lpvBuffer, cbSize) \
  474. VxDCall4(VW32_QueryPage, \
  475. (DWORD)R0Thread, \
  476. (DWORD)lpvAddr, \
  477. (DWORD)lpvBuffer, \
  478. cbSize)
  479. #define VxDBlockForTermination() \
  480. VxDCall0(VW32_BlockForTermination)
  481. #define VxDTerminationHandler2(ptermdata) \
  482. VxDCall1(VW32_TerminationHandler2, (ULONG)(ptermdata))
  483. // Defines for Win32 VxD debug api support services
  484. #define VxDGetThreadContext(ptcb, pcontext) \
  485. VxDCall2(VW32_GetThreadContext, (DWORD)(ptcb), (DWORD)(pcontext))
  486. #define VxDSetThreadContext(ptcb, pcontext) \
  487. VxDCall2(VW32_SetThreadContext, (DWORD)(ptcb), (DWORD)(pcontext))
  488. #define VxDReadProcessMemory(ptcb, pBaseAddress, pBuffer, cbRead, pcbRead) \
  489. VxDCall5(VW32_ReadProcessMemory, (ptcb), \
  490. (ULONG)(pBaseAddress), (ULONG)(pBuffer), (cbRead), \
  491. (ULONG)(pcbRead))
  492. #define VxDWriteProcessMemory(ptcb, pBaseAddress, pBuffer, cbWrite, pcbWritten)\
  493. VxDCall5(VW32_WriteProcessMemory, (ptcb), \
  494. (ULONG)(pBaseAddress), (ULONG)(pBuffer), (cbWrite), \
  495. (ULONG)(pcbWritten))
  496. // Defines for floating point Cr0 flag support (EM, MP)
  497. #define GetCR0State(ptcb) \
  498. VxDCall1(VW32_GetCR0State, (ptcb))
  499. #define SetCR0State(ptcb, state) \
  500. VxDCall2(VW32_SetCR0State, (ptcb), (state))
  501. #define WaitCrst( pcrst ) VxDCall1( VW32_WaitCrst, (DWORD)pcrst )
  502. #define WakeCrst( pcrst ) VxDCall1( VW32_WakeCrst, (DWORD)pcrst )
  503. #define UndoCrst( pcrst ) VxDCall1( VW32_UndoCrst, (DWORD)pcrst )
  504. // support for DeviceIOControl API; go to ring0 with this
  505. #define DeviceIOCtl(VxdDDB, dwIoControlCode, lpvInBuffer, \
  506. cbInBuffer, lpvOutBuffer, cbOutBuffer, \
  507. lpcbBytesReturned, lpoOverlapped, hDevice,\
  508. ppdb, lpDDBName) \
  509. VxDCall11(VW32_DeviceIOCtl, (DWORD) VxdDDB, \
  510. (DWORD) dwIoControlCode, (DWORD) lpvInBuffer, \
  511. (DWORD) cbInBuffer, (DWORD) lpvOutBuffer, \
  512. (DWORD) cbOutBuffer, (DWORD) lpcbBytesReturned, \
  513. (DWORD) lpoOverlapped, (DWORD)hDevice,\
  514. (DWORD) ppdb, lpDDBName)
  515. #define SetWin32Priority( r0ThHandle, PriVal ) \
  516. VxDCall2( VW32_SetWin32Priority, (DWORD)r0ThHandle, (DWORD)PriVal )
  517. #define SetWin32PriorityClass( ThreadArray, NumOfElements ) \
  518. VxDCall2( VW32_SetWin32PriorityClass, (DWORD)(ThreadArray), (DWORD)(NumOfElements) )
  519. #define AttachThreadToGroup( r0ThToAttach, r0ThInGroup ) \
  520. VxDCall2( VW32_AttachThreadToGroup, (DWORD)r0ThToAttach, (DWORD) r0ThInGroup )
  521. #define VW32BlockThread( Timeout ) \
  522. VxDCall1( VW32_BlockThread, Timeout)
  523. #define VW32BlockThreadEx( Timeout, Alertable ) \
  524. VxDCall2( VW32_BlockThreadEx, Timeout, Alertable )
  525. #define ReleaseSyncObj( pSyncObj, bAbandoned ) \
  526. VxDCall2( VW32_ReleaseSyncObject, (DWORD)pSyncObj, bAbandoned )
  527. #ifndef WOW
  528. #define Ring0ThreadStart( R0TParmBlk ) VxDCall1( VW32_Ring0ThreadStart, (DWORD)R0TParmBlk )
  529. #endif // ndef WOW
  530. #define EnableAPCService( KSvcR0Handle ) VxDCall1( VW32_EnableAPCService, KSvcR0Handle )
  531. #define VW32FaultPop(pcontext, ulExceptionNumber, fDebug) \
  532. VxDCall3(VW32_FaultPop, (DWORD)pcontext, ulExceptionNumber, fDebug)
  533. #define VW32ForceCrsts() \
  534. VxDCall0(VW32_ForceCrsts)
  535. #define VW32RestoreCrsts(h, ptdb) \
  536. VxDCall2(VW32_RestoreCrsts, (DWORD)(h), (DWORD)(ptdb))
  537. #define VW32FreezeAllThreads() \
  538. VxDCall0(VW32_FreezeAllThreads)
  539. #define VW32UnFreezeAllThreads() \
  540. VxDCall0(VW32_UnFreezeAllThreads)
  541. #define VW32ForceLeaveCrst(pcrst, ptdb) \
  542. VxDCall2(VW32_ForceLeaveCrst, (DWORD)pcrst, (DWORD)ptdb)
  543. #define VW32ForceEnterCrst(pcrst, ptdb, recur) \
  544. VxDCall3(VW32_ForceEnterCrst, (DWORD)pcrst, (DWORD)ptdb, (DWORD)recur)
  545. extern Get_FP_Instruction_Size(ULONG, ULONG);
  546. #define AttachConappThreadToVM( R0ThreadHandle, hVM ) \
  547. VxDCall2( VW32_AttachConappThreadToVM, (DWORD)R0ThreadHandle, (DWORD)hVM )
  548. #define ActiveTimeBiasSet() VxDCall0(VW32_ActiveTimeBiasSet)
  549. #define VW32SetDeviceFocus() \
  550. VxDCall0(VW32_SetDeviceFocus)
  551. #define VW32UnFreezeThread(ptcb) \
  552. VxDCall1(VW32_UnFreezeThread, (DWORD)(ptcb))
  553. #define VW32SendKernelShutdown() \
  554. VxDCall0(VW32_SendKernelShutdown)
  555. #define VW32RestoreSysCrst(pcrst, ptdb, count) \
  556. VxDCall3(VW32_RestoreSysCrst, (DWORD)pcrst, (DWORD)ptdb, (DWORD)count)
  557. #define VW32AddSysCrst(plcrst, order) \
  558. VxDCall2(VW32_AddSysCrst, (DWORD)(plcrst), (DWORD)(order))
  559. #define VW32SetTimeOut(pfn, ms, data) \
  560. VxDCall3(VW32_SetTimeOut, (DWORD)(pfn), (DWORD)(ms), (DWORD)(data))
  561. #define VW32CancelTimeOut(hto) \
  562. VxDCall1(VW32_CancelTimeOut, (DWORD)(hto))
  563. #define VW32ThrowException(type) \
  564. VxDCall1(VW32_ThrowException, (DWORD)(type))
  565. #define VW32VMMSystemControl(dwControlMsg, dwEDXParam, dwESIParam, dwEDIParam) \
  566. VxDCall4(VW32_VMM_SystemControl, (DWORD)(dwControlMsg), (DWORD)(dwEDXParam), (DWORD)(dwESIParam), (DWORD)(dwEDIParam))
  567. #define VW32SetTimer(lpTimerDb, lpDueTime, lPeriod, pfnCompletion, lpCompletionArg, fResume) \
  568. VxDCall6(VW32_SetTimer, (DWORD)(lpTimerDb), (DWORD)(lpDueTime), (DWORD)(lPeriod), (DWORD)(pfnCompletion), (DWORD)(lpCompletionArg), (DWORD)(fResume))
  569. #define VW32CancelTimer(lpTimerDb) \
  570. VxDCall1(VW32_CancelTimer, (DWORD)(lpTimerDb))
  571. #define VW32GetNextResumeDueTime(lpFileTime) \
  572. VxDCall1(VW32_GetNextResumeDueTime, (DWORD)(lpFileTime))
  573. #define VW32BiosSupportsResumeTimers() \
  574. VxDCall0(VW32_BiosSupportsResumeTimers)
  575. #define VW32SetResumeTimer(lpSystemTime) \
  576. VxDCall1(VW32_SetResumeTimer, (DWORD)(lpSystemTime))
  577. #define VW32DisposeObject(pobj) \
  578. VxDCall1(VW32_DisposeObject, (DWORD)(pobj))
  579. #define VW32DuplicateObject(pobj, ppdbSrc, ppdbDest) \
  580. VxDCall3(VW32_DuplicateObject, (DWORD)(pobj), (DWORD)(ppdbSrc), (DWORD)(ppdbDest))
  581. #define VW32InterlockedAdd386(paddend, quantity) \
  582. VxDCall2(VW32_InterlockedAdd386,(DWORD)(paddend),(DWORD)(quantity))
  583. #define VW32InterlockedCmpxchg386(pdest, exchange, comperand) \
  584. VxDCall3(VW32_InterlockedCmpxchg386,(DWORD)(pdest),(DWORD)(exchange),(DWORD)(comperand))
  585. #define VW32InterlockedXadd386(paddend, exchange) \
  586. VxDCall2(VW32_InterlockedXadd386,(DWORD)(paddend),(DWORD)(exchange))
  587. #define VW32UnuseTdbx(ptdbx) \
  588. VxDCall1(VW32_UnuseTdbx, (DWORD)(ptdbx))
  589. #define VW32WaitSingleObject(pObj, dwTimeout, fAlertable) \
  590. VxDCall3(VW32_WaitSingleObject, (DWORD)(pObj),(dwTimeout),(fAlertable))
  591. #define VW32WaitMultipleObjects(cObj, paObj, dwTimeout, dwFlags, fAlertable) \
  592. VxDCall5(VW32_WaitMultipleObjects, (cObj), (DWORD)(paObj), (dwTimeout), (dwFlags), (fAlertable))
  593. #define VW32ReleaseSem(psem, cRel, plPrev) \
  594. VxDCall3(VW32_ReleaseSem, (DWORD)(psem), (DWORD)(cRel), (DWORD)(plPrev))
  595. #define VW32ReleaseMutex(pmutx) \
  596. VxDCall1(VW32_ReleaseMutex, (DWORD)(pmutx))
  597. #define VW32SetEvent(pevt) \
  598. VxDCall1(VW32_SetEvent, (DWORD)(pevt))
  599. #define VW32PulseEvent(pevt) \
  600. VxDCall1(VW32_PulseEvent, (DWORD)(pevt))
  601. #define VW32ResetEvent(pevt) \
  602. VxDCall1(VW32_ResetEvent, (DWORD)(pevt))
  603. #define VW32DisposeTimerR3Apc(ptimerr3apc) \
  604. VxDCall1(VW32_DisposeTimerR3Apc, (DWORD)(ptimerr3apc))
  605. // Send a fault to kernel debugger
  606. #define DEBUG_Win32Fault(faultnum, errorcd, pcontext) \
  607. VxDCall3(DEBUG_WIN32_FAULT, (faultnum), (errorcd), (ULONG)(pcontext))
  608. #define REBOOT_Win32Init(pfnTermDialogBox, thcbFault) \
  609. VxDCall2(REBOOT_WIN32_INIT,(DWORD)(pfnTermDialogBox),(DWORD)(thcbFault))
  610. #define REBOOT_ChangePhase(bPhase, dwData) \
  611. VxDCall2(REBOOT_CHANGE_PHASE,(DWORD)(bPhase),(DWORD)(dwData))
  612. // VCOND interface
  613. #define VCOND_GetLaunchInfo(conID, cmdline, curdir, flag) VxDCall4(VCOND_GETLAUNCHINFO, conID, (ULONG)cmdline, (ULONG)curdir, (ULONG)flag)
  614. #define VCOND_EmitString(conID, pString, len) VxDCall3(VCOND_EMITSTRING, conID, (ULONG)pString, len)
  615. #define VCOND_CreateConsole(hvm, pConsole) VxDCall2(VCOND_CREATECONSOLE, (ULONG) hvm, (ULONG) pConsole)
  616. #define VCOND_ReadCharInfo(conID, bufptr, len, coord) VxDCall4(VCOND_READCHARINFO, conID, (ULONG)bufptr, len, (ULONG)coord)
  617. #define VCOND_ReadChars(conID, bufptr, coord, len) VxDCall4(VCOND_READCHARS, conID, (ULONG)bufptr, (ULONG)coord, len)
  618. #define VCOND_ReadAttrs(conID, bufptr, coord, len, wantbytes) VxDCall5(VCOND_READATTRS, conID, (ULONG)bufptr, (ULONG)coord, len, wantbytes)
  619. #define VCOND_WriteCharInfo(conID, bufptr, len, coord) VxDCall4(VCOND_WRITECHARINFO, conID, (ULONG)bufptr, len, (ULONG)coord)
  620. #define VCOND_WriteChars(conID, bufptr, coord, len) VxDCall4(VCOND_WRITECHARS, conID, (ULONG)bufptr, (ULONG)coord, len)
  621. #define VCOND_WriteAttrs(conID, bufptr, coord, len, wantbytes) VxDCall5(VCOND_WRITEATTRS, conID, (ULONG)bufptr, (ULONG)coord, len, wantbytes)
  622. #define VCOND_FillAttrs(conID, attr, coord, len) VxDCall4(VCOND_FILLATTRS, conID, (ULONG)attr, (ULONG)coord, len)
  623. #define VCOND_GetCurPos(conID) VxDCall1(VCOND_GETCURPOS, conID)
  624. #define VCOND_GetCurAttr(conID) VxDCall1(VCOND_GETCURATTR, conID)
  625. #define VCOND_SetCurPos(conID, coord) VxDCall2(VCOND_SETCURPOS, conID, (ULONG)coord)
  626. #define VCOND_SetCurAttr(conID, attr) VxDCall2(VCOND_SETCURATTR, conID, (ULONG)attr)
  627. #define VCOND_SetInputMode(conID, mode) VxDCall2(VCOND_SETINPUTMODE, conID, (ULONG)mode)
  628. #define VCOND_GetInputMode(conID) VxDCall1(VCOND_GETINPUTMODE, conID)
  629. #define VCOND_ReadInput(conID, lpBuffer, nEvents, bFile) VxDCall4(VCOND_READINPUT, conID, (ULONG)lpBuffer, (ULONG)nEvents, (ULONG)bFile)
  630. #define VCOND_PeekInput(conID, lpBuffer, nEvents, bFile) VxDCall4(VCOND_PEEKINPUT, conID, (ULONG)lpBuffer, (ULONG)nEvents, (ULONG)bFile)
  631. #define VCOND_WriteInput(conID, lpBuffer, nEvents) VxDCall3(VCOND_WRITEINPUT, conID, (ULONG)lpBuffer, (ULONG)nEvents)
  632. #define VCOND_AttachProcess(conID) VxDCall1(VCOND_ATTACHPROCESS, conID)
  633. #define VCOND_DetachProcess(conID, exitCode) VxDCall2(VCOND_DETACHPROCESS, conID, ( (DWORD)(exitCode) ) & 0xff)
  634. #define VCOND_DetachProcess_NoEC(conID) VxDCall2(VCOND_DETACHPROCESS, conID, VCD_NOEXITCODE)
  635. #define VCOND_DeleteConsole(conID) VxDCall1(VCOND_DELETECONSOLE, conID)
  636. #define VCOND_GetNumberOfInputEvents(conID) VxDCall1(VCOND_GETNUMBEROFINPUTEVENTS, conID)
  637. #define VCOND_PostMessage(hvm, msg, wparam) VxDCall3(VCOND_POSTMESSAGE, (ULONG)hvm, (ULONG)msg, (ULONG)wparam)
  638. #define VCOND_InitAPCs(nAPCs, ConAPCs, szPath) VxDCall3(VCOND_INITAPCS, nAPCs, (ULONG)ConAPCs , (ULONG)szPath)
  639. #define VCOND_GetScreenSize(conID) VxDCall1(VCOND_GETSCREENSIZE, conID)
  640. #define VCOND_FillChars(conID, c, coord, len) VxDCall4(VCOND_FILLCHARS, conID, (ULONG)c, (ULONG)coord, len)
  641. #define VCOND_FlushInput(conID) VxDCall1(VCOND_FLUSHINPUT, conID)
  642. #define VCOND_SetAttribute(conID, attr) VxDCall2(VCOND_SETATTRIBUTE, conID, (ULONG)attr)
  643. #define VCOND_GetButtonCount() VxDCall0(VCOND_GETBUTTONCOUNT)
  644. #define VCOND_SetScreenSize(conID, cSize) VxDCall2(VCOND_SETSCREENSIZE, conID, (ULONG)cSize)
  645. #define VCOND_MatchScreenSize(conID, cSize) VxDCall2(VCOND_MATCHSCREENSIZE, conID, (ULONG)cSize)
  646. #define VCOND_WaitForNewConsole() VxDCall0(VCOND_WAITFORNEWCONSOLE)
  647. #define VCOND_UnblockRing3WithFailure() VxDCall0(VCOND_UNBLOCKRING3WITHFAILURE)
  648. //#define VCOND_Spawn(conID, lpszImageName, lpszCurrentDirectory,
  649. // lpszCommandLine, lpszEnvironment, lpdwExitCode
  650. // (line too long...)
  651. #define VCOND_Spawn(a1, a2, a3, a4, a5, a6) \
  652. VxDCall6(VCOND_SPAWN, (ULONG) a1, (ULONG) a2, \
  653. (ULONG) a3, (ULONG) a4, (ULONG) a5, (ULONG) a6)
  654. #define VCOND_GetEnvironment(conID, pEnv, len) VxDCall3(VCOND_GETENVIRONMENT, conID, (ULONG) pEnv, len)
  655. #define VCOND_GrbRepaintRect(conID, lpConsoleWindow) VxDCall2(VCOND_GRBREPAINTRECT, conID, (ULONG) lpConsoleWindow)
  656. #define VCOND_GrbMoveRect(conID, psrSrcRect, cDestOrg) VxDCall3(VCOND_GRBMOVERECT, conID, (ULONG) psrSrcRect, (ULONG) cDestOrg)
  657. #define VCOND_GrbSetWindowSize(conID, dwSize) VxDCall2(VCOND_GRBSETWINDOWSIZE, conID, dwSize)
  658. #define VCOND_GrbSetWindowOrg(conID, dwOrg) VxDCall2(VCOND_GRBSETWINDOWORG, conID, dwOrg)
  659. #define VCOND_GrbSetScreenSize(conID, dwSize) VxDCall2(VCOND_GRBSETSCREENSIZE, conID, dwSize)
  660. #define VCOND_GrbSetCursorPosition(conID, dwLoc) VxDCall2(VCOND_GRBSETCURSORPOSITION, conID, (ULONG) dwLoc)
  661. #define VCOND_GrbSetCursorInfo(conID, dwInfo) VxDCall2(VCOND_GRBSETCURSORINFO, conID, dwInfo)
  662. #define VCOND_GrbNotifyWOA(conID) VxDCall1(VCOND_GRBNOTIFYWOA, conID)
  663. #define VCOND_GrbSync(conID) VxDCall1(VCOND_GRBSYNC, conID)
  664. #define VCOND_GrbTerminate(conID) VxDCall1(VCOND_GRBTERMINATE, conID)
  665. #define VCOND_DP32_Create(pExename, pCmdline, pCurdir, pStdxInfo, pspseg) \
  666. VxDCall5(VCOND_DP32_CREATE, (ULONG) pExename, \
  667. (ULONG) pCmdline, (ULONG) pCurdir, (ULONG) pStdxInfo, (ULONG) pspseg)
  668. #define VCOND_DP32_Getwork(pRedir) VxDCall1(VCOND_DP32_GETWORK, (ULONG) pRedir)
  669. #define VCOND_DP32_Terminate(pRedir) VxDCall1(VCOND_DP32_TERMINATE, (ULONG) pRedir)
  670. #define VCOND_DP32_Waitwork(pRedir) VxDCall1(VCOND_DP32_WAITWORK, (ULONG) pRedir)
  671. #define VCOND_RedirectionComplete(conID, redirFlags) VxDCall2(VCOND_REDIRECTIONCOMPLETE, conID, redirFlags)
  672. #define VCOND_DP32_Destroy(pRedir) VxDCall1(VCOND_DP32_DESTROY, (ULONG) pRedir)
  673. #ifdef BILINGUAL_CONSOLE
  674. #define VCOND_GetCP(conID) VxDCall1(VCOND_GETCP, conID)
  675. #endif
  676. #ifdef WOW
  677. #define MEOWLoadLibrary(pszLibraryName) VxDCall1(MEOW_LoadLibrary, (ULONG)pszLibraryName)
  678. #define MEOWGetProcAddress(hModule, pszFunctionName, dwOrdinal) VxDCall3(MEOW_GetProcAddress, (ULONG)hModule, (ULONG)pszFunctionName, (ULONG)dwOrdinal)
  679. #define MEOWFreeLibrary(hModule) VxDCall1(MEOW_FreeLibrary, (ULONG)hModule)
  680. #endif // def WOW