fixing thread safe in GetFourCCCodes

svn path=/trunk/; revision=26853
This commit is contained in:
Magnus Olsen 2007-05-21 16:23:43 +00:00
parent 1c247edcf4
commit 327cd7852d

View file

@ -131,7 +131,7 @@ Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
memcpy(&memdata.DDSCaps, ddscaps, sizeof(DDSCAPS2));
if (This->lpLcl->lpDDCB->cbDDMiscellaneousCallbacks.GetAvailDriverMemory(&memdata) == DDHAL_DRIVER_NOTHANDLED)
return DDERR_NODIRECTDRAWHW;
return DDERR_NODIRECTDRAWHW;
if (dwTotal)
*dwTotal = memdata.dwTotal;
@ -148,15 +148,20 @@ Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD lpNumCodes, LPDWORD
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
DX_WINDBG_trace();
if(!lpNumCodes)
return DDERR_INVALIDPARAMS;
/* FIXME protect with SEH or something else if lpCodes or lpNumCodes for bad user pointers */
EnterCriticalSection(&ddcs);
if(lpCodes)
memcpy(lpCodes, This->lpLcl->lpGbl->lpdwFourCC, sizeof(DWORD)*(*lpNumCodes));
else
*lpNumCodes = This->lpLcl->lpGbl->dwNumFourCC;
if(!lpNumCodes)
return DDERR_INVALIDPARAMS;
return DD_OK;
if(lpCodes)
memcpy(lpCodes, This->lpLcl->lpGbl->lpdwFourCC, sizeof(DWORD)*(*lpNumCodes));
else
*lpNumCodes = This->lpLcl->lpGbl->dwNumFourCC;
LeaveCriticalSection(&ddcs);
return DD_OK;
}
HRESULT WINAPI