Leaked source code of windows server 2003
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.

1123 lines
41 KiB

  1. //TODO: from gre\pdevobj.hxx
  2. #ifndef DRIVER_NOT_CAPABLE_DDRAW
  3. #define DRIVER_NOT_CAPABLE_DDRAW 2
  4. #endif
  5. #ifndef DRIVER_NOT_CAPABLE_D3D
  6. #define DRIVER_NOT_CAPABLE_D3D 4
  7. #endif
  8. #ifndef W32PID
  9. #define W32PID ULONG
  10. #endif
  11. //
  12. // The functions index which dxg.sys exports to win32k.sys
  13. //
  14. NTSTATUS
  15. DxDdStartupDxGraphics(
  16. ULONG cjEng,
  17. DRVENABLEDATA *pdedEng,
  18. ULONG cjDxg,
  19. DRVENABLEDATA *pdedDxg,
  20. DWORD *pdwDirectContext,
  21. PEPROCESS pepSession
  22. );
  23. NTSTATUS
  24. DxDdCleanupDxGraphics(
  25. VOID
  26. );
  27. typedef NTSTATUS (*PFN_StartupDxGraphics)(ULONG,DRVENABLEDATA*,ULONG,DRVENABLEDATA*,DWORD*,PEPROCESS);
  28. typedef NTSTATUS (*PFN_CleanupDxGraphics)(VOID);
  29. #define INDEX_DxDxgGenericThunk 0
  30. #define INDEX_DxD3dContextCreate 1
  31. #define INDEX_DxD3dContextDestroy 2
  32. #define INDEX_DxD3dContextDestroyAll 3
  33. #define INDEX_DxD3dValidateTextureStageState 4
  34. #define INDEX_DxD3dDrawPrimitives2 5
  35. #define INDEX_DxDdGetDriverState 6
  36. #define INDEX_DxDdAddAttachedSurface 7
  37. #define INDEX_DxDdAlphaBlt 8
  38. #define INDEX_DxDdAttachSurface 9
  39. #define INDEX_DxDdBeginMoCompFrame 10
  40. #define INDEX_DxDdBlt 11
  41. #define INDEX_DxDdCanCreateSurface 12
  42. #define INDEX_DxDdCanCreateD3DBuffer 13
  43. #define INDEX_DxDdColorControl 14
  44. #define INDEX_DxDdCreateDirectDrawObject 15
  45. #define INDEX_DxDdCreateSurface 16
  46. #define INDEX_DxDdCreateD3DBuffer 17
  47. #define INDEX_DxDdCreateMoComp 18
  48. #define INDEX_DxDdCreateSurfaceObject 19
  49. #define INDEX_DxDdDeleteDirectDrawObject 20
  50. #define INDEX_DxDdDeleteSurfaceObject 21
  51. #define INDEX_DxDdDestroyMoComp 22
  52. #define INDEX_DxDdDestroySurface 23
  53. #define INDEX_DxDdDestroyD3DBuffer 24
  54. #define INDEX_DxDdEndMoCompFrame 25
  55. #define INDEX_DxDdFlip 26
  56. #define INDEX_DxDdFlipToGDISurface 27
  57. #define INDEX_DxDdGetAvailDriverMemory 28
  58. #define INDEX_DxDdGetBltStatus 29
  59. #define INDEX_DxDdGetDC 30
  60. #define INDEX_DxDdGetDriverInfo 31
  61. #define INDEX_DxDdGetDxHandle 32
  62. #define INDEX_DxDdGetFlipStatus 33
  63. #define INDEX_DxDdGetInternalMoCompInfo 34
  64. #define INDEX_DxDdGetMoCompBuffInfo 35
  65. #define INDEX_DxDdGetMoCompGuids 36
  66. #define INDEX_DxDdGetMoCompFormats 37
  67. #define INDEX_DxDdGetScanLine 38
  68. #define INDEX_DxDdLock 39
  69. #define INDEX_DxDdLockD3D 40
  70. #define INDEX_DxDdQueryDirectDrawObject 41
  71. #define INDEX_DxDdQueryMoCompStatus 42
  72. #define INDEX_DxDdReenableDirectDrawObject 43
  73. #define INDEX_DxDdReleaseDC 44
  74. #define INDEX_DxDdRenderMoComp 45
  75. #define INDEX_DxDdResetVisrgn 46
  76. #define INDEX_DxDdSetColorKey 47
  77. #define INDEX_DxDdSetExclusiveMode 48
  78. #define INDEX_DxDdSetGammaRamp 49
  79. #define INDEX_DxDdCreateSurfaceEx 50
  80. #define INDEX_DxDdSetOverlayPosition 51
  81. #define INDEX_DxDdUnattachSurface 52
  82. #define INDEX_DxDdUnlock 53
  83. #define INDEX_DxDdUnlockD3D 54
  84. #define INDEX_DxDdUpdateOverlay 55
  85. #define INDEX_DxDdWaitForVerticalBlank 56
  86. #define INDEX_DxDvpCanCreateVideoPort 57
  87. #define INDEX_DxDvpColorControl 58
  88. #define INDEX_DxDvpCreateVideoPort 59
  89. #define INDEX_DxDvpDestroyVideoPort 60
  90. #define INDEX_DxDvpFlipVideoPort 61
  91. #define INDEX_DxDvpGetVideoPortBandwidth 62
  92. #define INDEX_DxDvpGetVideoPortField 63
  93. #define INDEX_DxDvpGetVideoPortFlipStatus 64
  94. #define INDEX_DxDvpGetVideoPortInputFormats 65
  95. #define INDEX_DxDvpGetVideoPortLine 66
  96. #define INDEX_DxDvpGetVideoPortOutputFormats 67
  97. #define INDEX_DxDvpGetVideoPortConnectInfo 68
  98. #define INDEX_DxDvpGetVideoSignalStatus 69
  99. #define INDEX_DxDvpUpdateVideoPort 70
  100. #define INDEX_DxDvpWaitForVideoPortSync 71
  101. #define INDEX_DxDvpAcquireNotification 72
  102. #define INDEX_DxDvpReleaseNotification 73
  103. #define INDEX_DxDdHeapVidMemAllocAligned 74
  104. #define INDEX_DxDdHeapVidMemFree 75
  105. #define INDEX_DxDdEnableDirectDraw 76
  106. #define INDEX_DxDdDisableDirectDraw 77
  107. #define INDEX_DxDdSuspendDirectDraw 78
  108. #define INDEX_DxDdResumeDirectDraw 79
  109. #define INDEX_DxDdDynamicModeChange 80
  110. #define INDEX_DxDdCloseProcess 81
  111. #define INDEX_DxDdGetDirectDrawBounds 82
  112. #define INDEX_DxDdEnableDirectDrawRedirection 83
  113. #define INDEX_DxDdAllocPrivateUserMem 84
  114. #define INDEX_DxDdFreePrivateUserMem 85
  115. #define INDEX_DxDdLockDirectDrawSurface 86
  116. #define INDEX_DxDdUnlockDirectDrawSurface 87
  117. #define INDEX_DxDdSetAccelLevel 88
  118. #define INDEX_DxDdGetSurfaceLock 89
  119. #define INDEX_DxDdEnumLockedSurfaceRect 90
  120. #define INDEX_DxDdIoctl 91
  121. //
  122. // Prototype definition
  123. //
  124. DWORD APIENTRY DxDxgGenericThunk(
  125. IN ULONG_PTR ulIndex,
  126. IN ULONG_PTR ulHandle,
  127. IN OUT SIZE_T *pdwSizeOfPtr1,
  128. IN OUT PVOID pvPtr1,
  129. IN OUT SIZE_T *pdwSizeOfPtr2,
  130. IN OUT PVOID pvPtr2);
  131. DWORD APIENTRY DxDdAddAttachedSurface(
  132. IN HANDLE hSurface,
  133. IN HANDLE hSurfaceAttached,
  134. IN OUT PDD_ADDATTACHEDSURFACEDATA puAddAttachedSurfaceData);
  135. BOOL APIENTRY DxDdAttachSurface(
  136. IN HANDLE hSurfaceFrom,
  137. IN HANDLE hSurfaceTo);
  138. DWORD APIENTRY DxDdBlt(
  139. IN HANDLE hSurfaceDest,
  140. IN HANDLE hSurfaceSrc,
  141. IN OUT PDD_BLTDATA puBltData);
  142. DWORD APIENTRY DxDdCanCreateSurface(
  143. IN HANDLE hDirectDraw,
  144. IN OUT PDD_CANCREATESURFACEDATA puCanCreateSurfaceData);
  145. DWORD APIENTRY DxDdColorControl(
  146. IN HANDLE hSurface,
  147. IN OUT PDD_COLORCONTROLDATA puColorControlData);
  148. HANDLE APIENTRY DxDdCreateDirectDrawObject(
  149. IN HDC hdc);
  150. DWORD APIENTRY DxDdCreateSurface(
  151. IN HANDLE hDirectDraw,
  152. IN HANDLE* hSurface,
  153. IN OUT DDSURFACEDESC* puSurfaceDescription,
  154. IN OUT DD_SURFACE_GLOBAL* puSurfaceGlobalData,
  155. IN OUT DD_SURFACE_LOCAL* puSurfaceLocalData,
  156. IN OUT DD_SURFACE_MORE* puSurfaceMoreData,
  157. IN OUT DD_CREATESURFACEDATA* puCreateSurfaceData,
  158. OUT HANDLE* puhSurface);
  159. HANDLE APIENTRY DxDdCreateSurfaceObject(
  160. IN HANDLE hDirectDrawLocal,
  161. IN HANDLE hSurface,
  162. IN PDD_SURFACE_LOCAL puSurfaceLocal,
  163. IN PDD_SURFACE_MORE puSurfaceMore,
  164. IN PDD_SURFACE_GLOBAL puSurfaceGlobal,
  165. IN BOOL bComplete);
  166. BOOL APIENTRY DxDdDeleteSurfaceObject(
  167. IN HANDLE hSurface);
  168. BOOL APIENTRY DxDdDeleteDirectDrawObject(
  169. IN HANDLE hDirectDrawLocal);
  170. DWORD APIENTRY DxDdDestroySurface(
  171. IN HANDLE hSurface,
  172. IN BOOL bRealDestroy);
  173. DWORD APIENTRY DxDdFlip(
  174. IN HANDLE hSurfaceCurrent,
  175. IN HANDLE hSurfaceTarget,
  176. IN HANDLE hSurfaceCurrentLeft,
  177. IN HANDLE hSurfaceTargetLeft,
  178. IN OUT PDD_FLIPDATA puFlipData);
  179. DWORD APIENTRY DxDdGetAvailDriverMemory(
  180. IN HANDLE hDirectDraw,
  181. IN OUT PDD_GETAVAILDRIVERMEMORYDATA puGetAvailDriverMemoryData);
  182. DWORD APIENTRY DxDdGetBltStatus(
  183. IN HANDLE hSurface,
  184. IN OUT PDD_GETBLTSTATUSDATA puGetBltStatusData);
  185. HDC APIENTRY DxDdGetDC(
  186. IN HANDLE hSurface,
  187. IN PALETTEENTRY* puColorTable);
  188. DWORD APIENTRY DxDdGetDriverInfo(
  189. IN HANDLE hDirectDraw,
  190. IN OUT PDD_GETDRIVERINFODATA puGetDriverInfoData);
  191. DWORD APIENTRY DxDdGetFlipStatus(
  192. IN HANDLE hSurface,
  193. IN OUT PDD_GETFLIPSTATUSDATA puGetFlipStatusData);
  194. DWORD APIENTRY DxDdGetScanLine(
  195. IN HANDLE hDirectDraw,
  196. IN OUT PDD_GETSCANLINEDATA puGetScanLineData);
  197. DWORD APIENTRY DxDdSetExclusiveMode(
  198. IN HANDLE hDirectDraw,
  199. IN OUT PDD_SETEXCLUSIVEMODEDATA puSetExclusiveModeData);
  200. DWORD APIENTRY DxDdFlipToGDISurface(
  201. IN HANDLE hDirectDraw,
  202. IN OUT PDD_FLIPTOGDISURFACEDATA puFlipToGDISurfaceData);
  203. DWORD APIENTRY DxDdLock(
  204. IN HANDLE hSurface,
  205. IN OUT PDD_LOCKDATA puLockData,
  206. IN HDC hdcClip);
  207. BOOL APIENTRY DxDdQueryDirectDrawObject(
  208. IN HANDLE,
  209. IN OUT PDD_HALINFO,
  210. IN OUT DWORD*,
  211. IN OUT LPD3DNTHAL_CALLBACKS,
  212. IN OUT LPD3DNTHAL_GLOBALDRIVERDATA,
  213. IN OUT PDD_D3DBUFCALLBACKS,
  214. IN OUT LPDDSURFACEDESC,
  215. IN OUT DWORD*,
  216. IN OUT VIDEOMEMORY*,
  217. IN OUT DWORD*,
  218. IN OUT DWORD*);
  219. BOOL APIENTRY DxDdReenableDirectDrawObject(
  220. IN HANDLE hDirectDrawLocal,
  221. IN OUT BOOL* pubNewMode);
  222. BOOL APIENTRY DxDdReleaseDC(
  223. IN HANDLE hSurface);
  224. BOOL APIENTRY DxDdResetVisrgn(
  225. IN HANDLE hSurface,
  226. IN HWND hwnd);
  227. DWORD APIENTRY DxDdSetColorKey(
  228. IN HANDLE hSurface,
  229. IN OUT PDD_SETCOLORKEYDATA puSetColorKeyData);
  230. DWORD APIENTRY DxDdSetOverlayPosition(
  231. IN HANDLE hSurfaceSource,
  232. IN HANDLE hSurfaceDestination,
  233. IN OUT PDD_SETOVERLAYPOSITIONDATA puSetOverlayPositionData);
  234. VOID APIENTRY DxDdUnattachSurface(
  235. IN HANDLE hSurface,
  236. IN HANDLE hSurfaceAttached);
  237. DWORD APIENTRY DxDdUnlock(
  238. IN HANDLE hSurface,
  239. IN OUT PDD_UNLOCKDATA puUnlockData);
  240. DWORD APIENTRY DxDdUpdateOverlay(
  241. IN HANDLE hSurfaceDestination,
  242. IN HANDLE hSurfaceSource,
  243. IN OUT PDD_UPDATEOVERLAYDATA puUpdateOverlayData);
  244. DWORD APIENTRY DxDdWaitForVerticalBlank(
  245. IN HANDLE hDirectDraw,
  246. IN OUT PDD_WAITFORVERTICALBLANKDATA puWaitForVerticalBlankData);
  247. HANDLE APIENTRY DxDdGetDxHandle(
  248. IN HANDLE hDirectDraw,
  249. IN HANDLE hSurface,
  250. IN BOOL bRelease);
  251. BOOL APIENTRY DxDdSetGammaRamp(
  252. IN HANDLE hDirectDraw,
  253. IN HDC hdc,
  254. IN LPVOID lpGammaRamp);
  255. DWORD APIENTRY DxDdLockD3D(
  256. IN HANDLE hSurface,
  257. IN OUT PDD_LOCKDATA puLockData);
  258. DWORD APIENTRY DxDdUnlockD3D(
  259. IN HANDLE hSurface,
  260. IN OUT PDD_UNLOCKDATA puUnlockData);
  261. DWORD APIENTRY DxDdCreateD3DBuffer(
  262. IN HANDLE hDirectDraw,
  263. IN OUT HANDLE* hSurface,
  264. IN OUT DDSURFACEDESC* puSurfaceDescription,
  265. IN OUT DD_SURFACE_GLOBAL* puSurfaceGlobalData,
  266. IN OUT DD_SURFACE_LOCAL* puSurfaceLocalData,
  267. IN OUT DD_SURFACE_MORE* puSurfaceMoreData,
  268. IN OUT DD_CREATESURFACEDATA* puCreateSurfaceData,
  269. IN OUT HANDLE* puhSurface);
  270. DWORD APIENTRY DxDdCanCreateD3DBuffer(
  271. IN HANDLE hDirectDraw,
  272. IN OUT PDD_CANCREATESURFACEDATA puCanCreateSurfaceData);
  273. DWORD APIENTRY DxDdDestroyD3DBuffer(
  274. IN HANDLE hSurface);
  275. DWORD APIENTRY DxD3dContextCreate(
  276. IN HANDLE hDirectDrawLocal,
  277. IN HANDLE hSurfColor,
  278. IN HANDLE hSurfZ,
  279. IN OUT D3DNTHAL_CONTEXTCREATEI *pdcci);
  280. DWORD APIENTRY DxD3dContextDestroy(
  281. IN LPD3DNTHAL_CONTEXTDESTROYDATA);
  282. DWORD APIENTRY DxD3dContextDestroyAll(
  283. OUT LPD3DNTHAL_CONTEXTDESTROYALLDATA pdcdad);
  284. DWORD APIENTRY DxD3dValidateTextureStageState(
  285. IN OUT LPD3DNTHAL_VALIDATETEXTURESTAGESTATEDATA pData);
  286. DWORD APIENTRY DxD3dDrawPrimitives2(
  287. IN HANDLE hCmdBuf,
  288. IN HANDLE hVBuf,
  289. IN OUT LPD3DNTHAL_DRAWPRIMITIVES2DATA pded,
  290. IN OUT FLATPTR* pfpVidMemCmd,
  291. IN OUT DWORD* pdwSizeCmd,
  292. IN OUT FLATPTR* pfpVidMemVtx,
  293. IN OUT DWORD* pdwSizeVtx);
  294. DWORD APIENTRY DxDdGetDriverState(
  295. IN OUT PDD_GETDRIVERSTATEDATA pdata);
  296. DWORD APIENTRY DxDdCreateSurfaceEx(
  297. IN HANDLE hDirectDraw,
  298. IN HANDLE hSurface,
  299. IN DWORD dwSurfaceHandle);
  300. DWORD APIENTRY DxDdGetMoCompGuids(
  301. IN HANDLE hDirectDraw,
  302. IN OUT PDD_GETMOCOMPGUIDSDATA puGetMoCompGuidsData);
  303. DWORD APIENTRY DxDdGetMoCompFormats(
  304. IN HANDLE hDirectDraw,
  305. IN OUT PDD_GETMOCOMPFORMATSDATA puGetMoCompFormatsData);
  306. DWORD APIENTRY DxDdGetMoCompBuffInfo(
  307. IN HANDLE hDirectDraw,
  308. IN OUT PDD_GETMOCOMPCOMPBUFFDATA puGetBuffData);
  309. DWORD APIENTRY DxDdGetInternalMoCompInfo(
  310. IN HANDLE hDirectDraw,
  311. IN OUT PDD_GETINTERNALMOCOMPDATA puGetInternalData);
  312. HANDLE APIENTRY DxDdCreateMoComp(
  313. IN HANDLE hDirectDraw,
  314. IN OUT PDD_CREATEMOCOMPDATA puCreateMoCompData);
  315. DWORD APIENTRY DxDdDestroyMoComp(
  316. IN HANDLE hMoComp,
  317. IN OUT PDD_DESTROYMOCOMPDATA puDestroyMoCompData);
  318. DWORD APIENTRY DxDdBeginMoCompFrame(
  319. IN HANDLE hMoComp,
  320. IN OUT PDD_BEGINMOCOMPFRAMEDATA puBeginFrameData);
  321. DWORD APIENTRY DxDdEndMoCompFrame(
  322. IN HANDLE hMoComp,
  323. IN OUT PDD_ENDMOCOMPFRAMEDATA puEndFrameData);
  324. DWORD APIENTRY DxDdRenderMoComp(
  325. IN HANDLE hMoComp,
  326. IN OUT PDD_RENDERMOCOMPDATA puRenderMoCompData);
  327. DWORD APIENTRY DxDdQueryMoCompStatus(
  328. IN OUT HANDLE hMoComp,
  329. IN OUT PDD_QUERYMOCOMPSTATUSDATA puQueryMoCompStatusData);
  330. DWORD APIENTRY DxDdAlphaBlt(
  331. IN HANDLE hSurfaceDest,
  332. IN HANDLE hSurfaceSrc,
  333. IN OUT PDD_BLTDATA puBltData);
  334. DWORD APIENTRY DxDvpCanCreateVideoPort(
  335. IN HANDLE hDirectDraw,
  336. IN OUT PDD_CANCREATEVPORTDATA puCanCreateVPortData);
  337. DWORD APIENTRY DxDvpColorControl(
  338. IN HANDLE hVideoPort,
  339. IN OUT PDD_VPORTCOLORDATA puVPortColorData);
  340. HANDLE APIENTRY DxDvpCreateVideoPort(
  341. IN HANDLE hDirectDraw,
  342. IN OUT PDD_CREATEVPORTDATA puCreateVPortData);
  343. DWORD APIENTRY DxDvpDestroyVideoPort(
  344. IN HANDLE hVideoPort,
  345. IN OUT PDD_DESTROYVPORTDATA puDestroyVPortData);
  346. DWORD APIENTRY DxDvpFlipVideoPort(
  347. IN HANDLE hVideoPort,
  348. IN HANDLE hDDSurfaceCurrent,
  349. IN HANDLE hDDSurfaceTarget,
  350. IN OUT PDD_FLIPVPORTDATA puFlipVPortData);
  351. DWORD APIENTRY DxDvpGetVideoPortBandwidth(
  352. IN HANDLE hVideoPort,
  353. IN OUT PDD_GETVPORTBANDWIDTHDATA puGetVPortBandwidthData);
  354. DWORD APIENTRY DxDvpGetVideoPortField(
  355. IN HANDLE hVideoPort,
  356. IN OUT PDD_GETVPORTFIELDDATA puGetVPortFieldData);
  357. DWORD APIENTRY DxDvpGetVideoPortFlipStatus(
  358. IN HANDLE hDirectDraw,
  359. IN OUT PDD_GETVPORTFLIPSTATUSDATA puGetVPortFlipStatusData);
  360. DWORD APIENTRY DxDvpGetVideoPortInputFormats(
  361. IN HANDLE hVideoPort,
  362. IN OUT PDD_GETVPORTINPUTFORMATDATA puGetVPortInputFormatData);
  363. DWORD APIENTRY DxDvpGetVideoPortLine(
  364. IN HANDLE hVideoPort,
  365. IN OUT PDD_GETVPORTLINEDATA puGetVPortLineData);
  366. DWORD APIENTRY DxDvpGetVideoPortOutputFormats(
  367. IN HANDLE hVideoPort,
  368. IN OUT PDD_GETVPORTOUTPUTFORMATDATA puGetVPortOutputFormatData);
  369. DWORD APIENTRY DxDvpGetVideoPortConnectInfo(
  370. IN HANDLE hDirectDraw,
  371. IN OUT PDD_GETVPORTCONNECTDATA puGetVPortConnectData);
  372. DWORD APIENTRY DxDvpGetVideoSignalStatus(
  373. IN HANDLE hVideoPort,
  374. IN OUT PDD_GETVPORTSIGNALDATA puGetVPortSignalData);
  375. DWORD APIENTRY DxDvpUpdateVideoPort(
  376. IN HANDLE hVideoPort,
  377. IN HANDLE* phSurfaceVideo,
  378. IN HANDLE* phSurfaceVbi,
  379. IN OUT PDD_UPDATEVPORTDATA puUpdateVPortData);
  380. DWORD APIENTRY DxDvpWaitForVideoPortSync(
  381. IN HANDLE hVideoPort,
  382. IN OUT PDD_WAITFORVPORTSYNCDATA puWaitForVPortSyncData);
  383. DWORD APIENTRY DxDvpAcquireNotification(
  384. IN HANDLE hVideoPort,
  385. IN OUT HANDLE* phEvent,
  386. IN LPDDVIDEOPORTNOTIFY pNotify);
  387. DWORD APIENTRY DxDvpReleaseNotification(
  388. IN HANDLE hVideoPort,
  389. IN HANDLE hEvent);
  390. FLATPTR WINAPI DxDdHeapVidMemAllocAligned(
  391. LPVIDMEM lpVidMem,
  392. DWORD dwWidth,
  393. DWORD dwHeight,
  394. LPSURFACEALIGNMENT lpAlignment ,
  395. LPLONG lpNewPitch );
  396. VOID WINAPI DxDdHeapVidMemFree( LPVMEMHEAP pvmh, FLATPTR ptr );
  397. //
  398. // Private for win32k.sys
  399. //
  400. BOOL DxDdEnableDirectDraw(
  401. HDEV hdev,
  402. BOOL bEnableDriver
  403. );
  404. VOID DxDdDisableDirectDraw(
  405. HDEV hdev,
  406. BOOL bDisableDriver
  407. );
  408. VOID DxDdSuspendDirectDraw(
  409. HDEV hdev,
  410. ULONG fl
  411. );
  412. VOID DxDdResumeDirectDraw(
  413. HDEV hdev,
  414. ULONG fl
  415. );
  416. #define DXG_SR_DDRAW_CHILDREN 0x0001
  417. #define DXG_SR_DDRAW_MODECHANGE 0x0002
  418. VOID DxDdDynamicModeChange(
  419. HDEV hdevOld,
  420. HDEV hdevNew,
  421. ULONG fl
  422. );
  423. #define DXG_MODECHANGE_TRANSFER 0x0001
  424. VOID DxDdCloseProcess(
  425. W32PID W32Pid
  426. );
  427. BOOL DxDdGetDirectDrawBounds(
  428. HDEV hdev,
  429. RECT* prcBounds
  430. );
  431. BOOL DxDdEnableDirectDrawRedirection(
  432. HDEV hdev,
  433. BOOL bEnable
  434. );
  435. PVOID DxDdAllocPrivateUserMem(
  436. PDD_SURFACE_LOCAL pSurfaceLocal,
  437. SIZE_T cj,
  438. ULONG tag
  439. );
  440. VOID DxDdFreePrivateUserMem(
  441. PDD_SURFACE_LOCAL pSurfaceLocal,
  442. PVOID pv
  443. );
  444. HRESULT DxDdIoctl(
  445. ULONG ulIoctl,
  446. PVOID pBuffer,
  447. ULONG ulBufferSize
  448. );
  449. PDD_SURFACE_LOCAL DxDdLockDirectDrawSurface(
  450. HANDLE hSurface
  451. );
  452. BOOL DxDdUnlockDirectDrawSurface(
  453. PDD_SURFACE_LOCAL pSurface
  454. );
  455. VOID DxDdSetAccelLevel(
  456. HDEV hdev,
  457. DWORD dwAccelLevel,
  458. DWORD dwOverride
  459. );
  460. DWORD DxDdGetSurfaceLock(
  461. HDEV hdev
  462. );
  463. PVOID DxDdEnumLockedSurfaceRect(
  464. HDEV hdev,
  465. PVOID pvSurface,
  466. RECTL *pLockedRect
  467. );
  468. typedef DWORD (APIENTRY *PFN_DxDxgGenericThunk)(IN ULONG_PTR,IN ULONG_PTR,
  469. IN OUT SIZE_T *,IN OUT PVOID,
  470. IN OUT SIZE_T *,IN OUT PVOID);
  471. typedef DWORD (APIENTRY *PFN_DxDdAddAttachedSurface)(IN HANDLE,IN HANDLE,IN OUT PDD_ADDATTACHEDSURFACEDATA);
  472. typedef BOOL (APIENTRY *PFN_DxDdAttachSurface)(IN HANDLE,IN HANDLE);
  473. typedef DWORD (APIENTRY *PFN_DxDdBlt)(IN HANDLE,IN HANDLE,IN OUT PDD_BLTDATA);
  474. typedef DWORD (APIENTRY *PFN_DxDdCanCreateSurface)(IN HANDLE,IN OUT PDD_CANCREATESURFACEDATA);
  475. typedef DWORD (APIENTRY *PFN_DxDdColorControl)(IN HANDLE,IN OUT PDD_COLORCONTROLDATA);
  476. typedef HANDLE (APIENTRY *PFN_DxDdCreateDirectDrawObject)(IN HDC);
  477. typedef DWORD (APIENTRY *PFN_DxDdCreateSurface)(IN HANDLE,IN HANDLE*,IN OUT DDSURFACEDESC*,
  478. IN OUT DD_SURFACE_GLOBAL*,IN OUT DD_SURFACE_LOCAL*,
  479. IN OUT DD_SURFACE_MORE*,IN OUT DD_CREATESURFACEDATA*,
  480. OUT HANDLE*);
  481. typedef HANDLE (APIENTRY *PFN_DxDdCreateSurfaceObject)(IN HANDLE,IN HANDLE,IN PDD_SURFACE_LOCAL,
  482. IN PDD_SURFACE_MORE,IN PDD_SURFACE_GLOBAL,
  483. IN BOOL);
  484. typedef BOOL (APIENTRY *PFN_DxDdDeleteSurfaceObject)(IN HANDLE);
  485. typedef BOOL (APIENTRY *PFN_DxDdDeleteDirectDrawObject)(IN HANDLE);
  486. typedef DWORD (APIENTRY *PFN_DxDdDestroySurface)(IN HANDLE,IN BOOL);
  487. typedef DWORD (APIENTRY *PFN_DxDdFlip)(IN HANDLE,IN HANDLE,IN HANDLE,IN HANDLE,IN OUT PDD_FLIPDATA);
  488. typedef DWORD (APIENTRY *PFN_DxDdGetAvailDriverMemory)(IN HANDLE,IN OUT PDD_GETAVAILDRIVERMEMORYDATA);
  489. typedef DWORD (APIENTRY *PFN_DxDdGetBltStatus)(IN HANDLE,IN OUT PDD_GETBLTSTATUSDATA);
  490. typedef HDC (APIENTRY *PFN_DxDdGetDC)(IN HANDLE,IN PALETTEENTRY*);
  491. typedef DWORD (APIENTRY *PFN_DxDdGetDriverInfo)(IN HANDLE,IN OUT PDD_GETDRIVERINFODATA);
  492. typedef DWORD (APIENTRY *PFN_DxDdGetFlipStatus)(IN HANDLE,IN OUT PDD_GETFLIPSTATUSDATA);
  493. typedef DWORD (APIENTRY *PFN_DxDdGetScanLine)(IN HANDLE,IN OUT PDD_GETSCANLINEDATA);
  494. typedef DWORD (APIENTRY *PFN_DxDdSetExclusiveMode)(IN HANDLE,IN OUT PDD_SETEXCLUSIVEMODEDATA);
  495. typedef DWORD (APIENTRY *PFN_DxDdFlipToGDISurface)(IN HANDLE,IN OUT PDD_FLIPTOGDISURFACEDATA);
  496. typedef DWORD (APIENTRY *PFN_DxDdLock)(IN HANDLE,IN OUT PDD_LOCKDATA,IN HDC);
  497. typedef BOOL (APIENTRY *PFN_DxDdQueryDirectDrawObject)(IN HANDLE,IN OUT PDD_HALINFO,IN OUT DWORD*,
  498. IN OUT LPD3DNTHAL_CALLBACKS,
  499. IN OUT LPD3DNTHAL_GLOBALDRIVERDATA,
  500. IN OUT PDD_D3DBUFCALLBACKS,
  501. IN OUT LPDDSURFACEDESC,
  502. IN OUT DWORD*, IN OUT VIDEOMEMORY*,
  503. IN OUT DWORD*, IN OUT DWORD*);
  504. typedef BOOL (APIENTRY *PFN_DxDdReenableDirectDrawObject)(IN HANDLE,IN OUT BOOL*);
  505. typedef BOOL (APIENTRY *PFN_DxDdReleaseDC)(IN HANDLE);
  506. typedef BOOL (APIENTRY *PFN_DxDdResetVisrgn)(IN HANDLE,IN HWND);
  507. typedef DWORD (APIENTRY *PFN_DxDdSetColorKey)(IN HANDLE,IN OUT PDD_SETCOLORKEYDATA);
  508. typedef DWORD (APIENTRY *PFN_DxDdSetOverlayPosition)(IN HANDLE,IN HANDLE,IN OUT PDD_SETOVERLAYPOSITIONDATA);
  509. typedef VOID (APIENTRY *PFN_DxDdUnattachSurface)(IN HANDLE,IN HANDLE);
  510. typedef DWORD (APIENTRY *PFN_DxDdUnlock)(IN HANDLE,IN OUT PDD_UNLOCKDATA);
  511. typedef DWORD (APIENTRY *PFN_DxDdUpdateOverlay)(IN HANDLE,IN HANDLE,IN OUT PDD_UPDATEOVERLAYDATA);
  512. typedef DWORD (APIENTRY *PFN_DxDdWaitForVerticalBlank)(IN HANDLE,IN OUT PDD_WAITFORVERTICALBLANKDATA);
  513. typedef HANDLE (APIENTRY *PFN_DxDdGetDxHandle)(IN HANDLE,IN HANDLE,IN BOOL);
  514. typedef BOOL (APIENTRY *PFN_DxDdSetGammaRamp)(IN HANDLE,IN HDC,IN LPVOID);
  515. typedef DWORD (APIENTRY *PFN_DxDdLockD3D)(IN HANDLE,IN OUT PDD_LOCKDATA);
  516. typedef DWORD (APIENTRY *PFN_DxDdUnlockD3D)(IN HANDLE,IN OUT PDD_UNLOCKDATA);
  517. typedef DWORD (APIENTRY *PFN_DxDdCreateD3DBuffer)(IN HANDLE,IN OUT HANDLE*,
  518. IN OUT DDSURFACEDESC*,IN OUT DD_SURFACE_GLOBAL*,
  519. IN OUT DD_SURFACE_LOCAL*,IN OUT DD_SURFACE_MORE*,
  520. IN OUT DD_CREATESURFACEDATA*,IN OUT HANDLE*);
  521. typedef DWORD (APIENTRY *PFN_DxDdCanCreateD3DBuffer)(IN HANDLE,IN OUT PDD_CANCREATESURFACEDATA);
  522. typedef DWORD (APIENTRY *PFN_DxDdDestroyD3DBuffer)(IN HANDLE);
  523. typedef DWORD (APIENTRY *PFN_DxD3dContextCreate)(IN HANDLE,IN HANDLE,IN HANDLE,IN OUT D3DNTHAL_CONTEXTCREATEI*);
  524. typedef DWORD (APIENTRY *PFN_DxD3dContextDestroy)(IN LPD3DNTHAL_CONTEXTDESTROYDATA);
  525. typedef DWORD (APIENTRY *PFN_DxD3dContextDestroyAll)(OUT LPD3DNTHAL_CONTEXTDESTROYALLDATA);
  526. typedef DWORD (APIENTRY *PFN_DxD3dValidateTextureStageState)(IN OUT LPD3DNTHAL_VALIDATETEXTURESTAGESTATEDATA);
  527. typedef DWORD (APIENTRY *PFN_DxD3dDrawPrimitives2)(IN HANDLE,IN HANDLE,IN OUT LPD3DNTHAL_DRAWPRIMITIVES2DATA pded,
  528. IN OUT FLATPTR*,IN OUT DWORD*,IN OUT FLATPTR*,IN OUT DWORD*);
  529. typedef DWORD (APIENTRY *PFN_DxDdGetDriverState)(IN OUT PDD_GETDRIVERSTATEDATA);
  530. typedef DWORD (APIENTRY *PFN_DxDdCreateSurfaceEx)(IN HANDLE,IN HANDLE,IN DWORD);
  531. typedef DWORD (APIENTRY *PFN_DxDdGetMoCompGuids)(IN HANDLE,IN OUT PDD_GETMOCOMPGUIDSDATA);
  532. typedef DWORD (APIENTRY *PFN_DxDdGetMoCompFormats)(IN HANDLE,IN OUT PDD_GETMOCOMPFORMATSDATA);
  533. typedef DWORD (APIENTRY *PFN_DxDdGetMoCompBuffInfo)(IN HANDLE,IN OUT PDD_GETMOCOMPCOMPBUFFDATA);
  534. typedef DWORD (APIENTRY *PFN_DxDdGetInternalMoCompInfo)(IN HANDLE,IN OUT PDD_GETINTERNALMOCOMPDATA);
  535. typedef HANDLE (APIENTRY *PFN_DxDdCreateMoComp)(IN HANDLE,IN OUT PDD_CREATEMOCOMPDATA);
  536. typedef DWORD (APIENTRY *PFN_DxDdDestroyMoComp)(IN HANDLE,IN OUT PDD_DESTROYMOCOMPDATA);
  537. typedef DWORD (APIENTRY *PFN_DxDdBeginMoCompFrame)(IN HANDLE,IN OUT PDD_BEGINMOCOMPFRAMEDATA);
  538. typedef DWORD (APIENTRY *PFN_DxDdEndMoCompFrame)(IN HANDLE,IN OUT PDD_ENDMOCOMPFRAMEDATA);
  539. typedef DWORD (APIENTRY *PFN_DxDdRenderMoComp)(IN HANDLE,IN OUT PDD_RENDERMOCOMPDATA);
  540. typedef DWORD (APIENTRY *PFN_DxDdQueryMoCompStatus)(IN OUT HANDLE,IN OUT PDD_QUERYMOCOMPSTATUSDATA);
  541. typedef DWORD (APIENTRY *PFN_DxDdAlphaBlt)(IN HANDLE,IN HANDLE,IN OUT PDD_BLTDATA);
  542. typedef DWORD (APIENTRY *PFN_DxDvpCanCreateVideoPort)(IN HANDLE,IN OUT PDD_CANCREATEVPORTDATA);
  543. typedef DWORD (APIENTRY *PFN_DxDvpColorControl)(IN HANDLE,IN OUT PDD_VPORTCOLORDATA);
  544. typedef HANDLE (APIENTRY *PFN_DxDvpCreateVideoPort)(IN HANDLE,IN OUT PDD_CREATEVPORTDATA);
  545. typedef DWORD (APIENTRY *PFN_DxDvpDestroyVideoPort)(IN HANDLE,IN OUT PDD_DESTROYVPORTDATA);
  546. typedef DWORD (APIENTRY *PFN_DxDvpFlipVideoPort)(IN HANDLE,IN HANDLE,IN HANDLE,IN OUT PDD_FLIPVPORTDATA);
  547. typedef DWORD (APIENTRY *PFN_DxDvpGetVideoPortBandwidth)(IN HANDLE,IN OUT PDD_GETVPORTBANDWIDTHDATA);
  548. typedef DWORD (APIENTRY *PFN_DxDvpGetVideoPortField)(IN HANDLE,IN OUT PDD_GETVPORTFIELDDATA);
  549. typedef DWORD (APIENTRY *PFN_DxDvpGetVideoPortFlipStatus)(IN HANDLE,IN OUT PDD_GETVPORTFLIPSTATUSDATA);
  550. typedef DWORD (APIENTRY *PFN_DxDvpGetVideoPortInputFormats)(IN HANDLE,IN OUT PDD_GETVPORTINPUTFORMATDATA);
  551. typedef DWORD (APIENTRY *PFN_DxDvpGetVideoPortLine)(IN HANDLE,IN OUT PDD_GETVPORTLINEDATA);
  552. typedef DWORD (APIENTRY *PFN_DxDvpGetVideoPortOutputFormats)(IN HANDLE,IN OUT PDD_GETVPORTOUTPUTFORMATDATA);
  553. typedef DWORD (APIENTRY *PFN_DxDvpGetVideoPortConnectInfo)(IN HANDLE,IN OUT PDD_GETVPORTCONNECTDATA);
  554. typedef DWORD (APIENTRY *PFN_DxDvpGetVideoSignalStatus)(IN HANDLE,IN OUT PDD_GETVPORTSIGNALDATA);
  555. typedef DWORD (APIENTRY *PFN_DxDvpUpdateVideoPort)(IN HANDLE,IN HANDLE*,IN HANDLE*,IN OUT PDD_UPDATEVPORTDATA);
  556. typedef DWORD (APIENTRY *PFN_DxDvpWaitForVideoPortSync)(IN HANDLE,IN OUT PDD_WAITFORVPORTSYNCDATA);
  557. typedef DWORD (APIENTRY *PFN_DxDvpAcquireNotification)(IN HANDLE,IN OUT HANDLE*,IN OUT LPDDVIDEOPORTNOTIFY pNotify);
  558. typedef DWORD (APIENTRY *PFN_DxDvpReleaseNotification)(IN HANDLE,IN HANDLE);
  559. typedef DWORD (APIENTRY *PFN_DxDdGetMoCompGuids)(IN HANDLE,IN OUT PDD_GETMOCOMPGUIDSDATA);
  560. typedef DWORD (APIENTRY *PFN_DxDdGetMoCompFormats)(IN HANDLE,IN OUT PDD_GETMOCOMPFORMATSDATA);
  561. typedef DWORD (APIENTRY *PFN_DxDdGetMoCompBuffInfo)(IN HANDLE,IN OUT PDD_GETMOCOMPCOMPBUFFDATA);
  562. typedef FLATPTR (WINAPI *PFN_DxDdHeapVidMemAllocAligned)(LPVIDMEM,DWORD,DWORD,LPSURFACEALIGNMENT,LPLONG);
  563. typedef VOID (WINAPI *PFN_DxDdHeapVidMemFree)(LPVMEMHEAP,FLATPTR);
  564. typedef BOOL (*PFN_DxDdEnableDirectDraw)(HDEV,BOOL);
  565. typedef VOID (*PFN_DxDdDisableDirectDraw)(HDEV,BOOL);
  566. typedef VOID (*PFN_DxDdSuspendDirectDraw)(HDEV,ULONG);
  567. typedef VOID (*PFN_DxDdResumeDirectDraw)(HDEV,ULONG);
  568. typedef VOID (*PFN_DxDdDynamicModeChange)(HDEV,HDEV,ULONG);
  569. typedef VOID (*PFN_DxDdCloseProcess)(W32PID);
  570. typedef BOOL (*PFN_DxDdGetDirectDrawBounds)(HDEV,RECT*);
  571. typedef BOOL (*PFN_DxDdEnableDirectDrawRedirection)(HDEV,BOOL);
  572. typedef PVOID (*PFN_DxDdAllocPrivateUserMem)(PDD_SURFACE_LOCAL,SIZE_T,ULONG);
  573. typedef VOID (*PFN_DxDdFreePrivateUserMem)(PDD_SURFACE_LOCAL,PVOID);
  574. typedef PDD_SURFACE_LOCAL (*PFN_DxDdLockDirectDrawSurface)(HANDLE);
  575. typedef BOOL (*PFN_DxDdUnlockDirectDrawSurface)(PDD_SURFACE_LOCAL);
  576. typedef VOID (*PFN_DxDdSetAccelLevel)(HDEV,DWORD,DWORD);
  577. typedef DWORD (*PFN_DxDdGetSurfaceLock)(HDEV);
  578. typedef PVOID (*PFN_DxDdEnumLockedSurfaceRect)(HDEV,PVOID,RECTL*);
  579. typedef HRESULT (*PFN_DxDdIoctl)(ULONG,PVOID,ULONG);
  580. //
  581. // The functions definiton which import from win32k.sys
  582. //
  583. // Functions for global win32k.sys status.
  584. //
  585. #define INDEX_DxEngUnused 0
  586. #define INDEX_DxEngIsTermSrv 1
  587. #define INDEX_DxEngScreenAccessCheck 2
  588. #define INDEX_DxEngRedrawDesktop 3
  589. #define INDEX_DxEngDispUniq 4
  590. #define INDEX_DxEngIncDispUniq 5
  591. #define INDEX_DxEngVisRgnUniq 6
  592. #define INDEX_DxEngLockShareSem 7
  593. #define INDEX_DxEngUnlockShareSem 8
  594. #define INDEX_DxEngEnumerateHdev 9
  595. #define INDEX_DxEngLockHdev 10
  596. #define INDEX_DxEngUnlockHdev 11
  597. #define INDEX_DxEngIsHdevLockedByCurrentThread 12
  598. #define INDEX_DxEngReferenceHdev 13
  599. #define INDEX_DxEngUnreferenceHdev 14
  600. #define INDEX_DxEngGetDeviceGammaRamp 15
  601. #define INDEX_DxEngSetDeviceGammaRamp 16
  602. #define INDEX_DxEngSpTearDownSprites 17
  603. #define INDEX_DxEngSpUnTearDownSprites 18
  604. #define INDEX_DxEngSpSpritesVisible 19
  605. #define INDEX_DxEngGetHdevData 20
  606. #define INDEX_DxEngSetHdevData 21
  607. #define INDEX_DxEngCreateMemoryDC 22
  608. #define INDEX_DxEngGetDesktopDC 23
  609. #define INDEX_DxEngDeleteDC 24
  610. #define INDEX_DxEngCleanDC 25
  611. #define INDEX_DxEngSetDCOwner 26
  612. #define INDEX_DxEngLockDC 27
  613. #define INDEX_DxEngUnlockDC 28
  614. #define INDEX_DxEngSetDCState 29
  615. #define INDEX_DxEngGetDCState 30
  616. #define INDEX_DxEngSelectBitmap 31
  617. #define INDEX_DxEngSetBitmapOwner 32
  618. #define INDEX_DxEngDeleteSurface 33
  619. #define INDEX_DxEngGetSurfaceData 34
  620. #define INDEX_DxEngAltLockSurface 35
  621. #define INDEX_DxEngUploadPaletteEntryToSurface 36
  622. #define INDEX_DxEngMarkSurfaceAsDirectDraw 37
  623. #define INDEX_DxEngSelectPaletteToSurface 38
  624. #define INDEX_DxEngSyncPaletteTableWithDevice 39
  625. #define INDEX_DxEngSetPaletteState 40
  626. #define INDEX_DxEngGetRedirectionBitmap 41
  627. #define INDEX_DxEngLoadImage 42
  628. #define INDEX_WIN32K_TABLE_SIZE 43
  629. // DxEngSetHdevData()
  630. #define HDEV_SURFACEHANDLE 0 // Get only
  631. #define HDEV_MINIPORTHANDLE 1 // Get only
  632. #define HDEV_DITHERFORMAT 2 // Get only
  633. #define HDEV_GCAPS 3
  634. #define HDEV_GCAPS2 4
  635. #define HDEV_FUNCTIONTABLE 5 // Get only
  636. #define HDEV_DHPDEV 6 // Get only
  637. #define HDEV_DXDATA 7
  638. #define HDEV_DXLOCKS 8
  639. #define HDEV_CAPSOVERRIDE 9 // Get only
  640. #define HDEV_DISABLED 10
  641. #define HDEV_DDML 11 // Get only
  642. #define HDEV_DISPLAY 12 // Get only
  643. #define HDEV_PARENTHDEV 13 // Get only
  644. #define HDEV_DELETED 14 // Get only
  645. #define HDEV_PALMANAGED 15 // Get only
  646. #define HDEV_LDEV 16 // Get only
  647. #define HDEV_GRAPHICSDEVICE 17 // Get only
  648. #define HDEV_CLONE 18 // Get only
  649. // DxEngGetDCState()
  650. #define DCSTATE_FULLSCREEN 1
  651. #define DCSTATE_VISRGNCOMPLEX 2 // Get only
  652. #define DCSTATE_HDEV 3 // Get only
  653. // DxEngGetSurfaceData()
  654. #define SURF_HOOKFLAGS 1
  655. #define SURF_IS_DIRECTDRAW_SURFACE 2
  656. #define SURF_DD_SURFACE_HANDLE 3
  657. // DxEngSetPaletteState()
  658. #define PALSTATE_DIBSECTION 1
  659. #ifdef DXG_BUILD // ONLY TRUE WHEN BUILD DXG.SYS.
  660. //
  661. // Stub routines to call Win32k.sys
  662. //
  663. extern DRVFN *gpEngFuncs;
  664. typedef BOOL (*PFN_DxEngIsTermSrv)(VOID);
  665. typedef BOOL (*PFN_DxEngScreenAccessCheck)(VOID);
  666. typedef BOOL (*PFN_DxEngRedrawDesktop)(VOID);
  667. typedef ULONG (*PFN_DxEngDispUniq)(VOID);
  668. typedef BOOL (*PFN_DxEngIncDispUniq)(VOID);
  669. typedef ULONG (*PFN_DxEngVisRgnUniq)(VOID);
  670. typedef BOOL (*PFN_DxEngLockShareSem)(VOID);
  671. typedef BOOL (*PFN_DxEngUnlockShareSem)(VOID);
  672. typedef HDEV (*PFN_DxEngEnumerateHdev)(HDEV);
  673. typedef BOOL (*PFN_DxEngLockHdev)(HDEV);
  674. typedef BOOL (*PFN_DxEngUnlockHdev)(HDEV);
  675. typedef BOOL (*PFN_DxEngIsHdevLockedByCurrentThread)(HDEV);
  676. typedef BOOL (*PFN_DxEngReferenceHdev)(HDEV);
  677. typedef BOOL (*PFN_DxEngUnreferenceHdev)(HDEV);
  678. typedef BOOL (*PFN_DxEngGetDeviceGammaRamp)(HDEV,PVOID);
  679. typedef BOOL (*PFN_DxEngSetDeviceGammaRamp)(HDEV,PVOID,BOOL);
  680. typedef BOOL (*PFN_DxEngSpTearDownSprites)(HDEV,RECTL*,BOOL);
  681. typedef BOOL (*PFN_DxEngSpUnTearDownSprites)(HDEV,RECTL*,BOOL);
  682. typedef BOOL (*PFN_DxEngSpSpritesVisible)(HDEV);
  683. typedef ULONG_PTR (*PFN_DxEngGetHdevData)(HDEV,DWORD);
  684. typedef BOOL (*PFN_DxEngSetHdevData)(HDEV,DWORD,ULONG_PTR);
  685. typedef HDC (*PFN_DxEngCreateMemoryDC)(HDEV);
  686. typedef HDC (*PFN_DxEngGetDesktopDC)(ULONG,BOOL,BOOL);
  687. typedef BOOL (*PFN_DxEngDeleteDC)(HDC,BOOL);
  688. typedef BOOL (*PFN_DxEngCleanDC)(HDC);
  689. typedef BOOL (*PFN_DxEngSetDCOwner)(HDC,W32PID);
  690. typedef PVOID (*PFN_DxEngLockDC)(HDC);
  691. typedef BOOL (*PFN_DxEngUnlockDC)(PVOID);
  692. typedef BOOL (*PFN_DxEngSetDCState)(HDC,DWORD,ULONG_PTR);
  693. typedef ULONG_PTR (*PFN_DxEngGetDCState)(HDC,DWORD);
  694. typedef HBITMAP (*PFN_DxEngSelectBitmap)(HDC,HBITMAP);
  695. typedef BOOL (*PFN_DxEngSetBitmapOwner)(HBITMAP,W32PID);
  696. typedef BOOL (*PFN_DxEngDeleteSurface)(HSURF hsurf);
  697. typedef ULONG_PTR (*PFN_DxEngGetSurfaceData)(SURFOBJ*,DWORD);
  698. typedef SURFOBJ* (*PFN_DxEngAltLockSurface)(HBITMAP);
  699. typedef BOOL (*PFN_DxEngUploadPaletteEntryToSurface)(HDEV,SURFOBJ*,PALETTEENTRY*,ULONG);
  700. typedef BOOL (*PFN_DxEngMarkSurfaceAsDirectDraw)(SURFOBJ*,HANDLE);
  701. typedef HPALETTE (*PFN_DxEngSelectPaletteToSurface)(SURFOBJ*,HPALETTE);
  702. typedef BOOL (*PFN_DxEngSyncPaletteTableWithDevice)(HPALETTE,HDEV);
  703. typedef BOOL (*PFN_DxEngSetPaletteState)(HPALETTE,DWORD,ULONG_PTR);
  704. typedef HBITMAP (*PFN_DxEngGetRedirectionBitmap)(HWND);
  705. typedef HANDLE (*PFN_DxEngLoadImage)(LPWSTR,BOOL);
  706. #define PPFNGET_DXENG(name) ((PFN_DxEng##name)((gpEngFuncs[INDEX_DxEng##name]).pfn))
  707. #define CALL_DXENG(name) (*(PPFNGET_DXENG(name)))
  708. #define DxEngIsTermSrv() ((BOOL)(CALL_DXENG(IsTermSrv)()))
  709. #define DxEngScreenAccessCheck() ((BOOL)(CALL_DXENG(ScreenAccessCheck)()))
  710. #define DxEngRedrawDesktop() ((BOOL)(CALL_DXENG(RedrawDesktop)()))
  711. #define DxEngDispUniq() ((ULONG)(CALL_DXENG(DxEngDispUniq)()))
  712. #define DxEngIncDispUniq() ((BOOL)(CALL_DXENG(IncDispUniq)()))
  713. #define DxEngVisRgnUniq() ((ULONG)(CALL_DXENG(VisRgnUniq)()))
  714. #define DxEngLockShareSem() ((BOOL)(CALL_DXENG(LockShareSem)()))
  715. #define DxEngUnlockShareSem() ((BOOL)(CALL_DXENG(UnlockShareSem)()))
  716. #define DxEngEnumerateHdev(hdev) ((HDEV)(CALL_DXENG(EnumerateHdev)(hdev)))
  717. #define DxEngLockHdev(hdev) ((BOOL)(CALL_DXENG(LockHdev)(hdev)))
  718. #define DxEngUnlockHdev(hdev) ((BOOL)(CALL_DXENG(UnlockHdev)(hdev)))
  719. #define DxEngIsHdevLockedByCurrentThread(hdev) \
  720. ((BOOL)(CALL_DXENG(IsHdevLockedByCurrentThread)(hdev)))
  721. #define DxEngReferenceHdev(hdev) ((BOOL)(CALL_DXENG(ReferenceHdev)(hdev)))
  722. #define DxEngUnreferenceHdev(hdev) ((BOOL)(CALL_DXENG(UnreferenceHdev)(hdev)))
  723. #define DxEngGetHdevData(hdev,dwIndex) \
  724. ((ULONG_PTR)(CALL_DXENG(GetHdevData)(hdev,dwIndex)))
  725. #define DxEngSetHdevData(hdev,dwIndex,pData) \
  726. ((BOOL)(CALL_DXENG(SetHdevData)(hdev,dwIndex,pData)))
  727. #define DxEngCreateMemoryDC(hdev) ((HDC)(CALL_DXENG(CreateMemoryDC)(hdev)))
  728. #define DxEngGetDesktopDC(ulType,bAltType,bValidate) \
  729. ((HDC)(CALL_DXENG(GetDesktopDC)(ulType,bAltType,bValidate)))
  730. #define DxEngDeleteDC(hdc,bForce) ((BOOL)(CALL_DXENG(DeleteDC)(hdc,bForce)))
  731. #define DxEngCleanDC(hdc) ((BOOL)(CALL_DXENG(CleanDC)(hdc)))
  732. #define DxEngSetDCOwner(hdc,pidOwner) \
  733. ((BOOL)(CALL_DXENG(SetDCOwner)(hdc,pidOwner)))
  734. #define DxEngLockDC(hdc) ((PVOID)(CALL_DXENG(LockDC)(hdc)))
  735. #define DxEngUnlockDC(pvLockedDC) ((BOOL)(CALL_DXENG(UnlockDC)(pvLockedDC)))
  736. #define DxEngSetDCState(hdc,dwState,ulData) \
  737. ((BOOL)(CALL_DXENG(SetDCState)(hdc,dwState,ulData)))
  738. #define DxEngGetDCState(hdc,dwState) \
  739. ((ULONG_PTR)(CALL_DXENG(GetDCState)(hdc,dwState)))
  740. #define DxEngSelectBitmap(hdc,hbm) ((HBITMAP)(CALL_DXENG(SelectBitmap)(hdc,hbm)))
  741. #define DxEngSetBitmapOwner(hbm,pidOwner) \
  742. ((BOOL)(CALL_DXENG(SetBitmapOwner)(hbm,pidOwner)))
  743. #define DxEngDeleteSurface(hsurf) ((BOOL)(CALL_DXENG(DeleteSurface)(hsurf)))
  744. #define DxEngGetSurfaceData(pso,dwIndex) \
  745. ((ULONG_PTR)(CALL_DXENG(GetSurfaceData)(pso,dwIndex)))
  746. #define DxEngAltLockSurface(hsurf) ((SURFOBJ*)(CALL_DXENG(AltLockSurface)(hsurf)))
  747. #define DxEngUploadPaletteEntryToSurface(hdev,pso,puColorTable,cColors) \
  748. ((BOOL)(CALL_DXENG(UploadPaletteEntryToSurface)(hdev,pso,puColorTable,cColors)))
  749. #define DxEngMarkSurfaceAsDirectDraw(pso,hDdSurf) \
  750. ((BOOL)(CALL_DXENG(MarkSurfaceAsDirectDraw)(pso,hDdSurf)))
  751. #define DxEngSelectPaletteToSurface(pso,hpal) \
  752. ((HPALETTE)(CALL_DXENG(SelectPaletteToSurface)(pso,hpal)))
  753. #define DxEngGetDeviceGammaRamp(hdev,pv) \
  754. ((BOOL)(CALL_DXENG(GetDeviceGammaRamp)(hdev,pv)))
  755. #define DxEngSetDeviceGammaRamp(hdev,pv,b) \
  756. ((BOOL)(CALL_DXENG(SetDeviceGammaRamp)(hdev,pv,b)))
  757. #define DxEngSpTearDownSprites(hdev,prcl,b) \
  758. ((BOOL)(CALL_DXENG(SpTearDownSprites)(hdev,prcl,b)))
  759. #define DxEngSpUnTearDownSprites(hdev,prcl,b) \
  760. ((BOOL)(CALL_DXENG(SpUnTearDownSprites)(hdev,prcl,b)))
  761. #define DxEngSpSpritesVisible(hdev) \
  762. ((BOOL)(CALL_DXENG(SpSpritesVisible)(hdev)))
  763. #define DxEngSetPaletteState(hpal,dwIndex,ulData) \
  764. ((BOOL)(CALL_DXENG(SetPaletteState)(hpal,dwIndex,ulData)))
  765. #define DxEngSyncPaletteTableWithDevice(hpal,hdev) \
  766. ((BOOL)(CALL_DXENG(SyncPaletteTableWithDevice)(hpal,hdev)))
  767. #define DxEngGetRedirectionBitmap(hWnd) \
  768. ((HBITMAP)(CALL_DXENG(GetRedirectionBitmap)(hWnd)))
  769. #define DxEngLoadImage(pwszDriver, bLoadInSessionSpace) \
  770. ((HANDLE)(CALL_DXENG(LoadImage)(pwszDriver,bLoadInSessionSpace)))
  771. #else // DXG_BUILD
  772. //
  773. // Prototype definitions for function body in win32k.sys
  774. //
  775. BOOL DxEngIsTermSrv(
  776. VOID
  777. );
  778. BOOL DxEngScreenAccessCheck(
  779. VOID
  780. );
  781. BOOL DxEngRedrawDesktop(
  782. VOID
  783. );
  784. ULONG DxEngDispUniq(
  785. VOID
  786. );
  787. BOOL DxEngIncDispUniq(
  788. VOID
  789. );
  790. ULONG DxEngVisRgnUniq(
  791. VOID
  792. );
  793. BOOL DxEngLockShareSem(
  794. VOID
  795. );
  796. BOOL DxEngUnlockShareSem(
  797. VOID
  798. );
  799. HDEV DxEngEnumerateHdev(
  800. HDEV hdev
  801. );
  802. // Functions for control HDEV status.
  803. BOOL DxEngLockHdev(
  804. HDEV hdev
  805. );
  806. BOOL DxEngUnlockHdev(
  807. HDEV hdev
  808. );
  809. BOOL DxEngIsHdevLockedByCurrentThread(
  810. HDEV hdev
  811. );
  812. BOOL DxEngReferenceHdev(
  813. HDEV hdev
  814. );
  815. BOOL DxEngUnreferenceHdev(
  816. HDEV hdev
  817. );
  818. BOOL DxEngGetDeviceGammaRamp(
  819. HDEV hdev,
  820. PVOID pv
  821. );
  822. BOOL DxEngSetDeviceGammaRamp(
  823. HDEV hdev,
  824. PVOID pv,
  825. BOOL b
  826. );
  827. BOOL DxEngSpTearDownSprites(
  828. HDEV hdev,
  829. RECTL* prcl,
  830. BOOL b
  831. );
  832. BOOL DxEngSpUnTearDownSprites(
  833. HDEV hdev,
  834. RECTL* prcl,
  835. BOOL b
  836. );
  837. BOOL DxEngSpSpritesVisible(
  838. HDEV hdev
  839. );
  840. ULONG_PTR DxEngGetHdevData(
  841. HDEV hdev,
  842. DWORD dwIndex
  843. );
  844. BOOL DxEngSetHdevData(
  845. HDEV hdev,
  846. DWORD dwIndex,
  847. ULONG_PTR ulData
  848. );
  849. // Functions for control DC
  850. HDC DxEngCreateMemoryDC(
  851. HDEV hdev
  852. );
  853. HDC DxEngGetDesktopDC(
  854. ULONG ulType,
  855. BOOL bAltType,
  856. BOOL bValidate
  857. );
  858. BOOL DxEngDeleteDC(
  859. HDC hdc,
  860. BOOL bForce
  861. );
  862. BOOL DxEngCleanDC(
  863. HDC hdc
  864. );
  865. BOOL DxEngSetDCOwner(
  866. HDC hdc,
  867. W32PID pidOwner
  868. );
  869. PVOID DxEngLockDC(
  870. HDC hdc
  871. );
  872. BOOL DxEngUnlockDC(
  873. PVOID pvLockedDC
  874. );
  875. BOOL DxEngSetDCState(
  876. HDC hdc,
  877. DWORD dwState,
  878. ULONG_PTR ulData
  879. );
  880. ULONG_PTR DxEngGetDCState(
  881. HDC hdc,
  882. DWORD dwState
  883. );
  884. // Functions for control Bitmap/Surface
  885. HBITMAP DxEngSelectBitmap(
  886. HDC hdc,
  887. HBITMAP hbm
  888. );
  889. BOOL DxEngSetBitmapOwner(
  890. HBITMAP hbm,
  891. W32PID pidOwner
  892. );
  893. BOOL DxEngDeleteSurface(
  894. HSURF hsurf
  895. );
  896. ULONG_PTR DxEngGetSurfaceData(
  897. SURFOBJ* pso,
  898. DWORD dwIndex);
  899. SURFOBJ *DxEngAltLockSurface(
  900. HBITMAP hSurf);
  901. BOOL DxEngUploadPaletteEntryToSurface(
  902. HDEV hdev,
  903. SURFOBJ* pso,
  904. PALETTEENTRY* puColorTable,
  905. ULONG cColors
  906. );
  907. BOOL DxEngMarkSurfaceAsDirectDraw(
  908. SURFOBJ* pso,
  909. HANDLE hDdSurf
  910. );
  911. HPALETTE DxEngSelectPaletteToSurface(
  912. SURFOBJ* pso,
  913. HPALETTE hpal
  914. );
  915. // Functions for control palette
  916. BOOL DxEngSyncPaletteTableWithDevice(
  917. HPALETTE hpal,
  918. HDEV hdev
  919. );
  920. BOOL DxEngSetPaletteState(
  921. HPALETTE hpal,
  922. DWORD dwIndex,
  923. ULONG_PTR ulData
  924. );
  925. #define PALSTATE_DIBSECTION 1
  926. // Functions for window handle
  927. HBITMAP DxEngGetRedirectionBitmap(
  928. HWND hWnd
  929. );
  930. // Functions to load image file
  931. HANDLE DxEngLoadImage(
  932. LPWSTR pwszDriver,
  933. BOOL bLoadInSessionSpace
  934. );
  935. #endif // DXG_BUILD