- 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:
Maarten Bosma 2007-05-21 17:18:41 +00:00
parent 327cd7852d
commit 813da313d4
2 changed files with 12 additions and 3 deletions

View file

@ -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;

View file

@ -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 |