ReactOS  0.4.14-dev-98-gb0d4763
ddsurf.c File Reference
#include <dxg_int.h>
Include dependency graph for ddsurf.c:

Go to the source code of this file.

Functions

DWORD NTAPI DxDdLock (HANDLE hSurface, PDD_LOCKDATA puLockData, HDC hdcClip)
 
DWORD NTAPI DxDdUnlock (HANDLE hSurface, PDD_UNLOCKDATA puUnlockData)
 

Function Documentation

◆ DxDdLock()

DWORD NTAPI DxDdLock ( HANDLE  hSurface,
PDD_LOCKDATA  puLockData,
HDC  hdcClip 
)

Definition at line 36 of file ddsurf.c.

39 {
43  DD_MAPMEMORYDATA mapMemoryData;
44 
46  peDdL = pSurface->peDirectDrawLocal;
47  peDdGl = peDdL->peDirectDrawGlobal2;
48 
49  // Map memory if it's not already mapped and driver function is provided
50  if (!peDdL->isMemoryMapped && (peDdGl->ddCallbacks.dwFlags & DDHAL_CB32_MAPMEMORY))
51  {
52  mapMemoryData.bMap = 1;
53  mapMemoryData.hProcess = (HANDLE)-1;
54  mapMemoryData.fpProcess = 0;
55  mapMemoryData.lpDD = (PDD_DIRECTDRAW_GLOBAL)peDdGl;
56 
57  peDdGl->ddCallbacks.MapMemory(&mapMemoryData);
58 
59  if (!mapMemoryData.ddRVal)
60  {
61  peDdL->isMemoryMapped = 1;
62  peDdL->fpProcess2 = mapMemoryData.fpProcess;
63  }
64  }
65 
66  if (pSurface)
67  {
68  InterlockedExchangeAdd((LONG*)&pSurface->pobj.cExclusiveLock, 0xFFFFFFFF);
69  }
70 
71  puLockData->ddRVal = DD_OK;
72 
73  return DDHAL_DRIVER_HANDLED;
74 }
#define TRUE
Definition: types.h:120
#define DDHAL_CB32_MAPMEMORY
Definition: ddrawint.h:519
struct _DD_DIRECTDRAW_GLOBAL * PDD_DIRECTDRAW_GLOBAL
#define ObjType_DDSURFACE_TYPE
Definition: dxg_int.h:57
PDD_DIRECTDRAW_GLOBAL lpDD
Definition: ddrawint.h:483
HRESULT ddRVal
Definition: ddrawint.h:487
#define DDHAL_DRIVER_HANDLED
Definition: ddrawi.h:321
#define DD_OK
Definition: ddraw.h:186
long LONG
Definition: pedump.c:60
#define InterlockedExchangeAdd
Definition: interlocked.h:181
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
PVOID HANDLE
Definition: typedefs.h:71
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
DD_CALLBACKS ddCallbacks
Definition: directxint.h:160
FLATPTR fpProcess
Definition: ddrawint.h:486
DWORD dwFlags
Definition: ddrawint.h:499
HRESULT ddRVal
Definition: ddrawint.h:248
struct _EDD_SURFACE * PEDD_SURFACE
PDD_MAPMEMORY MapMemory
Definition: ddrawint.h:508

◆ DxDdUnlock()

DWORD NTAPI DxDdUnlock ( HANDLE  hSurface,
PDD_UNLOCKDATA  puUnlockData 
)

Definition at line 96 of file ddsurf.c.

98 {
99  puUnlockData->ddRVal = DD_OK;
100 
101  return DDHAL_DRIVER_HANDLED;
102 }
#define DDHAL_DRIVER_HANDLED
Definition: ddrawi.h:321
#define DD_OK
Definition: ddraw.h:186
HRESULT ddRVal
Definition: ddrawint.h:258