1 /*
2 * PROJECT: ReactOS Win32 Subsystem
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: win32ss/reactx/ntddraw/dxeng.c
5 * PURPOSE: Implementation of DxEng functions
6 * PROGRAMMERS: Magnus Olsen (magnus@greatlord.com)
7 * Oleg Dubinskiy (oleg.dubinskij30@gmail.com)
8 */
9
10 #include <win32k.h>
11
12 // #define NDEBUG
13 #include <debug.h>
14
15 HSEMAPHORE ghsemShareDevLock = NULL;
16
17 ULONG gcEngFuncs = DXENG_INDEX_DxEngLoadImage + 1;
18 DRVFN gaEngFuncs[] =
19 {
20 {0, (PFN) NULL},
21 {DXENG_INDEX_DxEngNUIsTermSrv, (PFN)DxEngNUIsTermSrv},
22 {DXENG_INDEX_DxEngScreenAccessCheck, (PFN)DxEngScreenAccessCheck},
23 {DXENG_INDEX_DxEngRedrawDesktop, (PFN)DxEngRedrawDesktop},
24 {DXENG_INDEX_DxEngDispUniq, (PFN)DxEngDispUniq},
25 {DXENG_INDEX_DxEngIncDispUniq, (PFN)DxEngIncDispUniq},
26 {DXENG_INDEX_DxEngVisRgnUniq, (PFN)DxEngVisRgnUniq},
27 {DXENG_INDEX_DxEngLockShareSem, (PFN)DxEngLockShareSem},
28 {DXENG_INDEX_DxEngUnlockShareSem, (PFN)DxEngUnlockShareSem},
29 {DXENG_INDEX_DxEngEnumerateHdev, (PFN)DxEngEnumerateHdev},
30 {DXENG_INDEX_DxEngLockHdev, (PFN)DxEngLockHdev},
31 {DXENG_INDEX_DxEngUnlockHdev, (PFN)DxEngUnlockHdev},
32 {DXENG_INDEX_DxEngIsHdevLockedByCurrentThread, (PFN)DxEngIsHdevLockedByCurrentThread},
33 {DXENG_INDEX_DxEngReferenceHdev, (PFN)DxEngReferenceHdev},
34 {DXENG_INDEX_DxEngUnreferenceHdev, (PFN)DxEngUnreferenceHdev},
35 {DXENG_INDEX_DxEngGetDeviceGammaRamp, (PFN)DxEngGetDeviceGammaRamp},
36 {DXENG_INDEX_DxEngSetDeviceGammaRamp, (PFN)DxEngSetDeviceGammaRamp},
37 {DXENG_INDEX_DxEngSpTearDownSprites, (PFN)DxEngSpTearDownSprites},
38 {DXENG_INDEX_DxEngSpUnTearDownSprites, (PFN)DxEngSpUnTearDownSprites},
39 {DXENG_INDEX_DxEngSpSpritesVisible, (PFN)DxEngSpSpritesVisible},
40 {DXENG_INDEX_DxEngGetHdevData, (PFN)DxEngGetHdevData},
41 {DXENG_INDEX_DxEngSetHdevData, (PFN)DxEngSetHdevData},
42 {DXENG_INDEX_DxEngCreateMemoryDC, (PFN)DxEngCreateMemoryDC},
43 {DXENG_INDEX_DxEngGetDesktopDC, (PFN)DxEngGetDesktopDC},
44 {DXENG_INDEX_DxEngDeleteDC, (PFN)DxEngDeleteDC},
45 {DXENG_INDEX_DxEngCleanDC, (PFN)DxEngCleanDC},
46 {DXENG_INDEX_DxEngSetDCOwner, (PFN)DxEngSetDCOwner},
47 {DXENG_INDEX_DxEngLockDC, (PFN)DxEngLockDC},
48 {DXENG_INDEX_DxEngUnlockDC, (PFN)DxEngUnlockDC},
49 {DXENG_INDEX_DxEngSetDCState, (PFN)DxEngSetDCState},
50 {DXENG_INDEX_DxEngGetDCState, (PFN)DxEngGetDCState},
51 {DXENG_INDEX_DxEngSelectBitmap, (PFN)DxEngSelectBitmap},
52 {DXENG_INDEX_DxEngSetBitmapOwner, (PFN)DxEngSetBitmapOwner},
53 {DXENG_INDEX_DxEngDeleteSurface, (PFN)DxEngDeleteSurface},
54 {DXENG_INDEX_DxEngGetSurfaceData, (PFN)DxEngGetSurfaceData},
55 {DXENG_INDEX_DxEngAltLockSurface, (PFN)DxEngAltLockSurface},
56 {DXENG_INDEX_DxEngUploadPaletteEntryToSurface, (PFN)DxEngUploadPaletteEntryToSurface},
57 {DXENG_INDEX_DxEngMarkSurfaceAsDirectDraw, (PFN)DxEngMarkSurfaceAsDirectDraw},
58 {DXENG_INDEX_DxEngSelectPaletteToSurface, (PFN)DxEngSelectPaletteToSurface},
59 {DXENG_INDEX_DxEngSyncPaletteTableWithDevice, (PFN)DxEngSyncPaletteTableWithDevice},
60 {DXENG_INDEX_DxEngSetPaletteState, (PFN)DxEngSetPaletteState},
61 {DXENG_INDEX_DxEngGetRedirectionBitmap, (PFN)DxEngGetRedirectionBitmap},
62 {DXENG_INDEX_DxEngLoadImage, (PFN)DxEngLoadImage}
63 };
64
65 /*++
66 * @name DxEngDispUniq
67 * @implemented
68 *
69 * The function DxEngDispUniq returns the DisplayUniqVisrgn counter value from GDI shared memory
70 *
71 * @return
72 * Returns the DisplayUniqVisrgn counter value from GDI shared memory
73 *
74 * @remarks.
75 * none
76 *
77 *--*/
78 ULONG
79 APIENTRY
DxEngDispUniq(VOID)80 DxEngDispUniq(VOID)
81 {
82 DPRINT("ReactX Calling : DxEngDispUniq\n");
83 return GdiHandleTable->flDeviceUniq;
84 }
85
86 /*++
87 * @name DxEngGetDeviceGammaRamp
88 * @implemented
89 *
90 * The function DxEngGetDeviceGammaRamp gets the gamma ramp to dxg.sys.
91
92 * @param HDEV hPDev
93 * The hdev.
94 *
95 * @param PGAMMARAMP Ramp
96 * Pointer to store the gamma ramp value in.
97 *
98 * @return
99 *Returns TRUE for success, FALSE for failure
100 *
101 * @remarks.
102 * None
103 *
104 *--*/
105 BOOL
106 APIENTRY
DxEngGetDeviceGammaRamp(HDEV hPDev,PGAMMARAMP Ramp)107 DxEngGetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp)
108 {
109 DPRINT("ReactX Calling : DxEngGetDeviceGammaRamp\n");
110 return IntGetDeviceGammaRamp(hPDev, Ramp);
111 }
112
113 /*++
114 * @name DxEngLockDC
115 * @implemented
116 *
117 * The function DxEngLockDC locks a hdc from dxg.sys
118 *
119 * @param HDC hDC
120 * The handle we want to lock
121 *
122 * @return
123 * Returns PDC if lock succeeded or NULL if it failed.
124 *
125 * @remarks.
126 * none
127 *
128 *--*/
129 PDC
130 APIENTRY
DxEngLockDC(HDC hDC)131 DxEngLockDC(HDC hDC)
132 {
133 DPRINT("ReactX Calling : DxEngLockDC\n");
134 return DC_LockDc(hDC);
135 }
136
137 /*++
138 * @name DxEngUnlockDC
139 * @implemented
140 *
141 * The function DxEngUnlockDC unlocks a pDC (hdc) from dxg.sys.
142
143 * @param PDC pDC
144 * The handle we want to unlock.
145 *
146 * @return
147 * This function returns TRUE no matter what.
148 *
149 * @remarks.
150 * none
151 *
152 *--*/
153 BOOLEAN
154 APIENTRY
DxEngUnlockDC(PDC pDC)155 DxEngUnlockDC(PDC pDC)
156 {
157 DPRINT("ReactX Calling : DxEngUnlockDC\n");
158 DC_UnlockDc(pDC);
159 return TRUE;
160 }
161
162 /*++
163 * @name DxEngLockShareSem
164 * @implemented
165 *
166 * The function DxEngLockShareSem locks a struct of type ghsemShareDevLock that can be shared.
167 *
168 * @return
169 * This function returns TRUE for success and FALSE for failure.
170 * FALSE must mean the struct has already been locked.
171 *
172 * @remarks.
173 * It is being used in various ntuser* functions and ntgdi*
174 * ReactOS specific: It is not in use yet?
175 *SystemResourcesList
176 *--*/
177 BOOLEAN
178 APIENTRY
DxEngLockShareSem(VOID)179 DxEngLockShareSem(VOID)
180 {
181 DPRINT("ReactX Calling : DxEngLockShareSem\n");
182 if(!ghsemShareDevLock) ghsemShareDevLock = EngCreateSemaphore(); // Hax, should be in dllmain.c
183 EngAcquireSemaphore(ghsemShareDevLock);
184 return TRUE;
185 }
186
187 /*++
188 * @name DxEngUnlockShareSem
189 * @implemented
190 *
191 * The function DxEngUnlockShareSem unlocks the struct of type ghsemShareDevLock.
192 *
193 * @return
194 * This function returns TRUE no matter what.
195 *
196 * @remarks.
197 * ReactOS specific: It is not in use yet?
198 *
199 *--*/
200 BOOLEAN
201 APIENTRY
DxEngUnlockShareSem(VOID)202 DxEngUnlockShareSem(VOID)
203 {
204 DPRINT("ReactX Calling : DxEngUnlockShareSem\n");
205 EngReleaseSemaphore(ghsemShareDevLock);
206 return TRUE;
207 }
208
209 /*++
210 * @name DxEngSetDeviceGammaRamp
211 * @implemented
212 *
213 * The function DxEngSetDeviceGammaRamp sets gamma ramp from dxg.sys
214
215 * @param HDEV hPDev
216 * The hdev
217 *
218 * @param PGAMMARAMP Ramp
219 * Value to change gamma ramp to.
220 *
221 * @param BOOL Test
222 * Whether gamma should be tested. TRUE to test, FALSE to not test.
223 *
224 * @return
225 *Returns TRUE for success, FALSE for failure.
226 *
227 * @remarks.
228 * None
229 *
230 *--*/
231 BOOLEAN
232 APIENTRY
DxEngSetDeviceGammaRamp(HDEV hPDev,PGAMMARAMP Ramp,BOOL Test)233 DxEngSetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp, BOOL Test)
234 {
235 DPRINT("ReactX Calling : DxEngSetDeviceGammaRamp\n");
236 return IntSetDeviceGammaRamp(hPDev, Ramp, Test);
237 }
238
239 /*++
240 * @name DxEngGetHdevData
241 * @implemented
242 *
243 * The function DxEngGetHdevData retrieves a value from the HDEV
244
245 * @param HDEV hPDev
246 * The HDEV
247 *
248 * @param DXEGSHDEVDATA Type
249 * The following typs are supported
250 * Type Purpose
251 * DxEGShDevData_Surface Retrieve pointer to Surface handle.
252 * DxEGShDevData_hSpooler Device object of graphics driver.
253 * DxEGShDevData_DitherFmt Retrieve the device iDitherFormat
254 * DxEGShDevData_FxCaps Retrieve the device flGraphicsCaps
255 * DxEGShDevData_FxCaps2 Retrieve the device flGraphicsCaps2
256 * DxEGShDevData_DrvFuncs Retrieve the device DriverFunctions function table
257 * DxEGShDevData_dhpdev Retrieve the device hPDev, the real DHPDEV
258 * DxEGShDevData_eddg Retrieve the device pEDDgpl
259 * DxEGShDevData_dd_nCount Retrieve the device DxDd_nCount
260 * DxEGShDevData_dd_flags Retrieve the device DxDd_Flags
261 * DxEGShDevData_disable See if the device pdev is disabled
262 * DxEGShDevData_metadev See if the device pdev is a meta device
263 * DxEGShDevData_display See if the device is the primary display driver
264 * DxEGShDevData_Parent Retrieve the ppdevParent
265 * DxEGShDevData_OpenRefs Retrieve the pdevOpenRefs counter
266 * DxEGShDevData_palette See if the device RC_PALETTE is set
267 * DxEGShDevData_ldev ATM we do not support the Loader Device driver structure
268 * DxEGShDevData_GDev Retrieve the device pGraphicsDevice
269 * DxEGShDevData_clonedev Retrieve the device PDEV_CLONE_DEVICE flag is set or not
270 *
271 * @return
272 * Returns the data we requested
273 *
274 * @remarks.
275 * ReactOS specific: Implementation is incomplete, I do not save the value into the hdev yet.
276 *
277 *--*/
278 DWORD_PTR
279 APIENTRY
DxEngGetHdevData(HDEV hDev,DXEGSHDEVDATA Type)280 DxEngGetHdevData(HDEV hDev,
281 DXEGSHDEVDATA Type)
282 {
283 DWORD_PTR retVal = 0;
284 PPDEVOBJ PDev = (PPDEVOBJ)hDev;
285
286 DPRINT("ReactX Calling : DxEngGetHdevData, Type: %d\n", Type);
287
288 #if 1
289 DPRINT("hDev: %p\n", hDev);
290 #endif
291
292 switch ( Type )
293 {
294 case DxEGShDevData_Surface:
295 DPRINT("requested DxEGShDevData_Surface\n");
296 retVal = (DWORD_PTR) PDev->pSurface; // ptr to Surface handle.
297 break;
298 case DxEGShDevData_hSpooler:
299 DPRINT("requested DxEGShDevData_hSpooler\n");
300 retVal = (DWORD_PTR) PDev->hSpooler;
301 break;
302 case DxEGShDevData_DitherFmt:
303 DPRINT("requested DxEGShDevData_DitherFmt\n");
304 retVal = (DWORD_PTR) PDev->devinfo.iDitherFormat;
305 break;
306 case DxEGShDevData_FxCaps:
307 DPRINT("requested DxEGShDevData_FxCaps\n");
308 retVal = (DWORD_PTR) PDev->devinfo.flGraphicsCaps;
309 break;
310 case DxEGShDevData_FxCaps2:
311 DPRINT("requested DxEGShDevData_FxCaps2\n");
312 retVal = (DWORD_PTR) PDev->devinfo.flGraphicsCaps2;
313 break;
314 case DxEGShDevData_DrvFuncs:
315 DPRINT("requested DxEGShDevData_DrvFuncs\n");
316 retVal = (DWORD_PTR) &PDev->DriverFunctions;
317 break;
318 case DxEGShDevData_dhpdev:
319 DPRINT("requested DxEGShDevData_dhpdev\n");
320 retVal = (DWORD_PTR) PDev->dhpdev; // DHPDEV
321 break;
322 case DxEGShDevData_eddg:
323 DPRINT("requested DxEGShDevData_eddg\n");
324 retVal = (DWORD_PTR) PDev->pEDDgpl;
325 break;
326 case DxEGShDevData_dd_locks:
327 DPRINT("requested DxEGShDevData_dd_locks\n");
328 retVal = (DWORD_PTR) PDev->cDirectDrawDisableLocks;
329 break;
330 case DxEGShDevData_dd_flags:
331 DPRINT("requested DxEGShDevData_dd_flags\n");
332 retVal = (DWORD_PTR) PDev->DxDd_Flags;
333 break;
334 case DxEGShDevData_disable:
335 DPRINT("requested DxEGShDevData_disable\n");
336 retVal = (DWORD_PTR) PDev->flFlags & PDEV_DISABLED;
337 break;
338 case DxEGShDevData_metadev:
339 DPRINT("requested DxEGShDevData_metadev\n");
340 retVal = (DWORD_PTR) PDev->flFlags & PDEV_META_DEVICE;
341 break;
342 case DxEGShDevData_display:
343 DPRINT("requested DxEGShDevData_display\n");
344 retVal = (DWORD_PTR) PDev->flFlags & PDEV_DISPLAY;
345 break;
346 case DxEGShDevData_Parent:
347 DPRINT("requested DxEGShDevData_Parent\n");
348 retVal = (DWORD_PTR) PDev->ppdevParent;
349 break;
350 case DxEGShDevData_OpenRefs:
351 DPRINT("requested DxEGShDevData_OpenRefs\n");
352 retVal = (DWORD_PTR) PDev->cPdevOpenRefs != 0;
353 break;
354 case DxEGShDevData_palette:
355 DPRINT("requested DxEGShDevData_palette\n");
356 retVal = (DWORD_PTR) PDev->gdiinfo.flRaster & RC_PALETTE;
357 break;
358 case DxEGShDevData_ldev:
359 DPRINT("requested DxEGShDevData_ldev\n");
360 retVal = (DWORD_PTR) PDev->pldev;
361 break;
362 case DxEGShDevData_GDev:
363 DPRINT("requested DxEGShDevData_GDev\n");
364 retVal = (DWORD_PTR) PDev->pGraphicsDevice; // P"GRAPHICS_DEVICE"
365 break;
366 case DxEGShDevData_clonedev:
367 DPRINT("requested DxEGShDevData_clonedev\n");
368 retVal = (DWORD_PTR) PDev->flFlags & PDEV_CLONE_DEVICE;
369 break;
370 default:
371 // TODO: Make this default a bit more useful.
372 break;
373 }
374
375 #if 1
376 DPRINT("retVal: %08Ix\n", retVal);
377 #endif
378
379 return retVal;
380 }
381
382 /*++
383 * @name DxEngSetHdevData
384 * @implemented
385 *
386 * The function DxEngSetHdevData sets a value in hdev
387
388 * @param HDEV hPDev
389 * The hdev
390 *
391 * @param DXEGSHDEVDATA Type
392 * Supports only DxEGShDevData_dd_nCount. It is an internal counter on how many times hdev has been locked and unlocked
393 *
394 * @param DWORD Data
395 * The value to be saved to hdev's internal counter.
396 *
397 * @return
398 * Returns TRUE for success, FALSE for failure
399 *
400 * @remarks.
401 * none
402 *
403 *--*/
404 BOOLEAN
405 APIENTRY
DxEngSetHdevData(HDEV hDev,DXEGSHDEVDATA Type,DWORD_PTR Data)406 DxEngSetHdevData(HDEV hDev,
407 DXEGSHDEVDATA Type,
408 DWORD_PTR Data)
409 {
410 BOOLEAN retVal = FALSE; // Default, no set.
411
412 DPRINT("ReactX Calling : DxEngSetHdevData, Type: %d\n", Type);
413
414 if (Type == DxEGShDevData_dd_locks)
415 {
416 DPRINT("Assigning value: %Iu\n", Data);
417 ((PPDEVOBJ)hDev)->cDirectDrawDisableLocks = Data;
418 retVal = TRUE; // Set
419 }
420 return retVal;
421 }
422
423 /*++
424 * @name DxEngGetDCState
425 * @implemented
426 *
427 * The function DxEngGetDCState is capable of returning three
428 * DC states depending on what value is passed in its second parameter:
429 * 1. If the DC is full screen
430 * 2. Get Complexity of visible region
431 * 3. Get Driver hdev, which is ppdev
432 *
433 * @param HDC hdc
434 * The DC handle
435 *
436 * @param DWORD type
437 * value 1 = Is DC fullscreen
438 * value 2 = Get Complexity of visible region.
439 * value 3 = Get Driver hdev, which is a ppdev.
440 *
441 * @return
442 * Return one of the type values
443 *
444 * @remarks.
445 * none
446 *
447 *--*/
448 DWORD_PTR
449 APIENTRY
DxEngGetDCState(HDC hDC,DWORD type)450 DxEngGetDCState(HDC hDC,
451 DWORD type)
452 {
453 PDC pDC = DC_LockDc(hDC);
454 DWORD_PTR retVal = 0;
455
456 DPRINT("ReactX Calling : DxEngGetDCState, type: %lu\n", type);
457
458 if (pDC)
459 {
460 switch (type)
461 {
462 case 1:
463 retVal = (DWORD_PTR) pDC->fs & DC_FULLSCREEN;
464 break;
465 case 2:
466 /* Return the complexity of the visible region. */
467 retVal = (DWORD_PTR) REGION_Complexity(pDC->prgnVis);
468 break;
469 case 3:
470 {
471 /* Return the HDEV of this DC. */
472 retVal = (DWORD_PTR) pDC->ppdev;
473 break;
474 }
475 default:
476 /* If a valid type is not found, zero is returned */
477 DPRINT1("Warning: did not find type %lu\n", type);
478 break;
479 }
480 DC_UnlockDc(pDC);
481 }
482
483 DPRINT("retVal: %08Ix\n", retVal);
484
485 return retVal;
486 }
487
488 /*++
489 * @name DxEngIncDispUniq
490 * @implemented
491 *
492 * The function DxEngIncDispUniq increments the DisplayUniqVisrgn counter from GDI shared memory.
493 *
494 * @return
495 * This function returns TRUE no matter what.
496 *
497 * @remarks.
498 * none
499 *
500 *--*/
501 BOOLEAN
502 APIENTRY
DxEngIncDispUniq(VOID)503 DxEngIncDispUniq(VOID)
504 {
505 DPRINT("ReactX Calling : DxEngIncDispUniq\n");
506
507 InterlockedIncrement((LONG*)&GdiHandleTable->flDeviceUniq);
508 return TRUE;
509 }
510
511 /*++
512 * @name DxEngLockHdev
513 * @implemented
514 *
515 * The function DxEngLockHdev lock the internal PDEV
516 *
517 * @param HDEV type
518 * it is a pointer to win32k internal pdev struct known as PPDEVOBJ
519
520 * @return
521 * This function returns TRUE no matter what.
522 *
523 * @remarks.
524 * none
525 *
526 *--*/
527 BOOLEAN
528 APIENTRY
DxEngLockHdev(HDEV hDev)529 DxEngLockHdev(HDEV hDev)
530 {
531 PPDEVOBJ ppdev = (PPDEVOBJ)hDev;
532 PERESOURCE Resource;
533
534 DPRINT("ReactX Calling : DxEngLockHdev\n");
535
536 DPRINT("hDev: %p\n", hDev);
537
538 Resource = (PERESOURCE)ppdev->hsemDevLock;
539
540 if (Resource)
541 {
542 KeEnterCriticalRegion();
543 ExAcquireResourceExclusiveLite( Resource , TRUE); // Lock monitor.
544 }
545 return TRUE;
546 }
547
548 /*++
549 * @name DxEngUnlockHdev
550 * @implemented
551 *
552 * The function DxEngUnlockHdev unlock the internal PDEV
553 *
554 * @param HDEV type
555 * it is a pointer to win32k internal pdev struct known as PPDEVOBJ
556
557 * @return
558 * This function returns TRUE no matter what.
559 *
560 * @remarks.
561 * none
562 *
563 *--*/
564 BOOLEAN
565 APIENTRY
DxEngUnlockHdev(HDEV hDev)566 DxEngUnlockHdev(HDEV hDev)
567 {
568 PPDEVOBJ ppdev = (PPDEVOBJ)hDev;
569 PERESOURCE Resource = (PERESOURCE)ppdev->hsemDevLock;
570
571 DPRINT("ReactX Calling : DxEngUnlockHdev\n");
572
573 if (Resource)
574 {
575 ExReleaseResourceLite( Resource );
576 KeLeaveCriticalRegion();
577 }
578 return TRUE;
579 }
580
581 /************************************************************************/
582 /* DxEngReferenceHdev */
583 /************************************************************************/
584 BOOLEAN
585 APIENTRY
DxEngReferenceHdev(HDEV hDev)586 DxEngReferenceHdev(HDEV hDev)
587 {
588 PDEVOBJ_vReference((PPDEVOBJ)hDev);
589 /* ALWAYS return true */
590 return TRUE;
591 }
592
593 /************************************************************************/
594 /* DxEngNUIsTermSrv */
595 /************************************************************************/
596
597 /* Notes: Check if terminal server got connections or not */
598 BOOLEAN
599 APIENTRY
DxEngNUIsTermSrv(VOID)600 DxEngNUIsTermSrv(VOID)
601 {
602 /* FIXME: ReactOS does not suport terminal server yet, we can not check if we got connections or not */
603 UNIMPLEMENTED;
604 return FALSE;
605 }
606
607 /************************************************************************/
608 /* DxEngRedrawDesktop */
609 /************************************************************************/
610
611 /* Notes: it always returns TRUE, and it updates whole screen
612 (redraws current desktop) */
613 BOOLEAN
614 APIENTRY
DxEngRedrawDesktop(VOID)615 DxEngRedrawDesktop(VOID)
616 {
617 UserRedrawDesktop();
618 return TRUE;
619 }
620
621 ULONG gulVisRgnUniqueness; // Increase count everytime client region is updated.
622
623 /************************************************************************/
624 /* DxEngVisRgnUniq */
625 /************************************************************************/
626 /* Notes: returns the VisRgnUniq counter for win32k */
627 ULONG
628 APIENTRY
DxEngVisRgnUniq(VOID)629 DxEngVisRgnUniq(VOID)
630 {
631 DPRINT("ReactX Calling : DxEngVisRgnUniq\n");
632
633 return gulVisRgnUniqueness;
634 }
635
636 /************************************************************************/
637 /* DxEngEnumerateHdev */
638 /************************************************************************/
639 /* Enumerate all drivers in win32k */
640 HDEV *
641 APIENTRY
DxEngEnumerateHdev(HDEV * hdev)642 DxEngEnumerateHdev(HDEV *hdev)
643 {
644 /* FIXME: Enumerate all drivers in win32k */
645 UNIMPLEMENTED;
646 return FALSE;
647 }
648
649 /************************************************************************/
650 /* DxEngCreateMemoryDC */
651 /************************************************************************/
652 HDC
653 APIENTRY
DxEngCreateMemoryDC(HDEV hDev)654 DxEngCreateMemoryDC(HDEV hDev)
655 {
656 return IntGdiCreateDisplayDC(hDev, DCTYPE_MEMORY, FALSE);
657 }
658
659 /************************************************************************/
660 /* DxEngScreenAccessCheck */
661 /************************************************************************/
DxEngScreenAccessCheck(VOID)662 DWORD APIENTRY DxEngScreenAccessCheck(VOID)
663 {
664 UNIMPLEMENTED;
665
666 /* We're cheating here and telling dxg.sys it has always had permissions to access the screen */
667 return TRUE;
668 }
669
670 /************************************************************************/
671 /* DxEngIsHdevLockedByCurrentThread */
672 /************************************************************************/
673 BOOLEAN
674 APIENTRY
DxEngIsHdevLockedByCurrentThread(HDEV hDev)675 DxEngIsHdevLockedByCurrentThread(HDEV hDev)
676 { // Based on EngIsSemaphoreOwnedByCurrentThread w/o the Ex call.
677 PERESOURCE pSem = (PERESOURCE)(((PPDEVOBJ)hDev)->hsemDevLock);
678 return pSem->OwnerEntry.OwnerThread == (ERESOURCE_THREAD)PsGetCurrentThread();
679 }
680
681 /************************************************************************/
682 /* DxEngUnreferenceHdev */
683 /************************************************************************/
684 BOOLEAN
685 APIENTRY
DxEngUnreferenceHdev(HDEV hDev)686 DxEngUnreferenceHdev(HDEV hDev)
687 {
688 PDEVOBJ_vRelease((PPDEVOBJ)hDev);
689 return TRUE; // Always true.
690 }
691
692 /************************************************************************/
693 /* DxEngGetDesktopDC */
694 /************************************************************************/
695 HDC
696 APIENTRY
DxEngGetDesktopDC(ULONG DcType,BOOL EmptyDC,BOOL ValidatehWnd)697 DxEngGetDesktopDC(ULONG DcType, BOOL EmptyDC, BOOL ValidatehWnd)
698 {
699 return UserGetDesktopDC(DcType, EmptyDC, ValidatehWnd);
700 }
701
702 /************************************************************************/
703 /* DxEngDeleteDC */
704 /************************************************************************/
705 BOOLEAN
706 APIENTRY
DxEngDeleteDC(HDC hdc,BOOL Force)707 DxEngDeleteDC(HDC hdc, BOOL Force)
708 {
709 return IntGdiDeleteDC(hdc, Force);
710 }
711
712 /************************************************************************/
713 /* DxEngCleanDC */
714 /************************************************************************/
715 BOOLEAN
716 APIENTRY
DxEngCleanDC(HDC hdc)717 DxEngCleanDC(HDC hdc)
718 {
719 return IntGdiCleanDC(hdc);
720 }
721
722 /************************************************************************/
723 /* DxEngSetDCOwner */
724 /************************************************************************/
DxEngSetDCOwner(HGDIOBJ hObject,DWORD OwnerMask)725 BOOL APIENTRY DxEngSetDCOwner(HGDIOBJ hObject, DWORD OwnerMask)
726 {
727 DPRINT("ReactX Calling : DxEngSetDCOwner\n");
728
729 return GreSetDCOwner(hObject, OwnerMask);
730 }
731
732 /************************************************************************/
733 /* DxEngSetDCState */
734 /************************************************************************/
735 BOOLEAN
736 APIENTRY
DxEngSetDCState(HDC hDC,DWORD SetType,DWORD Set)737 DxEngSetDCState(HDC hDC, DWORD SetType, DWORD Set)
738 {
739 BOOLEAN Ret = FALSE;
740 PDC pDC = DC_LockDc(hDC);
741
742 if (pDC)
743 {
744 if (SetType == 1)
745 {
746 if ( Set )
747 pDC->fs |= DC_FULLSCREEN;
748 else
749 pDC->fs &= ~DC_FULLSCREEN;
750 Ret = TRUE;
751 }
752 DC_UnlockDc(pDC);
753 return Ret; // Everything else returns FALSE.
754 }
755 return Ret;
756 }
757
758 /************************************************************************/
759 /* DxEngSelectBitmap */
760 /************************************************************************/
DxEngSelectBitmap(HDC hdc,HBITMAP hbmp)761 HBITMAP APIENTRY DxEngSelectBitmap(HDC hdc, HBITMAP hbmp)
762 {
763 DPRINT("ReactX Calling : DxEngSelectBitmap\n");
764
765 return NtGdiSelectBitmap(hdc, hbmp);
766 }
767
768 /************************************************************************/
769 /* DxEngSetBitmapOwner */
770 /************************************************************************/
DxEngSetBitmapOwner(HBITMAP hbmp,ULONG ulOwner)771 BOOLEAN APIENTRY DxEngSetBitmapOwner(HBITMAP hbmp, ULONG ulOwner)
772 {
773 DPRINT("ReactX Calling : DxEngSetBitmapOwner\n");
774
775 return GreSetBitmapOwner(hbmp, ulOwner);
776 }
777
778 /************************************************************************/
779 /* DxEngDeleteSurface */
780 /************************************************************************/
DxEngDeleteSurface(HSURF hsurf)781 BOOLEAN APIENTRY DxEngDeleteSurface(HSURF hsurf)
782 {
783 DPRINT("ReactX Calling : DxEngDeleteSurface\n");
784
785 return EngDeleteSurface(hsurf);
786 }
787
788 /************************************************************************/
789 /* DxEngGetSurfaceData */
790 /************************************************************************/
DxEngGetSurfaceData(DWORD x1,DWORD x2)791 DWORD APIENTRY DxEngGetSurfaceData(DWORD x1, DWORD x2)
792 {
793 UNIMPLEMENTED;
794 return FALSE;
795 }
796
797 /************************************************************************/
798 /* DxEngAltLockSurface */
799 /************************************************************************/
DxEngAltLockSurface(HSURF hsurf)800 SURFOBJ * APIENTRY DxEngAltLockSurface(HSURF hsurf)
801 {
802 DPRINT("ReactX Calling : DxEngAltLockSurface\n");
803
804 return EngLockSurface(hsurf);
805 }
806
807 /************************************************************************/
808 /* DxEngUploadPaletteEntryToSurface */
809 /************************************************************************/
DxEngUploadPaletteEntryToSurface(DWORD x1,DWORD x2,DWORD x3,DWORD x4)810 DWORD APIENTRY DxEngUploadPaletteEntryToSurface(DWORD x1, DWORD x2,DWORD x3, DWORD x4)
811 {
812 UNIMPLEMENTED;
813 return FALSE;
814 }
815
816 /************************************************************************/
817 /* DxEngMarkSurfaceAsDirectDraw */
818 /************************************************************************/
DxEngMarkSurfaceAsDirectDraw(DWORD x1,DWORD x2)819 DWORD APIENTRY DxEngMarkSurfaceAsDirectDraw(DWORD x1, DWORD x2)
820 {
821 UNIMPLEMENTED;
822 return FALSE;
823 }
824
825 /************************************************************************/
826 /* DxEngSelectPaletteToSurface */
827 /************************************************************************/
DxEngSelectPaletteToSurface(DWORD x1,DWORD x2)828 DWORD APIENTRY DxEngSelectPaletteToSurface(DWORD x1, DWORD x2)
829 {
830 UNIMPLEMENTED;
831 return FALSE;
832 }
833
834 /************************************************************************/
835 /* DxEngSyncPaletteTableWithDevice */
836 /************************************************************************/
DxEngSyncPaletteTableWithDevice(DWORD x1,DWORD x2)837 DWORD APIENTRY DxEngSyncPaletteTableWithDevice(DWORD x1, DWORD x2)
838 {
839 UNIMPLEMENTED;
840 return FALSE;
841 }
842
843 /************************************************************************/
844 /* DxEngSetPaletteState */
845 /************************************************************************/
DxEngSetPaletteState(DWORD x1,DWORD x2,DWORD x3)846 DWORD APIENTRY DxEngSetPaletteState(DWORD x1, DWORD x2, DWORD x3)
847 {
848 UNIMPLEMENTED;
849 return FALSE;
850 }
851
852 /************************************************************************/
853 /* DxEngGetRedirectionBitmap */
854 /************************************************************************/
855 DWORD
856 APIENTRY
DxEngGetRedirectionBitmap(DWORD x1)857 DxEngGetRedirectionBitmap(DWORD x1)
858 {
859 return FALSE; // Normal return.
860 }
861
862 /************************************************************************/
863 /* DxEngLoadImage */
864 /************************************************************************/
DxEngLoadImage(DWORD x1,DWORD x2)865 DWORD APIENTRY DxEngLoadImage(DWORD x1,DWORD x2)
866 {
867 UNIMPLEMENTED;
868 return FALSE;
869 }
870
871 /************************************************************************/
872 /* DxEngSpTearDownSprites */
873 /************************************************************************/
DxEngSpTearDownSprites(DWORD x1,DWORD x2,DWORD x3)874 DWORD APIENTRY DxEngSpTearDownSprites(DWORD x1, DWORD x2, DWORD x3)
875 {
876 UNIMPLEMENTED;
877 return FALSE;
878 }
879
880 /************************************************************************/
881 /* DxEngSpUnTearDownSprites */
882 /************************************************************************/
DxEngSpUnTearDownSprites(DWORD x1,DWORD x2,DWORD x3)883 DWORD APIENTRY DxEngSpUnTearDownSprites(DWORD x1, DWORD x2, DWORD x3)
884 {
885 UNIMPLEMENTED;
886 return FALSE;
887 }
888
889 /************************************************************************/
890 /* DxEngSpSpritesVisible */
891 /************************************************************************/
DxEngSpSpritesVisible(DWORD x1)892 DWORD APIENTRY DxEngSpSpritesVisible(DWORD x1)
893 {
894 UNIMPLEMENTED;
895 return FALSE;
896 }
897