Add new struct call EDD_SURFACE_LOCAL it is base on DD_SURFACE_LOCAL

Change DxLocksurface using this new struct 

svn path=/trunk/; revision=31510
This commit is contained in:
Magnus Olsen 2007-12-31 02:54:23 +00:00
parent a4aca0de8c
commit 39075187dd
2 changed files with 13 additions and 4 deletions

View file

@ -62,6 +62,12 @@ typedef struct _DD_BASEOBJECT
PVOID pUser; PVOID pUser;
} DD_ENTRY, *PDD_ENTRY; } DD_ENTRY, *PDD_ENTRY;
typedef struct _EDD_SURFACE_LOCAL
{
DD_BASEOBJECT Object;
DD_SURFACE_LOCAL Surfacelcl;
} EDD_SURFACE_LOCAL, *PEDD_SURFACE_LOCAL;

View file

@ -16,12 +16,13 @@ PDD_SURFACE_LOCAL
STDCALL STDCALL
DxDdLockDirectDrawSurface(HANDLE hDdSurface) DxDdLockDirectDrawSurface(HANDLE hDdSurface)
{ {
PEDD_SURFACE_LOCAL pEDDSurfacelcl = NULL;
PDD_SURFACE_LOCAL pSurfacelcl = NULL; PDD_SURFACE_LOCAL pSurfacelcl = NULL;
pSurfacelcl = DdHmgLock(hDdSurface, 2, FALSE); pSurfacelcl = DdHmgLock(hDdSurface, 2, FALSE);
if (pSurfacelcl != NULL) if (pSurfacelcl != NULL)
{ {
pSurfacelcl = (PDD_SURFACE_LOCAL)(((PBYTE)&pSurfacelcl) + sizeof(DD_BASEOBJECT)); pSurfacelcl = &pEDDSurfacelcl->Surfacelcl;
} }
return pSurfacelcl; return pSurfacelcl;
@ -32,12 +33,12 @@ STDCALL
DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface) DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface)
{ {
BOOL retVal = FALSE; BOOL retVal = FALSE;
PDD_BASEOBJECT pObject = NULL; PEDD_SURFACE_LOCAL pEDDSurfacelcl = NULL;
if (pSurface) if (pSurface)
{ {
pObject = (PDD_BASEOBJECT)( ((PBYTE)&pSurface) - sizeof(DD_BASEOBJECT)); pEDDSurfacelcl = (PEDD_SURFACE_LOCAL)( ((PBYTE)pSurface) - sizeof(DD_BASEOBJECT));
InterlockedDecrement(&pObject->cExclusiveLock); InterlockedDecrement(&pEDDSurfacelcl->Object.cExclusiveLock);
retVal = TRUE; retVal = TRUE;
} }
@ -45,3 +46,5 @@ DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface)
} }