[PATCH 4/5] uxtheme: Check window handle for GetWindowTheme().
Zhiyi Zhang
zzhang at codeweavers.com
Mon Jun 21 04:15:02 CDT 2021
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
dlls/uxtheme/system.c | 7 +++++++
dlls/uxtheme/tests/system.c | 5 +----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c
index 1c25f38d5d9..49742c947a0 100644
--- a/dlls/uxtheme/system.c
+++ b/dlls/uxtheme/system.c
@@ -669,6 +669,13 @@ HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
HTHEME WINAPI GetWindowTheme(HWND hwnd)
{
TRACE("(%p)\n", hwnd);
+
+ if (!hwnd)
+ {
+ SetLastError(E_HANDLE);
+ return NULL;
+ }
+
return GetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atWindowTheme));
}
diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c
index a5d962d17a3..7ec72e30259 100644
--- a/dlls/uxtheme/tests/system.c
+++ b/dlls/uxtheme/tests/system.c
@@ -81,10 +81,7 @@ static void test_GetWindowTheme(void)
SetLastError(0xdeadbeef);
hTheme = GetWindowTheme(NULL);
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
- todo_wine
- ok( GetLastError() == E_HANDLE,
- "Expected E_HANDLE, got 0x%08x\n",
- GetLastError());
+ ok( GetLastError() == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", GetLastError() );
/* Only do the bare minimum to get a valid hwnd */
hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
--
2.30.2
More information about the wine-devel
mailing list