ReactOS 0.4.15-dev-7924-g5949c20
ddsurf.c
Go to the documentation of this file.
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/ddsurf.c
6 * PROGRAMER: Sebastian Gasiorek (sebastian.gasiorek@reactos.org)
7 */
8
9#include <dxg_int.h>
10
11/*++
12* @name DxDdLock
13* @implemented
14*
15* The function DxDdLock locks the surface and calls
16* MapMemory driver function to assign surface memory.
17* Surface memory is returned in mapMemoryData.fpProcess variable
18*
19* @param HANDLE hSurface
20* Handle to DirectDraw surface
21*
22* @param PDD_LOCKDATA puLockData
23* Structure with lock details
24*
25* @param HDC hdcClip
26* Reserved
27*
28* @return
29* Returns DDHAL_DRIVER_HANDLED or DDHAL_DRIVER_NOTHANDLED.
30*
31* @remarks.
32* Missing lock data and error handling.
33*--*/
37 PDD_LOCKDATA puLockData,
38 HDC hdcClip)
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
74}
75
76/*++
77* @name DxDdUnlock
78* @unimplemented
79*
80* The function DxDdUnlock releases the lock from specified surface
81*
82* @param HANDLE hSurface
83* Handle to DirectDraw surface
84*
85* @param PDD_UNLOCKDATA puUnlockData
86* Structure with lock details
87*
88* @return
89* Returns DDHAL_DRIVER_HANDLED or DDHAL_DRIVER_NOTHANDLED.
90*
91* @remarks.
92* Stub
93*--*/
97 PDD_UNLOCKDATA puUnlockData)
98{
99 puUnlockData->ddRVal = DD_OK;
100
102}
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
#define DDHAL_DRIVER_HANDLED
Definition: ddrawi.h:321
#define DDHAL_CB32_MAPMEMORY
Definition: ddrawint.h:519
struct _DD_DIRECTDRAW_GLOBAL * PDD_DIRECTDRAW_GLOBAL
struct _EDD_SURFACE * PEDD_SURFACE
#define TRUE
Definition: types.h:120
DWORD NTAPI DxDdUnlock(HANDLE hSurface, PDD_UNLOCKDATA puUnlockData)
Definition: ddsurf.c:96
DWORD NTAPI DxDdLock(HANDLE hSurface, PDD_LOCKDATA puLockData, HDC hdcClip)
Definition: ddsurf.c:36
#define ObjType_DDSURFACE_TYPE
Definition: dxg_int.h:52
unsigned long DWORD
Definition: ntddk_ex.h:95
#define InterlockedExchangeAdd
Definition: interlocked.h:181
static HDC
Definition: imagelist.c:92
long LONG
Definition: pedump.c:60
#define DD_OK
Definition: ddraw.h:186
DWORD dwFlags
Definition: ddrawint.h:499
PDD_MAPMEMORY MapMemory
Definition: ddrawint.h:508
HRESULT ddRVal
Definition: ddrawint.h:248
FLATPTR fpProcess
Definition: ddrawint.h:486
PDD_DIRECTDRAW_GLOBAL lpDD
Definition: ddrawint.h:483
HRESULT ddRVal
Definition: ddrawint.h:487
HRESULT ddRVal
Definition: ddrawint.h:258
DD_CALLBACKS ddCallbacks
Definition: directxint.h:160
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
#define NTAPI
Definition: typedefs.h:36
PVOID HANDLE
Definition: typedefs.h:73
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481