mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 16:10:29 +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
2 changed files with 12 additions and 3 deletions
|
@ -152,13 +152,19 @@ Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD lpNumCodes, LPDWORD
|
|||
EnterCriticalSection(&ddcs);
|
||||
|
||||
if(!lpNumCodes)
|
||||
{
|
||||
LeaveCriticalSection(&ddcs);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&ddcs);
|
||||
return DD_OK;
|
||||
|
|
|
@ -33,6 +33,9 @@ Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD coopl
|
|||
}
|
||||
#endif
|
||||
|
||||
if(hwnd && IsWindow(hwnd))
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
/* Tests suggest that we need one of them: */
|
||||
if(!(cooplevel & (DDSCL_SETFOCUSWINDOW |
|
||||
DDSCL_NORMAL |
|
||||
|
|
Loading…
Reference in a new issue