From 16e2a9aecc86c4d01d327506f3b45eee0cae6359 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 21 Jun 2021 17:15:02 +0800 Subject: [PATCH] uxtheme: Check window handle for GetWindowTheme(). Signed-off-by: Zhiyi Zhang Signed-off-by: Alexandre Julliard --- 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);