mirror of
https://github.com/reactos/reactos.git
synced 2024-07-12 07:35:10 +00:00
Fixing another memory crash bug this time for GetFourCCCodes
svn path=/trunk/; revision=26860
This commit is contained in:
parent
3893f07116
commit
d746c66d94
|
@ -146,28 +146,31 @@ HRESULT WINAPI
|
|||
Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD lpNumCodes, LPDWORD lpCodes)
|
||||
{
|
||||
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
|
||||
HRESULT retVal = DD_OK;
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
/* FIXME protect with SEH or something else if lpCodes or lpNumCodes for bad user pointers */
|
||||
EnterCriticalSection(&ddcs);
|
||||
|
||||
if(!lpNumCodes)
|
||||
{
|
||||
LeaveCriticalSection(&ddcs);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
if(lpCodes)
|
||||
{
|
||||
memcpy(lpCodes, This->lpLcl->lpGbl->lpdwFourCC, sizeof(DWORD)* min(This->lpLcl->lpGbl->dwNumFourCC, *lpNumCodes));
|
||||
}
|
||||
else
|
||||
{
|
||||
*lpNumCodes = This->lpLcl->lpGbl->dwNumFourCC;
|
||||
}
|
||||
if(!lpNumCodes)
|
||||
{
|
||||
retVal = DDERR_INVALIDPARAMS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((lpCodes) && (*lpCodes))
|
||||
{
|
||||
memcpy(lpCodes, This->lpLcl->lpGbl->lpdwFourCC, sizeof(DWORD)* min(This->lpLcl->lpGbl->dwNumFourCC, *lpNumCodes));
|
||||
}
|
||||
else
|
||||
{
|
||||
*lpNumCodes = This->lpLcl->lpGbl->dwNumFourCC;
|
||||
}
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&ddcs);
|
||||
return DD_OK;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
|
|
|
@ -188,7 +188,7 @@ StartDirectDraw(LPDIRECTDRAW iface, LPGUID lpGuid, BOOL reenable)
|
|||
|
||||
if (reenable == FALSE)
|
||||
{
|
||||
if (This->lpLink == NULL)
|
||||
if ((!IsBadReadPtr(This->lpLink,sizeof(LPDIRECTDRAW))) && (This->lpLink == NULL))
|
||||
{
|
||||
RtlZeroMemory(&ddgbl, sizeof(DDRAWI_DIRECTDRAW_GBL));
|
||||
This->lpLcl->lpGbl->dwRefCnt++;
|
||||
|
@ -470,6 +470,8 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
|
|||
// FIXME Close DX fristcall and second call
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
DX_STUB_str("Here\n");
|
||||
|
||||
/* Alloc mpFourCC */
|
||||
mpFourCC = NULL;
|
||||
|
|
Loading…
Reference in a new issue