uxtheme: Check window handle for GetWindowTheme().

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-06-21 17:15:02 +08:00 committed by Alexandre Julliard
parent f5e56638a7
commit 16e2a9aecc
2 changed files with 8 additions and 4 deletions

View File

@ -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));
}

View File

@ -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);