xref: /reactos/win32ss/reactx/dxg/dd.c (revision 8a978a17)
1 /*
2  * COPYRIGHT:        See COPYING in the top level directory
3  * PROJECT:          ReactOS kernel
4  * PURPOSE:          Native driver for dxg implementation
5  * FILE:             win32ss/reactx/dxg/dd.c
6  * PROGRAMER:        Sebastian Gasiorek (sebastian.gasiorek@reactos.org)
7  */
8 
9 #include <dxg_int.h>
10 
11 DWORD
12 NTAPI
13 DxDdCanCreateSurface(
14     HANDLE DdHandle,
15     PDD_CANCREATESURFACEDATA SurfaceData)
16 {
17     PEDD_DIRECTDRAW_LOCAL peDdL;
18     PEDD_DIRECTDRAW_GLOBAL peDdGl;
19     DWORD RetVal = DDHAL_DRIVER_NOTHANDLED;
20 
21     peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE);
22     if (!peDdL)
23         return RetVal;
24 
25     peDdGl = peDdL->peDirectDrawGlobal2;
26     gpEngFuncs.DxEngLockHdev(peDdGl->hDev);
27 
28     // assign out DirectDrawGlobal to SurfaceData
29     SurfaceData->lpDD = (PDD_DIRECTDRAW_GLOBAL)peDdGl;
30 
31     if (peDdGl->ddCallbacks.dwFlags & DDHAL_CB32_CANCREATESURFACE)
32     {
33         RetVal = peDdGl->ddCallbacks.CanCreateSurface(SurfaceData);
34     }
35 
36     gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev);
37     InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock);
38 
39     return RetVal;
40 }
41