mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
Fixing smaller bugs in ddraw.dll
GetCaps 1. GetCaps should not call get avail memory for hel 2. add ddcaps size check 3. add Enter/leave CriticalSection GetDeviceIdentifier 1. add Enter/leave CriticalSection svn path=/trunk/; revision=31402
This commit is contained in:
@@ -32,7 +32,9 @@ Main_DirectDraw_GetCaps( LPDDRAWI_DIRECTDRAW_INT This, LPDDCAPS pDriverCaps,
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
_SEH_TRY
|
||||
EnterCriticalSection( &ddcs );
|
||||
|
||||
_SEH_TRY
|
||||
{
|
||||
if ((!pDriverCaps) && (!pHELCaps))
|
||||
{
|
||||
@@ -40,6 +42,34 @@ Main_DirectDraw_GetCaps( LPDDRAWI_DIRECTDRAW_INT This, LPDDCAPS pDriverCaps,
|
||||
_SEH_LEAVE;
|
||||
}
|
||||
|
||||
/*
|
||||
* DDCAPS_DX6 and DDCAPS_DX7 have same size so
|
||||
* we do not need check both only one of them
|
||||
*/
|
||||
if ( (pDriverCaps) &&
|
||||
(pDriverCaps->dwSize != sizeof(DDCAPS_DX1) ) &&
|
||||
(pDriverCaps->dwSize != sizeof(DDCAPS_DX3) ) &&
|
||||
(pDriverCaps->dwSize != sizeof(DDCAPS_DX5) ) &&
|
||||
(pDriverCaps->dwSize != sizeof(DDCAPS_DX7 )) )
|
||||
{
|
||||
retVal = DDERR_INVALIDPARAMS;
|
||||
_SEH_LEAVE;
|
||||
}
|
||||
|
||||
/*
|
||||
* DDCAPS_DX6 and DDCAPS_DX7 have same size so
|
||||
* we do not need check both only one of them
|
||||
*/
|
||||
if ( (pHELCaps) &&
|
||||
(pHELCaps->dwSize != sizeof(DDCAPS_DX1) ) &&
|
||||
(pHELCaps->dwSize != sizeof(DDCAPS_DX3) ) &&
|
||||
(pHELCaps->dwSize != sizeof(DDCAPS_DX5) ) &&
|
||||
(pHELCaps->dwSize != sizeof(DDCAPS_DX7 )) )
|
||||
{
|
||||
retVal = DDERR_INVALIDPARAMS;
|
||||
_SEH_LEAVE;
|
||||
}
|
||||
|
||||
if (pDriverCaps)
|
||||
{
|
||||
/* Setup hardware caps */
|
||||
@@ -153,14 +183,11 @@ Main_DirectDraw_GetCaps( LPDDRAWI_DIRECTDRAW_INT This, LPDDCAPS pDriverCaps,
|
||||
if (pHELCaps)
|
||||
{
|
||||
/* Setup software caps */
|
||||
DDSCAPS2 ddscaps = { 0 };
|
||||
LPDDCORECAPS CoreCaps = (LPDDCORECAPS)&This->lpLcl->lpGbl->ddHELCaps;
|
||||
|
||||
DWORD dwTotal = 0;
|
||||
DWORD dwFree = 0;
|
||||
|
||||
Main_DirectDraw_GetAvailableVidMem4(This, &ddscaps, &dwTotal, &dwFree);
|
||||
|
||||
switch (pHELCaps->dwSize)
|
||||
{
|
||||
case sizeof(DDCAPS_DX1):
|
||||
@@ -260,7 +287,6 @@ Main_DirectDraw_GetCaps( LPDDRAWI_DIRECTDRAW_INT This, LPDDCAPS pDriverCaps,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
@@ -268,6 +294,7 @@ Main_DirectDraw_GetCaps( LPDDRAWI_DIRECTDRAW_INT This, LPDDCAPS pDriverCaps,
|
||||
}
|
||||
_SEH_END;
|
||||
|
||||
return retVal;
|
||||
LeaveCriticalSection( &ddcs );
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ Main_DirectDraw_GetDeviceIdentifier7(LPDDRAWI_DIRECTDRAW_INT This,
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
EnterCriticalSection( &ddcs );
|
||||
|
||||
_SEH_TRY
|
||||
{
|
||||
if ( (IsBadWritePtr( pDDDI, sizeof(DDDEVICEIDENTIFIER2) ) ) ||
|
||||
@@ -184,5 +186,6 @@ Main_DirectDraw_GetDeviceIdentifier7(LPDDRAWI_DIRECTDRAW_INT This,
|
||||
}
|
||||
_SEH_END;
|
||||
|
||||
LeaveCriticalSection( &ddcs );
|
||||
return retVal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user