2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS GDI32
4 * PURPOSE: GDI DirectX inteface
5 * FILE: lib/gdi32/misc/gdientry.c
6 * PROGRAMERS: Alex Ionescu (alex@relsoft.net)
7 * Magnus Olsen (magnus@greatlord.com)
10 /* INCLUDES ******************************************************************/
17 /* DATA **********************************************************************/
22 #define GetDdHandle(Handle) ((HANDLE)Handle ? (HANDLE)Handle : ghDirectDraw)
26 /* CALLBACKS *****************************************************************/
31 * DdAddAttachedSurface
35 DdAddAttachedSurface(LPDDHAL_ADDATTACHEDSURFACEDATA Attach
)
38 return NtGdiDdAddAttachedSurface((HANDLE
)Attach
->lpDDSurface
->hDDSurface
,
39 (HANDLE
)Attach
->lpSurfAttached
->hDDSurface
,
40 (PDD_ADDATTACHEDSURFACEDATA
)Attach
);
50 DdBlt(LPDDHAL_BLTDATA Blt
)
54 /* Use the right surface */
55 if (Blt
->lpDDSrcSurface
)
57 Surface
= (HANDLE
)Blt
->lpDDSrcSurface
->hDDSurface
;
61 return NtGdiDdBlt((HANDLE
)Blt
->lpDDDestSurface
->hDDSurface
, Surface
, (PDD_BLTDATA
)Blt
);
71 DdDestroySurface(LPDDHAL_DESTROYSURFACEDATA pDestroySurface
)
73 DWORD Return
= DDHAL_DRIVER_NOTHANDLED
;
76 if (pDestroySurface
->lpDDSurface
->hDDSurface
)
78 /* Check if we shoudl really destroy it */
79 RealDestroy
= !(pDestroySurface
->lpDDSurface
->dwFlags
& DDRAWISURF_DRIVERMANAGED
) ||
80 !(pDestroySurface
->lpDDSurface
->dwFlags
& DDRAWISURF_INVALID
);
83 Return
= NtGdiDdDestroySurface((HANDLE
)pDestroySurface
->lpDDSurface
->hDDSurface
, RealDestroy
);
96 DdFlip(LPDDHAL_FLIPDATA Flip
)
99 * See http://msdn2.microsoft.com/en-us/library/ms794213.aspx and
100 * http://msdn2.microsoft.com/en-us/library/ms792675.aspx
103 HANDLE hSurfaceCurrentLeft
= NULL
;
104 HANDLE hSurfaceTargetLeft
= NULL
;
106 /* Auto flip off or on */
107 if (Flip
->dwFlags
& DDFLIP_STEREO
)
109 if ( (Flip
->lpSurfTargLeft
) &&
110 (Flip
->lpSurfCurrLeft
))
113 hSurfaceTargetLeft
= (HANDLE
) Flip
->lpSurfTargLeft
->hDDSurface
;
114 hSurfaceCurrentLeft
= (HANDLE
) Flip
->lpSurfCurrLeft
->hDDSurface
;
119 return NtGdiDdFlip( (HANDLE
) Flip
->lpSurfCurr
->hDDSurface
,
120 (HANDLE
) Flip
->lpSurfTarg
->hDDSurface
,
123 (PDD_FLIPDATA
) Flip
);
133 DdLock(LPDDHAL_LOCKDATA Lock
)
137 return NtGdiDdLock((HANDLE
)Lock
->lpDDSurface
->hDDSurface
,
139 (HANDLE
)Lock
->lpDDSurface
->hDC
);
149 DdUnlock(LPDDHAL_UNLOCKDATA Unlock
)
152 return NtGdiDdUnlock((HANDLE
)Unlock
->lpDDSurface
->hDDSurface
,
153 (PDD_UNLOCKDATA
)Unlock
);
163 DdGetBltStatus(LPDDHAL_GETBLTSTATUSDATA GetBltStatus
)
166 return NtGdiDdGetBltStatus((HANDLE
)GetBltStatus
->lpDDSurface
->hDDSurface
,
167 (PDD_GETBLTSTATUSDATA
)GetBltStatus
);
177 DdGetFlipStatus(LPDDHAL_GETFLIPSTATUSDATA GetFlipStatus
)
180 return NtGdiDdGetFlipStatus((HANDLE
)GetFlipStatus
->lpDDSurface
->hDDSurface
,
181 (PDD_GETFLIPSTATUSDATA
)GetFlipStatus
);
191 DdUpdateOverlay(LPDDHAL_UPDATEOVERLAYDATA UpdateOverlay
)
194 /* We have to handle this manually here */
195 if (UpdateOverlay
->dwFlags
& DDOVER_KEYDEST
)
197 /* Use the override */
198 UpdateOverlay
->dwFlags
&= ~DDOVER_KEYDEST
;
199 UpdateOverlay
->dwFlags
|= DDOVER_KEYDESTOVERRIDE
;
201 /* Set the overlay */
202 UpdateOverlay
->overlayFX
.dckDestColorkey
=
203 UpdateOverlay
->lpDDDestSurface
->ddckCKDestOverlay
;
205 if (UpdateOverlay
->dwFlags
& DDOVER_KEYSRC
)
207 /* Use the override */
208 UpdateOverlay
->dwFlags
&= ~DDOVER_KEYSRC
;
209 UpdateOverlay
->dwFlags
|= DDOVER_KEYSRCOVERRIDE
;
211 /* Set the overlay */
212 UpdateOverlay
->overlayFX
.dckSrcColorkey
=
213 UpdateOverlay
->lpDDSrcSurface
->ddckCKSrcOverlay
;
217 return NtGdiDdUpdateOverlay((HANDLE
)UpdateOverlay
->lpDDDestSurface
->hDDSurface
,
218 (HANDLE
)UpdateOverlay
->lpDDSrcSurface
->hDDSurface
,
219 (PDD_UPDATEOVERLAYDATA
)UpdateOverlay
);
225 * DdSetOverlayPosition
229 DdSetOverlayPosition(LPDDHAL_SETOVERLAYPOSITIONDATA SetOverlayPosition
)
232 return NtGdiDdSetOverlayPosition( (HANDLE
)SetOverlayPosition
->lpDDSrcSurface
->hDDSurface
,
233 (HANDLE
)SetOverlayPosition
->lpDDDestSurface
->hDDSurface
,
234 (PDD_SETOVERLAYPOSITIONDATA
) SetOverlayPosition
);
240 * DdWaitForVerticalBlank
244 DdWaitForVerticalBlank(LPDDHAL_WAITFORVERTICALBLANKDATA WaitForVerticalBlank
)
247 return NtGdiDdWaitForVerticalBlank(GetDdHandle(
248 WaitForVerticalBlank
->lpDD
->hDD
),
249 (PDD_WAITFORVERTICALBLANKDATA
)
250 WaitForVerticalBlank
);
260 DdCanCreateSurface(LPDDHAL_CANCREATESURFACEDATA CanCreateSurface
)
263 * Note : This functions are basic same, in win32k
264 * NtGdiDdCanCreateD3DBuffer and NtGdiDdCanCreateSurface are mergs
265 * toghter in win32k at end and retrurn same data, it is still sepreated
266 * at user mode but in kmode it is not.
270 return NtGdiDdCanCreateSurface(GetDdHandle(CanCreateSurface
->lpDD
->hDD
),
271 (PDD_CANCREATESURFACEDATA
)CanCreateSurface
);
281 DdCreateSurface(LPDDHAL_CREATESURFACEDATA pCreateSurface
)
283 DWORD Return
= DDHAL_DRIVER_NOTHANDLED
;
284 ULONG SurfaceCount
= pCreateSurface
->dwSCnt
;
285 DD_SURFACE_LOCAL DdSurfaceLocal
;
286 DD_SURFACE_MORE DdSurfaceMore
;
287 DD_SURFACE_GLOBAL DdSurfaceGlobal
;
289 HANDLE hPrevSurface
, hSurface
;
291 PDD_SURFACE_LOCAL pDdSurfaceLocal
= NULL
;
292 PDD_SURFACE_MORE pDdSurfaceMore
= NULL
;
293 PDD_SURFACE_GLOBAL pDdSurfaceGlobal
= NULL
;
295 PDD_SURFACE_LOCAL ptmpDdSurfaceLocal
= NULL
;
296 PDD_SURFACE_MORE ptmpDdSurfaceMore
= NULL
;
297 PDD_SURFACE_GLOBAL ptmpDdSurfaceGlobal
= NULL
;
298 PHANDLE phSurface
= NULL
, puhSurface
= NULL
;
300 LPDDSURFACEDESC pSurfaceDesc
= NULL
;
302 /* TODO: Optimize speed. Most games/dx apps/programs do not want one surface, they want at least two.
303 * So we need increase the stack to contain two surfaces instead of one. This will increase
304 * the speed of the apps when allocating buffers. How to increase the surface stack space:
305 * we need to create a struct for DD_SURFACE_LOCAL DdSurfaceLocal, DD_SURFACE_MORE DdSurfaceMore
306 * DD_SURFACE_GLOBAL DdSurfaceGlobal, HANDLE hPrevSurface, hSurface like
307 * struct { DD_SURFACE_LOCAL DdSurfaceLocal1, DD_SURFACE_LOCAL DdSurfaceLocal2 }
308 * in a way that it may contain two surfaces, maybe even four. We need to watch what is most common before
309 * we create the size. Activate this IF when you start doing the optimze and please also
310 * take reports from users which value they got here.
316 sprintf ( buffer
, "Function %s : Optimze max to %d Surface ? (%s:%d)\n", __FUNCTION__
, (int)SurfaceCount
,__FILE__
,__LINE__
);
317 OutputDebugStringA(buffer
);
321 /* Check how many surfaces there are */
322 if (SurfaceCount
!= 1)
324 /* We got more than one surface, so we need to allocate memory for them */
325 pDdSurfaceLocal
= (PDD_SURFACE_LOCAL
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(DD_SURFACE_LOCAL
) * SurfaceCount
));
326 pDdSurfaceMore
= (PDD_SURFACE_MORE
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(DD_SURFACE_MORE
) * SurfaceCount
));
327 pDdSurfaceGlobal
= (PDD_SURFACE_GLOBAL
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(DD_SURFACE_GLOBAL
) * SurfaceCount
));
328 phSurface
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(HANDLE
) * SurfaceCount
));
329 puhSurface
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(HANDLE
) * SurfaceCount
));
331 /* Check if we successfully allocated all memory we need */
332 if ((pDdSurfaceLocal
== NULL
) || (pDdSurfaceMore
== NULL
) || (pDdSurfaceGlobal
== NULL
) || (phSurface
== NULL
) || (puhSurface
== NULL
))
334 pCreateSurface
->ddRVal
= DDERR_OUTOFMEMORY
;
336 if ( pDdSurfaceLocal
!= NULL
)
338 HeapFree(GetProcessHeap(), 0, pDdSurfaceLocal
);
341 if ( pDdSurfaceMore
!= NULL
)
343 HeapFree(GetProcessHeap(), 0, pDdSurfaceMore
);
346 if ( pDdSurfaceGlobal
!= NULL
)
348 HeapFree(GetProcessHeap(), 0, pDdSurfaceGlobal
);
351 if ( phSurface
!= NULL
)
353 HeapFree(GetProcessHeap(), 0, phSurface
);
356 if ( puhSurface
!= NULL
)
358 HeapFree(GetProcessHeap(), 0, puhSurface
);
361 return DDHAL_DRIVER_HANDLED
;
366 /* We'll use what we have on the stack */
367 pDdSurfaceLocal
= &DdSurfaceLocal
;
368 pDdSurfaceMore
= &DdSurfaceMore
;
369 pDdSurfaceGlobal
= &DdSurfaceGlobal
;
370 phSurface
= &hPrevSurface
;
371 puhSurface
= &hSurface
;
373 /* Clear the structures */
374 RtlZeroMemory(&DdSurfaceLocal
, sizeof(DdSurfaceLocal
));
375 RtlZeroMemory(&DdSurfaceGlobal
, sizeof(DdSurfaceGlobal
));
376 RtlZeroMemory(&DdSurfaceMore
, sizeof(DdSurfaceMore
));
379 /* check if we got a surface or not */
382 /* Loop for each surface */
383 ptmpDdSurfaceGlobal
= pDdSurfaceGlobal
;
384 ptmpDdSurfaceLocal
= pDdSurfaceLocal
;
385 ptmpDdSurfaceMore
= pDdSurfaceMore
;
386 pSurfaceDesc
= pCreateSurface
->lpDDSurfaceDesc
;
388 for (i
= 0; i
< SurfaceCount
; i
++)
390 LPDDRAWI_DDRAWSURFACE_LCL lcl
= pCreateSurface
->lplpSList
[i
];
391 LPDDRAWI_DDRAWSURFACE_GBL gpl
= pCreateSurface
->lplpSList
[i
]->lpGbl
;
393 phSurface
[i
] = (HANDLE
)lcl
->hDDSurface
;
394 ptmpDdSurfaceLocal
->ddsCaps
.dwCaps
= lcl
->ddsCaps
.dwCaps
;
396 ptmpDdSurfaceLocal
->dwFlags
= (ptmpDdSurfaceLocal
->dwFlags
&
397 (0xB0000000 | DDRAWISURF_INMASTERSPRITELIST
|
398 DDRAWISURF_HELCB
| DDRAWISURF_FRONTBUFFER
|
399 DDRAWISURF_BACKBUFFER
| DDRAWISURF_INVALID
|
400 DDRAWISURF_DCIBUSY
| DDRAWISURF_DCILOCK
)) |
401 (lcl
->dwFlags
& DDRAWISURF_DRIVERMANAGED
);
403 ptmpDdSurfaceGlobal
->wWidth
= gpl
->wWidth
;
404 ptmpDdSurfaceGlobal
->wHeight
= gpl
->wHeight
;
405 ptmpDdSurfaceGlobal
->lPitch
= gpl
->lPitch
;
406 ptmpDdSurfaceGlobal
->fpVidMem
= gpl
->fpVidMem
;
407 ptmpDdSurfaceGlobal
->dwBlockSizeX
= gpl
->dwBlockSizeX
;
408 ptmpDdSurfaceGlobal
->dwBlockSizeY
= gpl
->dwBlockSizeY
;
410 if (lcl
->dwFlags
& DDRAWISURF_HASPIXELFORMAT
)
412 RtlCopyMemory( &ptmpDdSurfaceGlobal
->ddpfSurface
,
414 sizeof(DDPIXELFORMAT
));
416 ptmpDdSurfaceGlobal
->ddpfSurface
.dwSize
= sizeof(DDPIXELFORMAT
);
420 RtlCopyMemory( &ptmpDdSurfaceGlobal
->ddpfSurface
,
421 &gpl
->lpDD
->vmiData
.ddpfDisplay
,
422 sizeof(DDPIXELFORMAT
));
425 /* Note if lcl->lpSurfMore is NULL zero out
426 * ptmpDdSurfaceMore->ddsCapsEx.dwCaps2,
427 * dwCaps3, dwCaps4, ptmpDdSurfaceMore->dwSurfaceHandle
431 ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps2
= lcl
->lpSurfMore
->ddsCapsEx
.dwCaps2
;
432 ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps3
= lcl
->lpSurfMore
->ddsCapsEx
.dwCaps3
;
433 ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps4
= lcl
->lpSurfMore
->ddsCapsEx
.dwCaps4
;
434 ptmpDdSurfaceMore
->dwSurfaceHandle
= lcl
->lpSurfMore
->dwSurfaceHandle
;
438 /* count to next SurfaceCount */
439 ptmpDdSurfaceGlobal
= (PDD_SURFACE_GLOBAL
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceGlobal
)) + sizeof(DD_SURFACE_GLOBAL
));
440 ptmpDdSurfaceLocal
= (PDD_SURFACE_LOCAL
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceLocal
)) + sizeof(DD_SURFACE_LOCAL
));
441 ptmpDdSurfaceMore
= (PDD_SURFACE_MORE
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceMore
)) + sizeof(DD_SURFACE_MORE
));
445 /* Call win32k now */
446 pCreateSurface
->ddRVal
= DDERR_GENERIC
;
448 Return
= NtGdiDdCreateSurface(GetDdHandle(pCreateSurface
->lpDD
->hDD
),
454 (PDD_CREATESURFACEDATA
)pCreateSurface
,
457 if (SurfaceCount
== 0)
459 pCreateSurface
->ddRVal
= DDERR_GENERIC
;
463 ptmpDdSurfaceMore
= pDdSurfaceMore
;
464 ptmpDdSurfaceGlobal
= pDdSurfaceGlobal
;
465 ptmpDdSurfaceLocal
= pDdSurfaceLocal
;
467 for (i
=0; i
<SurfaceCount
; i
++)
469 LPDDRAWI_DDRAWSURFACE_LCL lcl
= pCreateSurface
->lplpSList
[i
];
470 LPDDRAWI_DDRAWSURFACE_GBL gpl
= pCreateSurface
->lplpSList
[i
]->lpGbl
;
472 gpl
->lPitch
= ptmpDdSurfaceGlobal
->lPitch
;
473 gpl
->fpVidMem
= ptmpDdSurfaceGlobal
->fpVidMem
;
474 gpl
->dwBlockSizeX
= ptmpDdSurfaceGlobal
->dwBlockSizeX
;
475 gpl
->dwBlockSizeY
= ptmpDdSurfaceGlobal
->dwBlockSizeY
;
477 if (lcl
->dwFlags
& DDRAWISURF_HASPIXELFORMAT
)
479 RtlCopyMemory( &gpl
->ddpfSurface
, &ptmpDdSurfaceGlobal
->ddpfSurface
, sizeof(DDPIXELFORMAT
));
482 if (pCreateSurface
->ddRVal
!= DD_OK
)
487 NtGdiDdDeleteSurfaceObject( (HANDLE
)lcl
->hDDSurface
);
494 lcl
->hDDSurface
= (ULONG_PTR
) puhSurface
[i
];
497 lcl
->ddsCaps
.dwCaps
= ptmpDdSurfaceLocal
->ddsCaps
.dwCaps
;
500 lcl
->lpSurfMore
->ddsCapsEx
.dwCaps2
= ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps2
;
501 lcl
->lpSurfMore
->ddsCapsEx
.dwCaps3
= ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps3
;
502 lcl
->lpSurfMore
->ddsCapsEx
.dwCaps4
= ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps4
;
505 /* count to next SurfaceCount */
506 ptmpDdSurfaceGlobal
= (PDD_SURFACE_GLOBAL
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceGlobal
)) + sizeof(DD_SURFACE_GLOBAL
));
507 ptmpDdSurfaceLocal
= (PDD_SURFACE_LOCAL
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceLocal
)) + sizeof(DD_SURFACE_LOCAL
));
508 ptmpDdSurfaceMore
= (PDD_SURFACE_MORE
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceMore
)) + sizeof(DD_SURFACE_MORE
));
512 /* Check if we have to free all our local allocations */
513 if (SurfaceCount
> 1)
515 if ( pDdSurfaceLocal
!= NULL
)
517 HeapFree(GetProcessHeap(), 0, pDdSurfaceLocal
);
520 if ( pDdSurfaceMore
!= NULL
)
522 HeapFree(GetProcessHeap(), 0, pDdSurfaceMore
);
525 if ( pDdSurfaceGlobal
!= NULL
)
527 HeapFree(GetProcessHeap(), 0, pDdSurfaceGlobal
);
530 if ( phSurface
!= NULL
)
532 HeapFree(GetProcessHeap(), 0, phSurface
);
535 if ( puhSurface
!= NULL
)
537 HeapFree(GetProcessHeap(), 0, puhSurface
);
552 DdSetColorKey(LPDDHAL_SETCOLORKEYDATA pSetColorKey
)
555 return NtGdiDdSetColorKey((HANDLE
)pSetColorKey
->lpDDSurface
->hDDSurface
,
556 (PDD_SETCOLORKEYDATA
)pSetColorKey
);
566 DdGetScanLine(LPDDHAL_GETSCANLINEDATA pGetScanLine
)
569 return NtGdiDdGetScanLine(GetDdHandle(pGetScanLine
->lpDD
->hDD
),
570 (PDD_GETSCANLINEDATA
)pGetScanLine
);
581 DvpCreateVideoPort(LPDDHAL_CREATEVPORTDATA pDvdCreatePort
)
583 pDvdCreatePort
->lpVideoPort
->hDDVideoPort
=
584 NtGdiDvpCreateVideoPort(GetDdHandle(pDvdCreatePort
->lpDD
->lpGbl
->hDD
),
585 (PDD_CREATEVPORTDATA
) pDvdCreatePort
);
597 DvpDestroyVideoPort(LPDDHAL_DESTROYVPORTDATA pDvdDestoryPort
)
599 return NtGdiDvpDestroyVideoPort(pDvdDestoryPort
->lpVideoPort
->hDDVideoPort
, (PDD_DESTROYVPORTDATA
)pDvdDestoryPort
);
609 DvpFlipVideoPort(LPDDHAL_FLIPVPORTDATA pDvdPortFlip
)
611 return NtGdiDvpFlipVideoPort(pDvdPortFlip
->lpVideoPort
->hDDVideoPort
,
612 (HANDLE
)pDvdPortFlip
->lpSurfCurr
->hDDSurface
,
613 (HANDLE
)pDvdPortFlip
->lpSurfTarg
->hDDSurface
,
614 (PDD_FLIPVPORTDATA
) pDvdPortFlip
);
620 * DvpGetVideoPortBandwidth
624 DvpGetVideoPortBandwidth(LPDDHAL_GETVPORTBANDWIDTHDATA pDvdPortBandWidth
)
626 return NtGdiDvpGetVideoPortBandwidth(pDvdPortBandWidth
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTBANDWIDTHDATA
)pDvdPortBandWidth
);
636 DvpColorControl(LPDDHAL_VPORTCOLORDATA pDvdPortColorControl
)
638 return NtGdiDvpColorControl(pDvdPortColorControl
->lpVideoPort
->hDDVideoPort
, (PDD_VPORTCOLORDATA
) pDvdPortColorControl
);
644 * DvpGetVideoSignalStatus
648 DvpGetVideoSignalStatus(LPDDHAL_GETVPORTSIGNALDATA pDvdPortVideoSignalStatus
)
650 return NtGdiDvpGetVideoSignalStatus(pDvdPortVideoSignalStatus
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTSIGNALDATA
) pDvdPortVideoSignalStatus
);
656 * DvpGetVideoPortFlipStatus
660 DvpGetVideoPortFlipStatus(LPDDHAL_GETVPORTFLIPSTATUSDATA pDvdPortVideoPortFlipStatus
)
662 return NtGdiDvpGetVideoPortFlipStatus(GetDdHandle(pDvdPortVideoPortFlipStatus
->lpDD
->lpGbl
->hDD
), (PDD_GETVPORTFLIPSTATUSDATA
) pDvdPortVideoPortFlipStatus
);
669 * DvpCanCreateVideoPort
673 DvpCanCreateVideoPort(LPDDHAL_CANCREATEVPORTDATA pDvdCanCreateVideoPort
)
675 return NtGdiDvpCanCreateVideoPort(GetDdHandle(pDvdCanCreateVideoPort
->lpDD
->lpGbl
->hDD
), (PDD_CANCREATEVPORTDATA
) pDvdCanCreateVideoPort
);
680 * DvpWaitForVideoPortSync
684 DvpWaitForVideoPortSync(LPDDHAL_WAITFORVPORTSYNCDATA pDvdWaitForVideoPortSync
)
686 return NtGdiDvpWaitForVideoPortSync(pDvdWaitForVideoPortSync
->lpVideoPort
->hDDVideoPort
, (PDD_WAITFORVPORTSYNCDATA
) pDvdWaitForVideoPortSync
);
696 DvpUpdateVideoPort(LPDDHAL_UPDATEVPORTDATA pDvdUpdateVideoPort
)
699 * Windows XP limit to max 10 handles of videoport surface and Vbi
700 * ReactOS doing same to keep compatible, if it is more that 10
701 * videoport surface or vbi the stack will be curpted in windows xp
702 * ReactOS safe guard againts that
706 HANDLE phSurfaceVideo
[10];
707 HANDLE phSurfaceVbi
[10];
709 if (pDvdUpdateVideoPort
->dwFlags
!= DDRAWI_VPORTSTOP
)
712 DWORD dwNumVBIAutoflip
;
714 /* Take copy of lplpDDSurface for the handle value will be modify in dxg */
715 dwNumAutoflip
= pDvdUpdateVideoPort
->dwNumAutoflip
;
716 if ((dwNumAutoflip
== 0) &&
717 (pDvdUpdateVideoPort
->lplpDDSurface
== 0))
722 if (dwNumAutoflip
!= 0)
724 if (dwNumAutoflip
>10)
728 memcpy(phSurfaceVideo
,pDvdUpdateVideoPort
->lplpDDSurface
,dwNumAutoflip
*sizeof(HANDLE
));
731 /* Take copy of lplpDDVBISurface for the handle value will be modify in dxg */
732 dwNumVBIAutoflip
= pDvdUpdateVideoPort
->dwNumVBIAutoflip
;
733 if ( (dwNumVBIAutoflip
== 0) &&
734 (pDvdUpdateVideoPort
->lplpDDVBISurface
== 0) )
739 if (dwNumVBIAutoflip
!= 0)
741 if (dwNumVBIAutoflip
>10)
743 dwNumVBIAutoflip
= 10;
745 memcpy(phSurfaceVbi
,pDvdUpdateVideoPort
->lplpDDVBISurface
,dwNumVBIAutoflip
*sizeof(HANDLE
));
750 return NtGdiDvpUpdateVideoPort(pDvdUpdateVideoPort
->lpVideoPort
->hDDVideoPort
,phSurfaceVideo
,phSurfaceVbi
, (PDD_UPDATEVPORTDATA
)pDvdUpdateVideoPort
);
756 * DvpWaitForVideoPortSync
760 DvpGetVideoPortField(LPDDHAL_FLIPVPORTDATA pDvdGetVideoPortField
)
762 return NtGdiDvpGetVideoPortField(pDvdGetVideoPortField
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTFIELDDATA
)pDvdGetVideoPortField
);
768 * DvpWaitForVideoPortSync
772 DvpGetVideoPortInputFormats(LPDDHAL_GETVPORTINPUTFORMATDATA pDvdGetVideoPortInputFormat
)
774 return NtGdiDvpGetVideoPortInputFormats(pDvdGetVideoPortInputFormat
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTINPUTFORMATDATA
) pDvdGetVideoPortInputFormat
);
780 * DvpGetVideoPortLine
784 DvpGetVideoPortLine(LPDDHAL_GETVPORTLINEDATA pDvdGetVideoPortLine
)
786 return NtGdiDvpGetVideoPortLine(pDvdGetVideoPortLine
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTLINEDATA
)pDvdGetVideoPortLine
);
792 * DvpGetVideoPortOutputFormats
796 DvpGetVideoPortOutputFormats(LPDDHAL_GETVPORTLINEDATA pDvdGetVideoPortOutputFormat
)
798 return NtGdiDvpGetVideoPortLine(pDvdGetVideoPortOutputFormat
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTLINEDATA
)pDvdGetVideoPortOutputFormat
);
804 * DvpGetVideoPortConnectInfo
808 DvpGetVideoPortConnectInfo(LPDDHAL_GETVPORTCONNECTDATA pDvdGetVideoPortInfo
)
810 return NtGdiDvpGetVideoPortConnectInfo( GetDdHandle( pDvdGetVideoPortInfo
->lpDD
->lpGbl
->hDD
) , (PDD_GETVPORTCONNECTDATA
) pDvdGetVideoPortInfo
);
816 * DdGetAvailDriverMemory
820 DdGetAvailDriverMemory(LPDDHAL_GETAVAILDRIVERMEMORYDATA pDdGetAvailDriverMemory
)
822 return NtGdiDdGetAvailDriverMemory(GetDdHandle( pDdGetAvailDriverMemory
->lpDD
->hDD
), (PDD_GETAVAILDRIVERMEMORYDATA
) pDdGetAvailDriverMemory
);
832 DdAlphaBlt(LPDDHAL_BLTDATA pDdAlphaBlt
)
834 HANDLE hDDSrcSurface
= 0;
836 if (pDdAlphaBlt
->lpDDSrcSurface
!= 0)
838 hDDSrcSurface
= (HANDLE
) pDdAlphaBlt
->lpDDSrcSurface
->hDDSurface
;
841 return NtGdiDdAlphaBlt((HANDLE
)pDdAlphaBlt
->lpDDDestSurface
->hDDSurface
, hDDSrcSurface
, (PDD_BLTDATA
)&pDdAlphaBlt
);
851 DdCreateSurfaceEx(LPDDHAL_CREATESURFACEEXDATA pDdCreateSurfaceEx
)
853 pDdCreateSurfaceEx
->ddRVal
= NtGdiDdCreateSurfaceEx( GetDdHandle(pDdCreateSurfaceEx
->lpDDLcl
->lpGbl
->hDD
),
854 (HANDLE
)pDdCreateSurfaceEx
->lpDDSLcl
->hDDSurface
,
855 pDdCreateSurfaceEx
->lpDDSLcl
->lpSurfMore
->dwSurfaceHandle
);
866 DdColorControl(LPDDHAL_COLORCONTROLDATA pDdColorControl
)
868 return NtGdiDdColorControl( (HANDLE
) pDdColorControl
->lpDDSurface
->hDDSurface
, (PDD_COLORCONTROLDATA
) &pDdColorControl
);
878 DdSetExclusiveMode(LPDDHAL_SETEXCLUSIVEMODEDATA pDdSetExclusiveMode
)
880 return NtGdiDdSetExclusiveMode( GetDdHandle(pDdSetExclusiveMode
->lpDD
->hDD
), (PDD_SETEXCLUSIVEMODEDATA
) &pDdSetExclusiveMode
);
890 DdFlipToGDISurface(LPDDHAL_FLIPTOGDISURFACEDATA pDdFlipToGDISurface
)
892 return NtGdiDdFlipToGDISurface( GetDdHandle(pDdFlipToGDISurface
->lpDD
->hDD
), (PDD_FLIPTOGDISURFACEDATA
) &pDdFlipToGDISurface
);
898 DdGetDriverInfo(LPDDHAL_GETDRIVERINFODATA pData
)
900 DDHAL_GETDRIVERINFODATA pDrvInfoData
;
901 DWORD retValue
= DDHAL_DRIVER_NOTHANDLED
;
904 /* FIXME add SEH around this functions */
906 RtlZeroMemory(&pDrvInfoData
, sizeof (DDHAL_GETDRIVERINFODATA
));
907 RtlCopyMemory(&pDrvInfoData
.guidInfo
, &pData
->guidInfo
, sizeof(GUID
));
909 hDD
= GetDdHandle(pData
->dwContext
);
911 pDrvInfoData
.dwSize
= sizeof (DDHAL_GETDRIVERINFODATA
);
912 pDrvInfoData
.ddRVal
= DDERR_GENERIC
;
913 pDrvInfoData
.dwContext
= (ULONG_PTR
)hDD
;
916 /* Videoport Callbacks check and setup for DirectX/ ReactX */
917 if (IsEqualGUID(&pData
->guidInfo
, &GUID_VideoPortCallbacks
))
919 DDHAL_DDVIDEOPORTCALLBACKS pDvdPort
;
920 DDHAL_DDVIDEOPORTCALLBACKS
* pUserDvdPort
= (DDHAL_DDVIDEOPORTCALLBACKS
*)pData
->lpvData
;
922 /* Clear internal out buffer and set it up*/
923 RtlZeroMemory(&pDvdPort
, DDVIDEOPORTCALLBACKSSIZE
);
924 pDvdPort
.dwSize
= DDVIDEOPORTCALLBACKSSIZE
;
926 /* set up internal buffer */
927 pDrvInfoData
.lpvData
= (PVOID
)&pDvdPort
;
928 pDrvInfoData
.dwExpectedSize
= DDVIDEOPORTCALLBACKSSIZE
;
931 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
933 /* Setup user out buffer and convert kmode callbacks to user mode */
934 pUserDvdPort
->dwSize
= DDVIDEOPORTCALLBACKSSIZE
;
935 pUserDvdPort
->dwFlags
= pDrvInfoData
.dwFlags
= 0;
937 pUserDvdPort
->dwFlags
= (pDrvInfoData
.dwFlags
& ~(DDHAL_VPORT32_CREATEVIDEOPORT
| DDHAL_VPORT32_FLIP
|
938 DDHAL_VPORT32_DESTROY
| DDHAL_VPORT32_UPDATE
| DDHAL_VPORT32_WAITFORSYNC
)) |
939 (DDHAL_VPORT32_CREATEVIDEOPORT
| DDHAL_VPORT32_FLIP
|
940 DDHAL_VPORT32_DESTROY
| DDHAL_VPORT32_UPDATE
);
942 pData
->dwActualSize
= DDVIDEOPORTCALLBACKSSIZE
;
943 pUserDvdPort
->CreateVideoPort
= (LPDDHALVPORTCB_CREATEVIDEOPORT
) DvpCreateVideoPort
;
944 pUserDvdPort
->FlipVideoPort
= (LPDDHALVPORTCB_FLIP
) DvpFlipVideoPort
;
945 pUserDvdPort
->DestroyVideoPort
= (LPDDHALVPORTCB_DESTROYVPORT
) DvpDestroyVideoPort
;
946 pUserDvdPort
->UpdateVideoPort
= (LPDDHALVPORTCB_UPDATE
) DvpUpdateVideoPort
;
948 if (pDvdPort
.CanCreateVideoPort
)
950 pUserDvdPort
->CanCreateVideoPort
= (LPDDHALVPORTCB_CANCREATEVIDEOPORT
) DvpCanCreateVideoPort
;
953 if (pDvdPort
.GetVideoPortBandwidth
)
955 pUserDvdPort
->GetVideoPortBandwidth
= (LPDDHALVPORTCB_GETBANDWIDTH
) DvpGetVideoPortBandwidth
;
958 if (pDvdPort
.GetVideoPortInputFormats
)
960 pUserDvdPort
->GetVideoPortInputFormats
= (LPDDHALVPORTCB_GETINPUTFORMATS
) DvpGetVideoPortInputFormats
;
963 if (pDvdPort
.GetVideoPortOutputFormats
)
965 pUserDvdPort
->GetVideoPortOutputFormats
= (LPDDHALVPORTCB_GETOUTPUTFORMATS
) DvpGetVideoPortOutputFormats
;
968 if (pDvdPort
.GetVideoPortField
)
970 pUserDvdPort
->GetVideoPortField
= (LPDDHALVPORTCB_GETFIELD
) DvpGetVideoPortField
;
973 if (pDvdPort
.GetVideoPortLine
)
975 pUserDvdPort
->GetVideoPortLine
= (LPDDHALVPORTCB_GETLINE
) DvpGetVideoPortLine
;
978 if (pDvdPort
.GetVideoPortConnectInfo
)
980 pUserDvdPort
->GetVideoPortConnectInfo
= (LPDDHALVPORTCB_GETVPORTCONNECT
) DvpGetVideoPortConnectInfo
;
983 if (pDvdPort
.GetVideoPortFlipStatus
)
985 pUserDvdPort
->GetVideoPortFlipStatus
= (LPDDHALVPORTCB_GETFLIPSTATUS
) DvpGetVideoPortFlipStatus
;
988 if (pDvdPort
.WaitForVideoPortSync
)
990 pUserDvdPort
->WaitForVideoPortSync
= (LPDDHALVPORTCB_WAITFORSYNC
) DvpWaitForVideoPortSync
;
993 if (pDvdPort
.GetVideoSignalStatus
)
995 pUserDvdPort
->GetVideoSignalStatus
= (LPDDHALVPORTCB_GETSIGNALSTATUS
) DvpGetVideoSignalStatus
;
998 if (pDvdPort
.ColorControl
)
1000 pUserDvdPort
->ColorControl
= (LPDDHALVPORTCB_COLORCONTROL
) DvpColorControl
;
1003 /* Windows XP never repot back the true return value,
1004 * it only report back if we have a driver or not
1005 * ReactOS keep this behoir to be compatible with
1008 pData
->ddRVal
= retValue
;
1011 /* Color Control Callbacks check and setup for DirectX/ ReactX */
1012 if (IsEqualGUID(&pData
->guidInfo
, &GUID_ColorControlCallbacks
))
1014 DDHAL_DDCOLORCONTROLCALLBACKS pColorControl
;
1015 DDHAL_DDCOLORCONTROLCALLBACKS
* pUserColorControl
= (DDHAL_DDCOLORCONTROLCALLBACKS
*)pData
->lpvData
;
1017 /* Clear internal out buffer and set it up*/
1018 RtlZeroMemory(&pColorControl
, DDCOLORCONTROLCALLBACKSSIZE
);
1019 pColorControl
.dwSize
= DDCOLORCONTROLCALLBACKSSIZE
;
1021 /* set up internal buffer */
1022 pDrvInfoData
.lpvData
= (PVOID
)&pColorControl
;
1023 pDrvInfoData
.dwExpectedSize
= DDCOLORCONTROLCALLBACKSSIZE
;
1026 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
1028 pData
->dwActualSize
= DDCOLORCONTROLCALLBACKSSIZE
;
1029 pData
->dwFlags
= pDrvInfoData
.dwFlags
;
1031 pUserColorControl
->dwSize
= DDCOLORCONTROLCALLBACKSSIZE
;
1032 pUserColorControl
->dwFlags
= pColorControl
.dwFlags
;
1034 if (pColorControl
.ColorControl
!= NULL
)
1036 pUserColorControl
->ColorControl
= (LPDDHALCOLORCB_COLORCONTROL
) DdColorControl
;
1039 /* Windows XP never repot back the true return value,
1040 * it only report back if we have a driver or not
1041 * ReactOS keep this behoir to be compatible with
1044 pData
->ddRVal
= retValue
;
1047 /* Misc Callbacks check and setup for DirectX/ ReactX */
1048 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_MiscellaneousCallbacks
))
1050 DDHAL_DDMISCELLANEOUSCALLBACKS pMisc
;
1051 DDHAL_DDMISCELLANEOUSCALLBACKS
* pUserMisc
= (DDHAL_DDMISCELLANEOUSCALLBACKS
*)pData
->lpvData
;
1053 /* Clear internal out buffer and set it up*/
1054 RtlZeroMemory(&pMisc
, DDMISCELLANEOUSCALLBACKSSIZE
);
1055 pMisc
.dwSize
= DDMISCELLANEOUSCALLBACKSSIZE
;
1057 /* set up internal buffer */
1058 pDrvInfoData
.lpvData
= (PVOID
)&pMisc
;
1059 pDrvInfoData
.dwExpectedSize
= DDMISCELLANEOUSCALLBACKSSIZE
;
1062 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
1064 pData
->dwActualSize
= DDMISCELLANEOUSCALLBACKSSIZE
;
1066 /* Only one callbacks are supported */
1067 pUserMisc
->dwFlags
= pMisc
.dwFlags
& DDHAL_MISCCB32_GETAVAILDRIVERMEMORY
;
1068 pUserMisc
->GetAvailDriverMemory
= (LPDDHAL_GETAVAILDRIVERMEMORY
) DdGetAvailDriverMemory
;
1070 /* This callbacks are only for win9x and theirfor it is not longer use in NT or ReactOS
1071 * pUserMisc->UpdateNonLocalHeap;
1072 * pUserMisc->GetHeapAlignment;
1073 * pUserMisc->GetSysmemBltStatus; */
1075 /* Windows XP never repot back the true return value,
1076 * it only report back if we have a driver or not
1077 * ReactOS keep this behoir to be compatible with
1080 pData
->ddRVal
= retValue
;
1083 /* Misc 2 Callbacks check and setup for DirectX/ ReactX */
1084 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_Miscellaneous2Callbacks
))
1086 DDHAL_DDMISCELLANEOUS2CALLBACKS pMisc
;
1087 DDHAL_DDMISCELLANEOUS2CALLBACKS
* pUserMisc
= (DDHAL_DDMISCELLANEOUS2CALLBACKS
*)pData
->lpvData
;
1089 /* Clear internal out buffer and set it up*/
1090 RtlZeroMemory(&pMisc
, DDMISCELLANEOUS2CALLBACKSSIZE
);
1091 pMisc
.dwSize
= DDMISCELLANEOUS2CALLBACKSSIZE
;
1093 /* set up internal buffer */
1094 pDrvInfoData
.lpvData
= (PVOID
)&pMisc
;
1095 pDrvInfoData
.dwExpectedSize
= DDMISCELLANEOUS2CALLBACKSSIZE
;
1098 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
1100 pData
->dwActualSize
= DDMISCELLANEOUS2CALLBACKSSIZE
;
1102 pUserMisc
->dwFlags
= pMisc
.dwFlags
;
1104 /* This functions are not documneted in MSDN for this struct, here is directx/reactx alpha blend */
1105 if ( pMisc
.Reserved
)
1107 pUserMisc
->Reserved
= (LPVOID
) DdAlphaBlt
;
1110 if ( pMisc
.CreateSurfaceEx
)
1112 pUserMisc
->CreateSurfaceEx
= (LPDDHAL_CREATESURFACEEX
) DdCreateSurfaceEx
;
1115 if ( pMisc
.GetDriverState
)
1117 pUserMisc
->GetDriverState
= (LPDDHAL_GETDRIVERSTATE
) NtGdiDdGetDriverState
;
1120 /* NOTE : pUserMisc->DestroyDDLocal is outdated and are not beign tuch */
1122 /* Windows XP never repot back the true return value,
1123 * it only report back if we have a driver or not
1124 * ReactOS keep this behoir to be compatible with
1127 pData
->ddRVal
= retValue
;
1130 /* NT Callbacks check and setup for DirectX/ ReactX */
1131 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_NTCallbacks
))
1133 /* MS does not have DHAL_* version of this callbacks
1134 * so we are force using PDD_* callbacks here
1136 DD_NTCALLBACKS pNtKernel
;
1137 PDD_NTCALLBACKS pUserNtKernel
= (PDD_NTCALLBACKS
)pData
->lpvData
;
1139 /* Clear internal out buffer and set it up*/
1140 RtlZeroMemory(&pNtKernel
, sizeof(DD_NTCALLBACKS
));
1141 pNtKernel
.dwSize
= sizeof(DD_NTCALLBACKS
);
1143 /* set up internal buffer */
1144 pDrvInfoData
.lpvData
= (PVOID
)&pNtKernel
;
1145 pDrvInfoData
.dwExpectedSize
= sizeof(DD_NTCALLBACKS
) ;
1148 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
1150 pData
->dwActualSize
= sizeof(DD_NTCALLBACKS
);
1152 pUserNtKernel
->dwSize
= sizeof(DD_NTCALLBACKS
);
1153 pUserNtKernel
->dwFlags
= pNtKernel
.dwFlags
;
1154 pUserNtKernel
->FreeDriverMemory
= 0;
1156 if (pNtKernel
.SetExclusiveMode
)
1158 pUserNtKernel
->SetExclusiveMode
= (PDD_SETEXCLUSIVEMODE
) DdSetExclusiveMode
;
1161 if (pNtKernel
.FlipToGDISurface
)
1163 pUserNtKernel
->FlipToGDISurface
= (PDD_FLIPTOGDISURFACE
) DdFlipToGDISurface
;
1166 /* Windows XP never repot back the true return value,
1167 * it only report back if we have a driver or not
1168 * ReactOS keep this behoir to be compatible with
1171 pData
->ddRVal
= retValue
;
1174 /* D3D Callbacks version 2 check and setup for DirectX/ ReactX */
1175 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_D3DCallbacks2
))
1177 // FIXME GUID_D3DCallbacks2
1180 /* D3D Callbacks version 3 check and setup for DirectX/ ReactX */
1181 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_D3DCallbacks3
))
1183 // FIXME GUID_D3DCallbacks3
1186 /* D3DParseUnknownCommand Callbacks check and setup for DirectX/ ReactX */
1187 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_D3DParseUnknownCommandCallback
))
1189 // FIXME GUID_D3DParseUnknownCommandCallback
1192 /* MotionComp Callbacks check and setup for DirectX/ ReactX */
1193 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_MotionCompCallbacks
))
1195 // FIXME GUID_MotionCompCallbacks
1198 /* FIXME VPE2 Callbacks check and setup for DirectX/ ReactX */
1199 //else if (IsEqualGUID(&pData->guidInfo, &GUID_VPE2Callbacks))
1201 // FIXME GUID_VPE2Callbacks
1205 /* set up internal buffer */
1206 pDrvInfoData
.dwExpectedSize
= pData
->dwExpectedSize
;
1207 pDrvInfoData
.lpvData
= pData
->lpvData
;
1209 /* We do not cover all callbacks for user mode, they are only cover by kmode */
1210 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
1212 /* Setup return data */
1213 pData
->dwActualSize
= pDrvInfoData
.dwActualSize
;
1214 pData
->lpvData
= pDrvInfoData
.lpvData
;
1215 /* Windows XP never repot back the true return value,
1216 * it only report back if we have a driver or not
1217 * ReactOS keep this behoir to be compatible with
1220 pData
->ddRVal
= retValue
;
1234 D3dContextCreate(LPD3DHAL_CONTEXTCREATEDATA pdcci
)
1236 HANDLE hSurfZ
= NULL
;
1238 if (pdcci
->lpDDSZLcl
)
1240 hSurfZ
= (HANDLE
)pdcci
->lpDDSZLcl
->hDDSurface
;
1243 return NtGdiD3dContextCreate(GetDdHandle(pdcci
->lpDDLcl
->hDD
),
1244 (HANDLE
)pdcci
->lpDDSLcl
->hDDSurface
,
1246 (D3DNTHAL_CONTEXTCREATEI
*)pdcci
);
1252 * DdCanCreateD3DBuffer
1256 DdCanCreateD3DBuffer(LPDDHAL_CANCREATESURFACEDATA CanCreateD3DBuffer
)
1259 * Note : This functions are basic same, in win32k
1260 * NtGdiDdCanCreateD3DBuffer and NtGdiDdCanCreateSurface are mergs
1261 * toghter in win32k at end and retrurn same data, it is still sepreated
1262 * at user mode but in kmode it is not.
1266 return NtGdiDdCanCreateD3DBuffer(GetDdHandle(CanCreateD3DBuffer
->lpDD
->hDD
),
1267 (PDD_CANCREATESURFACEDATA
)CanCreateD3DBuffer
);
1278 DdCreateD3DBuffer(LPDDHAL_CREATESURFACEDATA pCreateSurface
)
1280 HANDLE puhSurface
= 0;
1281 DDRAWI_DDRAWSURFACE_GBL
*pSurfGBL
;
1282 DDRAWI_DDRAWSURFACE_LCL
*pSurfLcl
;
1283 DD_SURFACE_GLOBAL puSurfaceGlobalData
;
1284 DD_SURFACE_MORE puSurfaceMoreData
;
1285 DD_SURFACE_LOCAL puSurfaceLocalData
;
1288 /* Zero all local memory pointer */
1289 RtlZeroMemory(&puSurfaceGlobalData
, sizeof(DD_SURFACE_GLOBAL
) );
1290 RtlZeroMemory(&puSurfaceMoreData
, sizeof(DD_SURFACE_MORE
) ) ;
1291 RtlZeroMemory(&puSurfaceLocalData
, sizeof(DD_SURFACE_LOCAL
) );
1293 pCreateSurface
->dwSCnt
= 1;
1294 pSurfLcl
= pCreateSurface
->lplpSList
[0];
1295 pSurfGBL
= pSurfLcl
->lpGbl
;
1297 /* Convert DDRAWI_DDRAWSURFACE_GBL to DD_SURFACE_GLOBAL */
1298 puSurfaceGlobalData
.wWidth
= pSurfGBL
->wWidth
;
1299 puSurfaceGlobalData
.wHeight
= pSurfGBL
->wHeight
;
1300 puSurfaceGlobalData
.dwLinearSize
= pSurfGBL
->dwLinearSize
;
1301 puSurfaceGlobalData
.fpVidMem
= pSurfGBL
->fpVidMem
;
1302 puSurfaceGlobalData
.dwBlockSizeX
= pSurfGBL
->dwBlockSizeX
;
1303 puSurfaceGlobalData
.dwBlockSizeY
= pSurfGBL
->dwBlockSizeY
;
1305 /* Convert DDRAWI_DDRAWSURFACE_MORE to DD_SURFACE_MORE */
1306 puSurfaceMoreData
.dwSurfaceHandle
= pSurfLcl
->lpSurfMore
->dwSurfaceHandle
;
1307 puSurfaceMoreData
.ddsCapsEx
.dwCaps2
= pSurfLcl
->lpSurfMore
->ddsCapsEx
.dwCaps2
;
1308 puSurfaceMoreData
.ddsCapsEx
.dwCaps3
= pSurfLcl
->lpSurfMore
->ddsCapsEx
.dwCaps3
;
1309 puSurfaceMoreData
.ddsCapsEx
.dwCaps4
= pSurfLcl
->lpSurfMore
->ddsCapsEx
.dwCaps4
;
1311 /* Convert DDRAWI_DDRAWSURFACE_LCL to DD_SURFACE_LOCAL */
1312 puSurfaceLocalData
.dwFlags
= pSurfLcl
->dwFlags
;
1313 puSurfaceLocalData
.ddsCaps
.dwCaps
= pSurfLcl
->ddsCaps
.dwCaps
;
1316 retValue
= NtGdiDdCreateD3DBuffer( GetDdHandle(pCreateSurface
->lpDD
->hDD
),
1317 (HANDLE
*)&pSurfLcl
->hDDSurface
,
1318 pCreateSurface
->lpDDSurfaceDesc
,
1319 &puSurfaceGlobalData
,
1320 &puSurfaceLocalData
,
1322 (DD_CREATESURFACEDATA
*) pCreateSurface
,
1325 /* Setup surface handle if we got one back */
1326 if ( puhSurface
!= NULL
)
1328 pCreateSurface
->lplpSList
[0]->hDDSurface
= (ULONG_PTR
)puhSurface
;
1331 /* Convert DD_SURFACE_GLOBAL to DDRAWI_DDRAWSURFACE_GBL */
1332 pSurfGBL
->dwLinearSize
= puSurfaceGlobalData
.dwLinearSize
;
1333 pSurfGBL
->fpVidMem
= puSurfaceGlobalData
.fpVidMem
;
1334 pSurfGBL
->dwBlockSizeX
= puSurfaceGlobalData
.dwBlockSizeX
;
1335 pSurfGBL
->dwBlockSizeY
= puSurfaceGlobalData
.dwBlockSizeY
;
1343 * DdDestroyD3DBuffer
1347 DdDestroyD3DBuffer(LPDDHAL_DESTROYSURFACEDATA pDestroySurface
)
1350 if ( pDestroySurface
->lpDDSurface
->hDDSurface
)
1353 retValue
= NtGdiDdDestroyD3DBuffer((HANDLE
)pDestroySurface
->lpDDSurface
->hDDSurface
);
1366 DdLockD3D(LPDDHAL_LOCKDATA Lock
)
1370 return NtGdiDdLockD3D((HANDLE
)Lock
->lpDDSurface
->hDDSurface
, (PDD_LOCKDATA
)Lock
);
1380 DdUnlockD3D(LPDDHAL_UNLOCKDATA Unlock
)
1383 return NtGdiDdUnlock((HANDLE
)Unlock
->lpDDSurface
->hDDSurface
,
1384 (PDD_UNLOCKDATA
)Unlock
);
1388 /* PRIVATE FUNCTIONS *********************************************************/
1392 bDDCreateSurface(LPDDRAWI_DDRAWSURFACE_LCL pSurface
,
1395 DD_SURFACE_LOCAL SurfaceLocal
;
1396 DD_SURFACE_GLOBAL SurfaceGlobal
;
1397 DD_SURFACE_MORE SurfaceMore
;
1400 RtlZeroMemory(&SurfaceLocal
, sizeof(DD_SURFACE_LOCAL
));
1401 RtlZeroMemory(&SurfaceGlobal
, sizeof(DD_SURFACE_GLOBAL
));
1402 RtlZeroMemory(&SurfaceMore
, sizeof(DD_SURFACE_MORE
));
1404 /* Set up SurfaceLocal struct */
1405 SurfaceLocal
.ddsCaps
.dwCaps
= pSurface
->ddsCaps
.dwCaps
;
1406 SurfaceLocal
.dwFlags
= pSurface
->dwFlags
;
1408 /* Set up SurfaceMore struct */
1409 RtlMoveMemory(&SurfaceMore
.ddsCapsEx
,
1410 &pSurface
->ddckCKDestBlt
,
1412 SurfaceMore
.dwSurfaceHandle
= (DWORD
)pSurface
->dbnOverlayNode
.object_int
->lpVtbl
;
1414 /* Set up SurfaceGlobal struct */
1415 SurfaceGlobal
.fpVidMem
= pSurface
->lpGbl
->fpVidMem
;
1416 SurfaceGlobal
.dwLinearSize
= pSurface
->lpGbl
->dwLinearSize
;
1417 SurfaceGlobal
.wHeight
= pSurface
->lpGbl
->wHeight
;
1418 SurfaceGlobal
.wWidth
= pSurface
->lpGbl
->wWidth
;
1420 /* Check if we have a pixel format */
1421 if (pSurface
->dwFlags
& DDSD_PIXELFORMAT
)
1423 /* Use global one */
1424 SurfaceGlobal
.ddpfSurface
= pSurface
->lpGbl
->lpDD
->vmiData
.ddpfDisplay
;
1425 SurfaceGlobal
.ddpfSurface
.dwSize
= sizeof(DDPIXELFORMAT
);
1430 SurfaceGlobal
.ddpfSurface
= pSurface
->lpGbl
->lpDD
->vmiData
.ddpfDisplay
;
1433 /* Create the object */
1434 pSurface
->hDDSurface
= (DWORD
)NtGdiDdCreateSurfaceObject(GetDdHandle(pSurface
->lpGbl
->lpDD
->hDD
),
1435 (HANDLE
)pSurface
->hDDSurface
,
1442 if (pSurface
->hDDSurface
) return TRUE
;
1446 /* PUBLIC FUNCTIONS **********************************************************/
1455 DdCreateDirectDrawObject(LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal
,
1458 BOOL Return
= FALSE
;
1460 /* Check if the global hDC (hdc == 0) is being used */
1463 /* We'll only allow this if the global object doesn't exist yet */
1467 if ((hdc
= CreateDCW(L
"Display", NULL
, NULL
, NULL
)))
1469 /* Create the DDraw Object */
1470 ghDirectDraw
= NtGdiDdCreateDirectDrawObject(hdc
);
1477 /* If we created the object, or had one ...*/
1480 /* Increase count and set success */
1485 /* Zero the handle */
1486 pDirectDrawGlobal
->hDD
= 0;
1490 /* Using the per-process object, so create it */
1491 pDirectDrawGlobal
->hDD
= (ULONG_PTR
)NtGdiDdCreateDirectDrawObject(hdc
);
1493 /* Set the return value */
1494 Return
= pDirectDrawGlobal
->hDD
? TRUE
: FALSE
;
1497 /* Return to caller */
1508 DdQueryDirectDrawObject(LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal
,
1509 LPDDHALINFO pHalInfo
,
1510 LPDDHAL_DDCALLBACKS pDDCallbacks
,
1511 LPDDHAL_DDSURFACECALLBACKS pDDSurfaceCallbacks
,
1512 LPDDHAL_DDPALETTECALLBACKS pDDPaletteCallbacks
,
1513 LPD3DHAL_CALLBACKS pD3dCallbacks
,
1514 LPD3DHAL_GLOBALDRIVERDATA pD3dDriverData
,
1515 LPDDHAL_DDEXEBUFCALLBACKS pD3dBufferCallbacks
,
1516 LPDDSURFACEDESC pD3dTextureFormats
,
1520 PVIDEOMEMORY VidMemList
= NULL
;
1522 D3DNTHAL_CALLBACKS D3dCallbacks
;
1523 D3DNTHAL_GLOBALDRIVERDATA D3dDriverData
;
1524 DD_D3DBUFCALLBACKS D3dBufferCallbacks
;
1525 DWORD CallbackFlags
[3];
1526 DWORD dwNumHeaps
=0, FourCCs
=0;
1530 /* Clear the structures */
1531 RtlZeroMemory(&HalInfo
, sizeof(DD_HALINFO
));
1532 RtlZeroMemory(&D3dCallbacks
, sizeof(D3DNTHAL_CALLBACKS
));
1533 RtlZeroMemory(&D3dDriverData
, sizeof(D3DNTHAL_GLOBALDRIVERDATA
));
1534 RtlZeroMemory(&D3dBufferCallbacks
, sizeof(DD_D3DBUFCALLBACKS
));
1535 RtlZeroMemory(CallbackFlags
, sizeof(DWORD
)*3);
1537 /* Note : XP always alloc 24*sizeof(VIDEOMEMORY) of pvmlist so we change it to it */
1538 if ( (pvmList
!= NULL
) &&
1539 (pHalInfo
->vmiData
.dwNumHeaps
!= 0) )
1541 VidMemList
= (PVIDEOMEMORY
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(VIDEOMEMORY
) * 24 ) * pHalInfo
->vmiData
.dwNumHeaps
);
1546 if (!NtGdiDdQueryDirectDrawObject(GetDdHandle(pDirectDrawGlobal
->hDD
),
1551 &D3dBufferCallbacks
,
1558 /* We failed, free the memory and return */
1563 /* Clear the incoming pointer */
1564 RtlZeroMemory(pHalInfo
, sizeof(DDHALINFO
));
1566 /* Convert all the data */
1567 pHalInfo
->dwSize
= sizeof(DDHALINFO
);
1568 pHalInfo
->lpDDCallbacks
= pDDCallbacks
;
1569 pHalInfo
->lpDDSurfaceCallbacks
= pDDSurfaceCallbacks
;
1570 pHalInfo
->lpDDPaletteCallbacks
= pDDPaletteCallbacks
;
1572 /* Check for NT5+ D3D Data */
1573 if ( (D3dCallbacks
.dwSize
!= 0) &&
1574 (D3dDriverData
.dwSize
!= 0) )
1576 /* Write these down */
1577 pHalInfo
->lpD3DGlobalDriverData
= (ULONG_PTR
)pD3dDriverData
;
1578 pHalInfo
->lpD3DHALCallbacks
= (ULONG_PTR
)pD3dCallbacks
;
1580 /* Check for Buffer Callbacks */
1581 if (D3dBufferCallbacks
.dwSize
)
1583 /* Write this one too */
1584 pHalInfo
->lpDDExeBufCallbacks
= pD3dBufferCallbacks
;
1588 /* Continue converting the rest */
1589 pHalInfo
->vmiData
.dwFlags
= HalInfo
.vmiData
.dwFlags
;
1590 pHalInfo
->vmiData
.dwDisplayWidth
= HalInfo
.vmiData
.dwDisplayWidth
;
1591 pHalInfo
->vmiData
.dwDisplayHeight
= HalInfo
.vmiData
.dwDisplayHeight
;
1592 pHalInfo
->vmiData
.lDisplayPitch
= HalInfo
.vmiData
.lDisplayPitch
;
1593 pHalInfo
->vmiData
.fpPrimary
= 0;
1595 RtlCopyMemory( &pHalInfo
->vmiData
.ddpfDisplay
,
1596 &HalInfo
.vmiData
.ddpfDisplay
,
1597 sizeof(DDPIXELFORMAT
));
1599 pHalInfo
->vmiData
.dwOffscreenAlign
= HalInfo
.vmiData
.dwOffscreenAlign
;
1600 pHalInfo
->vmiData
.dwOverlayAlign
= HalInfo
.vmiData
.dwOverlayAlign
;
1601 pHalInfo
->vmiData
.dwTextureAlign
= HalInfo
.vmiData
.dwTextureAlign
;
1602 pHalInfo
->vmiData
.dwZBufferAlign
= HalInfo
.vmiData
.dwZBufferAlign
;
1603 pHalInfo
->vmiData
.dwAlphaAlign
= HalInfo
.vmiData
.dwAlphaAlign
;
1605 pHalInfo
->vmiData
.dwNumHeaps
= dwNumHeaps
;
1606 pHalInfo
->vmiData
.pvmList
= pvmList
;
1608 RtlCopyMemory( &pHalInfo
->ddCaps
,
1610 sizeof(DDCORECAPS
));
1612 pHalInfo
->ddCaps
.dwNumFourCCCodes
= FourCCs
;
1613 pHalInfo
->lpdwFourCC
= pdwFourCC
;
1615 /* always force rope 0x1000 for hal it mean only source copy is supported */
1616 pHalInfo
->ddCaps
.dwRops
[6] = 0x1000;
1618 /* Set the HAL flags what ReactX got from the driver
1619 * Windows XP force setting DDHALINFO_GETDRIVERINFOSET if the driver does not set it
1620 * and ReactX doing same to keep compatible with drivers, but the driver are
1621 * force support DdGetDriverInfo acoriding MSDN but it seam some driver do not set
1622 * this flag even it is being supported. that is mean. It is small hack to keep
1623 * bad driver working, that trust this is always being setting by it self at end
1625 pHalInfo
->dwFlags
= (HalInfo
.dwFlags
& ~DDHALINFO_GETDRIVERINFOSET
) | DDHALINFO_GETDRIVERINFOSET
;
1626 pHalInfo
->GetDriverInfo
= (LPDDHAL_GETDRIVERINFO
) DdGetDriverInfo
;
1628 /* Now check if we got any DD callbacks */
1631 /* Zero the structure */
1632 RtlZeroMemory(pDDCallbacks
, sizeof(DDHAL_DDCALLBACKS
));
1633 pDDCallbacks
->dwSize
= sizeof(DDHAL_DDCALLBACKS
);
1635 /* Set the flags for this structure
1636 * Windows XP force setting DDHAL_CB32_CREATESURFACE if the driver does not set it
1637 * and ReactX doing same to keep compatible with drivers, but the driver are
1638 * force support pDDCallbacks acoriding MSDN but it seam some driver do not set
1639 * this flag even it is being supported. that is mean. It is small hack to keep
1640 * bad driver working, that trust this is always being setting by it self at end
1642 Flags
= (CallbackFlags
[0] & ~DDHAL_CB32_CREATESURFACE
) | DDHAL_CB32_CREATESURFACE
;
1643 pDDCallbacks
->dwFlags
= Flags
;
1645 /* Write the always-on functions */
1646 pDDCallbacks
->CreateSurface
= DdCreateSurface
;
1648 /* Now write the pointers, if applicable */
1649 if (Flags
& DDHAL_CB32_WAITFORVERTICALBLANK
)
1651 pDDCallbacks
->WaitForVerticalBlank
= DdWaitForVerticalBlank
;
1653 if (Flags
& DDHAL_CB32_CANCREATESURFACE
)
1655 pDDCallbacks
->CanCreateSurface
= DdCanCreateSurface
;
1657 if (Flags
& DDHAL_CB32_GETSCANLINE
)
1659 pDDCallbacks
->GetScanLine
= DdGetScanLine
;
1663 /* Check for DD Surface Callbacks */
1664 if (pDDSurfaceCallbacks
)
1666 /* Zero the structures */
1667 RtlZeroMemory(pDDSurfaceCallbacks
, sizeof(DDHAL_DDSURFACECALLBACKS
));
1668 pDDSurfaceCallbacks
->dwSize
= sizeof(DDHAL_DDSURFACECALLBACKS
);
1670 /* Set the flags for this structure
1671 * Windows XP force setting DDHAL_SURFCB32_LOCK, DDHAL_SURFCB32_UNLOCK,
1672 * DDHAL_SURFCB32_SETCOLORKEY, DDHAL_SURFCB32_DESTROYSURFACE if the driver
1673 * does not set it and ReactX doing same to keep compatible with drivers,
1674 * but the driver are force support pDDSurfaceCallbacks acoriding MSDN but it seam
1675 * some driver do not set this flag even it is being supported. that is mean.
1676 * It is small hack to keep bad driver working, that trust this is always being
1677 * setting by it self at end
1680 Flags
= (CallbackFlags
[1] & ~(DDHAL_SURFCB32_LOCK
| DDHAL_SURFCB32_UNLOCK
|
1681 DDHAL_SURFCB32_SETCOLORKEY
| DDHAL_SURFCB32_DESTROYSURFACE
)) |
1682 (DDHAL_SURFCB32_LOCK
| DDHAL_SURFCB32_UNLOCK
|
1683 DDHAL_SURFCB32_SETCOLORKEY
| DDHAL_SURFCB32_DESTROYSURFACE
);
1685 pDDSurfaceCallbacks
->dwFlags
= Flags
;
1687 /* Write the always-on functions */
1688 pDDSurfaceCallbacks
->Lock
= DdLock
;
1689 pDDSurfaceCallbacks
->Unlock
= DdUnlock
;
1690 pDDSurfaceCallbacks
->SetColorKey
= DdSetColorKey
;
1691 pDDSurfaceCallbacks
->DestroySurface
= DdDestroySurface
;
1693 /* Write the optional ones */
1694 if (Flags
& DDHAL_SURFCB32_FLIP
)
1696 pDDSurfaceCallbacks
->Flip
= DdFlip
;
1698 if (Flags
& DDHAL_SURFCB32_BLT
)
1700 pDDSurfaceCallbacks
->Blt
= DdBlt
;
1702 if (Flags
& DDHAL_SURFCB32_GETBLTSTATUS
)
1704 pDDSurfaceCallbacks
->GetBltStatus
= DdGetBltStatus
;
1706 if (Flags
& DDHAL_SURFCB32_GETFLIPSTATUS
)
1708 pDDSurfaceCallbacks
->GetFlipStatus
= DdGetFlipStatus
;
1710 if (Flags
& DDHAL_SURFCB32_UPDATEOVERLAY
)
1712 pDDSurfaceCallbacks
->UpdateOverlay
= DdUpdateOverlay
;
1714 if (Flags
& DDHAL_SURFCB32_SETOVERLAYPOSITION
)
1716 pDDSurfaceCallbacks
->SetOverlayPosition
= DdSetOverlayPosition
;
1718 if (Flags
& DDHAL_SURFCB32_ADDATTACHEDSURFACE
)
1720 pDDSurfaceCallbacks
->AddAttachedSurface
= DdAddAttachedSurface
;
1724 /* Check for DD Palette Callbacks, This interface are dead for user mode,
1725 * only what it can support are being report back.
1727 if (pDDPaletteCallbacks
)
1729 /* Zero the struct */
1730 RtlZeroMemory(pDDPaletteCallbacks
, sizeof(DDHAL_DDPALETTECALLBACKS
));
1732 /* Write the header */
1733 pDDPaletteCallbacks
->dwSize
= sizeof(DDHAL_DDPALETTECALLBACKS
);
1734 pDDPaletteCallbacks
->dwFlags
= CallbackFlags
[2];
1739 /* Zero the struct */
1740 RtlZeroMemory(pD3dCallbacks
, sizeof(DDHAL_DDEXEBUFCALLBACKS
));
1742 /* Check if we have one */
1743 if (D3dCallbacks
.dwSize
)
1745 /* Write the header */
1746 pD3dCallbacks
->dwSize
= sizeof(DDHAL_DDEXEBUFCALLBACKS
);
1748 /* Now check for each callback */
1749 if (D3dCallbacks
.ContextCreate
)
1751 pD3dCallbacks
->ContextCreate
= (LPD3DHAL_CONTEXTCREATECB
) D3dContextCreate
;
1753 if (D3dCallbacks
.ContextDestroy
)
1755 pD3dCallbacks
->ContextDestroy
= (LPD3DHAL_CONTEXTDESTROYCB
) NtGdiD3dContextDestroy
;
1757 if (D3dCallbacks
.ContextDestroyAll
)
1759 pD3dCallbacks
->ContextDestroyAll
= (LPD3DHAL_CONTEXTDESTROYALLCB
) NtGdiD3dContextDestroyAll
;
1764 /* Check for D3D Driver Data */
1767 /* Copy the struct */
1768 RtlMoveMemory(pD3dDriverData
, &D3dDriverData
, sizeof(D3DHAL_GLOBALDRIVERDATA
));
1770 /* Write the pointer to the texture formats */
1771 pD3dDriverData
->lpTextureFormats
= pD3dTextureFormats
;
1774 /* Check for D3D Buffer Callbacks */
1775 if (pD3dBufferCallbacks
)
1777 /* Zero the struct */
1778 RtlZeroMemory(pD3dBufferCallbacks
, sizeof(DDHAL_DDEXEBUFCALLBACKS
));
1780 if ( D3dBufferCallbacks
.dwSize
)
1782 pD3dBufferCallbacks
->dwSize
= D3dBufferCallbacks
.dwSize
;
1784 pD3dBufferCallbacks
->dwFlags
= D3dBufferCallbacks
.dwFlags
;
1785 if ( D3dBufferCallbacks
.CanCreateD3DBuffer
)
1787 pD3dBufferCallbacks
->CanCreateExecuteBuffer
= (LPDDHALEXEBUFCB_CANCREATEEXEBUF
)DdCanCreateD3DBuffer
;
1790 if (D3dBufferCallbacks
.CreateD3DBuffer
)
1792 pD3dBufferCallbacks
->CreateExecuteBuffer
= (LPDDHALEXEBUFCB_CREATEEXEBUF
) DdCreateD3DBuffer
;
1795 if ( D3dBufferCallbacks
.DestroyD3DBuffer
)
1797 pD3dBufferCallbacks
->DestroyExecuteBuffer
= (LPDDHALEXEBUFCB_DESTROYEXEBUF
) DdDestroyD3DBuffer
;
1800 if ( D3dBufferCallbacks
.LockD3DBuffer
)
1802 pD3dBufferCallbacks
->LockExecuteBuffer
= (LPDDHALEXEBUFCB_LOCKEXEBUF
) DdLockD3D
;
1805 if ( D3dBufferCallbacks
.UnlockD3DBuffer
)
1807 pD3dBufferCallbacks
->UnlockExecuteBuffer
= (LPDDHALEXEBUFCB_UNLOCKEXEBUF
) DdUnlockD3D
;
1813 /* FIXME VidMemList */
1818 HeapFree(GetProcessHeap(), 0, VidMemList
);
1831 DdDeleteDirectDrawObject(LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal
)
1833 BOOL Return
= FALSE
;
1835 /* If this is the global object */
1836 if(pDirectDrawGlobal
->hDD
)
1839 Return
= NtGdiDdDeleteDirectDrawObject((HANDLE
)pDirectDrawGlobal
->hDD
);
1842 pDirectDrawGlobal
->hDD
= 0;
1845 else if (ghDirectDraw
)
1847 /* Always success here */
1850 /* Make sure this is the last instance */
1851 if (!(--gcDirectDraw
))
1853 /* Delete the object */
1854 Return
= NtGdiDdDeleteDirectDrawObject(ghDirectDraw
);
1873 DdCreateSurfaceObject( LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal
,
1874 BOOL bPrimarySurface
)
1876 return bDDCreateSurface(pSurfaceLocal
, TRUE
);
1887 DdDeleteSurfaceObject(LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal
)
1889 BOOL Return
= FALSE
;
1891 /* Make sure there is one */
1892 if (pSurfaceLocal
->hDDSurface
)
1895 Return
= NtGdiDdDeleteSurfaceObject((HANDLE
)pSurfaceLocal
->hDDSurface
);
1896 pSurfaceLocal
->hDDSurface
= 0;
1909 DdResetVisrgn(LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal
,
1912 /* Call win32k directly */
1913 return NtGdiDdResetVisrgn((HANDLE
) pSurfaceLocal
->hDDSurface
, hWnd
);
1923 DdGetDC(LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal
,
1924 LPPALETTEENTRY pColorTable
)
1926 /* Call win32k directly */
1927 return NtGdiDdGetDC(pColorTable
, (HANDLE
) pSurfaceLocal
->hDDSurface
);
1937 DdReleaseDC(LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal
)
1939 /* Call win32k directly */
1940 return NtGdiDdReleaseDC((HANDLE
) pSurfaceLocal
->hDDSurface
);
1949 DdCreateDIBSection(HDC hdc
,
1950 CONST BITMAPINFO
*pbmi
,
1956 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1967 DdReenableDirectDrawObject(LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal
,
1970 /* Call win32k directly */
1971 return NtGdiDdReenableDirectDrawObject(GetDdHandle(pDirectDrawGlobal
->hDD
),
1983 DdAttachSurface( LPDDRAWI_DDRAWSURFACE_LCL pSurfaceFrom
,
1984 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceTo
)
1986 /* Create Surface if it does not exits one */
1987 if (!pSurfaceFrom
->hDDSurface
)
1989 if (!bDDCreateSurface(pSurfaceFrom
, FALSE
))
1995 /* Create Surface if it does not exits one */
1996 if (!pSurfaceTo
->hDDSurface
)
1998 if (!bDDCreateSurface(pSurfaceTo
, FALSE
))
2005 return NtGdiDdAttachSurface((HANDLE
)pSurfaceFrom
->hDDSurface
,
2006 (HANDLE
)pSurfaceTo
->hDDSurface
);
2016 DdUnattachSurface(LPDDRAWI_DDRAWSURFACE_LCL pSurface
,
2017 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceAttached
)
2020 NtGdiDdUnattachSurface((HANDLE
)pSurface
->hDDSurface
,
2021 (HANDLE
)pSurfaceAttached
->hDDSurface
);
2031 DdQueryDisplaySettingsUniqueness(VOID
)
2033 return GdiSharedHandleTable
->flDeviceUniq
;
2043 DdGetDxHandle(LPDDRAWI_DIRECTDRAW_LCL pDDraw
,
2044 LPDDRAWI_DDRAWSURFACE_LCL pSurface
,
2048 HANDLE hSurface
= NULL
;
2050 /* Check if we already have a surface */
2053 /* We don't have one, use the DirectDraw Object handle instead */
2054 hDD
= GetDdHandle(pDDraw
->lpGbl
->hDD
);
2058 hSurface
= (HANDLE
)pSurface
->hDDSurface
;
2062 return (HANDLE
)NtGdiDdGetDxHandle(hDD
, hSurface
, bRelease
);
2072 DdSetGammaRamp(LPDDRAWI_DIRECTDRAW_LCL pDDraw
,
2076 /* Call win32k directly */
2077 return NtGdiDdSetGammaRamp(GetDdHandle(pDDraw
->lpGbl
->hDD
),