Author: tkreuzer
Date: Wed Apr 25 18:15:41 2012
New Revision: 56424

URL: http://svn.reactos.org/svn/reactos?rev=56424&view=rev
Log:
[GDI32]
Fix SetWindowExtEx to pass all tests

Modified:
    trunk/reactos/win32ss/gdi/gdi32/objects/coord.c

Modified: trunk/reactos/win32ss/gdi/gdi32/objects/coord.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/coord.c?rev=56424&r1=56423&r2=56424&view=diff
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/objects/coord.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/objects/coord.c [iso-8859-1] Wed Apr 25 
18:15:41 2012
@@ -483,38 +483,42 @@
  */
 BOOL
 WINAPI
-SetWindowExtEx(HDC hdc,
-               int nXExtent,
-               int nYExtent,
-               LPSIZE lpSize)
+SetWindowExtEx(
+    _In_ HDC hdc,
+    _In_ INT nXExtent,
+    _In_ INT nYExtent,
+    _Out_opt_ LPSIZE lpSize)
 {
     PDC_ATTR pdcattr;
-
-#if 0
-    if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)
-    {
-        if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC)
-            return MFDRV_SetWindowExtEx();
-        else
-        {
-            PLDC pLDC = GdiGetLDC(hdc);
-            if ( !pLDC )
-            {
-                SetLastError(ERROR_INVALID_HANDLE);
-                return FALSE;
-            }
-            if (pLDC->iType == LDC_EMFLDC)
-            {
-                return EMFDRV_SetWindowExtEx();
-            }
-        }
-    }
-#endif
+    ULONG ulType;
+
+    /* Check what type of DC that is */
+    ulType = GDI_HANDLE_GET_TYPE(hdc);
+    switch (ulType)
+    {
+        case GDILoObjType_LO_DC_TYPE:
+            /* Handle this in the path below */
+            break;
+#if 0// FIXME: we don't support this
+        case GDILoObjType_LO_METADC16_TYPE:
+            return MFDRV_SetWindowExtEx(hdc, nXExtent, nYExtent, lpSize);
+
+        case GDILoObjType_LO_METAFILE_TYPE:
+            return EMFDRV_SetWindowExtEx(hdc, nXExtent, nYExtent, lpSize);
+#endif
+        default:
+            /* Other types are not allowed */
+            SetLastError(ERROR_INVALID_HANDLE);
+            return FALSE;
+    }
+
+    /* Get the DC attr */
     pdcattr = GdiGetDcAttr(hdc);
     if (!pdcattr)
     {
+        /* Set the error value and return failure */
         SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
+        return FALSE;
     }
 
     if (lpSize)
@@ -549,7 +553,8 @@
         if (pdcattr->dwLayout & LAYOUT_RTL) NtGdiMirrorWindowOrg(hdc);
         pdcattr->flXform |= 
(PAGE_EXTENTS_CHANGED|INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID);
     }
-    return TRUE; // Return TRUE.
+
+    return TRUE;
 }
 
 /*


Reply via email to