--- trunk/reactos/subsys/win32k/objects/dc.c 2006-01-24 23:10:17 UTC (rev 21013)
+++ trunk/reactos/subsys/win32k/objects/dc.c 2006-01-25 01:46:46 UTC (rev 21014)
@@ -2069,8 +2069,17 @@
HRGN hVisRgn;
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);
if (NULL == dc)
{