From 57cfafda1d4e2bba86fcec21fd8d8a661a7846a8 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Wed, 2 Jan 2008 08:47:46 +0000 Subject: [PATCH] implement DxEngLockShareSem implement DxEngUnlockShareSem svn path=/trunk/; revision=31554 --- .../include/reactos/drivers/directx/dxeng.h | 10 +-- .../subsystems/win32/win32k/ntddraw/dxeng.c | 70 ++++++++++++++----- 2 files changed, 59 insertions(+), 21 deletions(-) diff --git a/reactos/include/reactos/drivers/directx/dxeng.h b/reactos/include/reactos/drivers/directx/dxeng.h index 6f214ef0761..d3174038374 100644 --- a/reactos/include/reactos/drivers/directx/dxeng.h +++ b/reactos/include/reactos/drivers/directx/dxeng.h @@ -78,13 +78,15 @@ BOOL DxEngUnlockDC(PDC pDC); /* Notes : Set Gamma ramp */ BOOL DxEngSetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp, BOOL Unuse); -/* prototypes are not done yet, I need gather all my notes - * to make them correct +BOOLEAN DxEngLockShareSem(); +BOOLEAN DxEngUnlockShareSem(); + +/* prototypes are not done yet, I need gather all my notes + * to make them correct */ DWORD DxEngCreateMemoryDC(DWORD x1); DWORD DxEngScreenAccessCheck(); -DWORD DxEngLockShareSem(); -DWORD DxEngUnlockShareSem(); + DWORD DxEngLockHdev(DWORD x1); DWORD DxEngUnlockHdev(DWORD x1); DWORD DxEngReferenceHdev(DWORD x1); diff --git a/reactos/subsystems/win32/win32k/ntddraw/dxeng.c b/reactos/subsystems/win32/win32k/ntddraw/dxeng.c index 9e5b3457b06..309054528fb 100644 --- a/reactos/subsystems/win32/win32k/ntddraw/dxeng.c +++ b/reactos/subsystems/win32/win32k/ntddraw/dxeng.c @@ -10,6 +10,7 @@ #include #include +ERESOURCE ghsemShareDevLock; @@ -214,22 +215,57 @@ DWORD DxEngScreenAccessCheck() return FALSE; } -/************************************************************************/ -/* DxEngLockShareSem */ -/************************************************************************/ -DWORD DxEngLockShareSem() +/*++ +* @name DxEngLockShareSem +* @implemented +* +* The function DxEngLockShareSem doing share lock of ghsemShareDevLock +* +* @return +* This function returns TRUE for susssess, or FALSE for fail, FALSE can only +* mean it being already lock. +* +* @remarks. +* it being use in diffent ntuser* functions and ntgdi* +* ReactOS specify it is not been inuse at moment +*SystemResourcesList +*--*/ +BOOLEAN +DxEngLockShareSem() { - UNIMPLEMENTED; - return FALSE; + BOOLEAN retVal = 0; + + if (ExIsResourceAcquiredExclusiveLite(&ghsemShareDevLock) == FALSE) + { + KeEnterCriticalRegion(); + retVal = ExAcquireResourceExclusiveLite(&ghsemShareDevLock, TRUE); + } + + return retVal; } -/************************************************************************/ -/* DxEngUnlockShareSem */ -/************************************************************************/ -DWORD DxEngUnlockShareSem() +/*++ +* @name DxEngUnlockShareSem +* @implemented +* +* The function DxEngUnlockShareSem doing share unlock of ghsemShareDevLock +* +* @return +* This function returns TRUE no matter what +* +* @remarks. +* ReactOS specify it is not been inuse at moment +* +*--*/ +BOOLEAN +DxEngUnlockShareSem() { - UNIMPLEMENTED; - return FALSE; + if (ExIsResourceAcquiredExclusiveLite(&ghsemShareDevLock) == TRUE) + { + ExReleaseResourceLite(&ghsemShareDevLock); + KeLeaveCriticalRegion(); + } + return TRUE; } /************************************************************************/ @@ -415,9 +451,9 @@ DWORD DxEngSetDCState(DWORD x1, DWORD x2, DWORD x3) * The DC handle * * @param DWORD type -* value 1 = Is DC fullscreen -* value 2 = Get Complexity of visible region. -* value 3 = Get Driver hdev, which is a pPDev. +* value 1 = Is DC fullscreen +* value 2 = Get Complexity of visible region. +* value 3 = Get Driver hdev, which is a pPDev. * * @return * Return one of the type values @@ -445,13 +481,13 @@ DxEngGetDCState(HDC hDC, break; case 3: { - /* Return the HDEV of this DC. */ + /* Return the HDEV of this DC. */ retVal = (DWORD) pDC->pPDev; break; } default: /* if a valid type is not found, zero is returned */ - DPRINT1("Warning did not find type %d\n",type); + DPRINT1("Warning did not find type %d\n",type); break; } DC_UnlockDc(pDC);