[UXTHEME] -Fix most new tests for DrawThemeParentBackground. Hackfix CloseThemeData.
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 8 Mar 2017 15:08:56 +0000 (15:08 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 8 Mar 2017 15:08:56 +0000 (15:08 +0000)
svn path=/trunk/; revision=74127

reactos/dll/win32/uxtheme/draw.c
reactos/dll/win32/uxtheme/system.c

index f9d9eec..a4064b0 100644 (file)
@@ -78,9 +78,17 @@ HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
     int hasClip = -1;
     
     TRACE("(%p,%p,%p)\n", hwnd, hdc, prc);
+
+    if (!IsWindow(hwnd) || !hdc)
+        return E_HANDLE;
+
+    if (prc && IsBadReadPtr (prc, sizeof(RECT)))
+        return E_POINTER;
+
     hParent = GetParent(hwnd);
     if(!hParent)
-        hParent = hwnd;
+        return S_OK;
+
     if(prc) {
         rt = *prc;
         MapWindowPoints(hwnd, hParent, (LPPOINT)&rt, 2);
index a3b1ca1..393778f 100644 (file)
@@ -897,6 +897,8 @@ HRESULT WINAPI CloseThemeData(HTHEME hTheme)
     TRACE("(%p)\n", hTheme);
     if(!hTheme || hTheme == INVALID_HANDLE_VALUE)
         return E_HANDLE;
+    if(IsBadReadPtr (hTheme, sizeof(THEME_CLASS))) /* This check is a hack! */
+        return E_HANDLE;
     return MSSTYLES_CloseThemeClass(hTheme);
 }