SelectObject with a NULL DC returns 0 and sets ERROR_INVALID_HANDLE.

svn path=/trunk/; revision=21014
This commit is contained in:
James Tabor 2006-01-25 01:46:46 +00:00
parent d81a4d5c75
commit aeffcda51e

View file

@ -2069,8 +2069,17 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
HRGN hVisRgn; HRGN hVisRgn;
BOOLEAN Failed; BOOLEAN Failed;
if(!hDC || !hGDIObj) return NULL; if (!hDC || !hGDIObj)
{
/* From Wine:
* SelectObject() with a NULL DC returns 0 and sets ERROR_INVALID_HANDLE.
* Note: Under XP at least invalid ptrs can also be passed, not just NULL;
* Don't test that here in case it crashes earlier win versions.
*/
if (!hDC) SetLastWin32Error(ERROR_INVALID_HANDLE);
return NULL;
}
dc = DC_LockDc(hDC); dc = DC_LockDc(hDC);
if (NULL == dc) if (NULL == dc)
{ {