mirror of
https://github.com/reactos/reactos.git
synced 2024-08-02 09:30:55 +00:00
- Also leave critical section if lpNumCodes is 0
- make sure we do not copy too much - thanks to Hervé - check if window is valid svn path=/trunk/; revision=26854
This commit is contained in:
parent
327cd7852d
commit
813da313d4
|
@ -152,13 +152,19 @@ Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD lpNumCodes, LPDWORD
|
||||||
EnterCriticalSection(&ddcs);
|
EnterCriticalSection(&ddcs);
|
||||||
|
|
||||||
if(!lpNumCodes)
|
if(!lpNumCodes)
|
||||||
|
{
|
||||||
|
LeaveCriticalSection(&ddcs);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
|
}
|
||||||
|
|
||||||
if(lpCodes)
|
if(lpCodes)
|
||||||
memcpy(lpCodes, This->lpLcl->lpGbl->lpdwFourCC, sizeof(DWORD)*(*lpNumCodes));
|
{
|
||||||
else
|
memcpy(lpCodes, This->lpLcl->lpGbl->lpdwFourCC, sizeof(DWORD)* MIN(This->lpLcl->lpGbl->dwNumFourCC, *lpNumCodes));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
*lpNumCodes = This->lpLcl->lpGbl->dwNumFourCC;
|
*lpNumCodes = This->lpLcl->lpGbl->dwNumFourCC;
|
||||||
|
}
|
||||||
|
|
||||||
LeaveCriticalSection(&ddcs);
|
LeaveCriticalSection(&ddcs);
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
|
|
|
@ -33,6 +33,9 @@ Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD coopl
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(hwnd && IsWindow(hwnd))
|
||||||
|
return DDERR_INVALIDPARAMS;
|
||||||
|
|
||||||
/* Tests suggest that we need one of them: */
|
/* Tests suggest that we need one of them: */
|
||||||
if(!(cooplevel & (DDSCL_SETFOCUSWINDOW |
|
if(!(cooplevel & (DDSCL_SETFOCUSWINDOW |
|
||||||
DDSCL_NORMAL |
|
DDSCL_NORMAL |
|
||||||
|
|
Loading…
Reference in a new issue