Module: wine Branch: master Commit: dfffe7b49c3b60dd9d96c2f45a88d59d0f7d9587 URL: https://gitlab.winehq.org/wine/wine/-/commit/dfffe7b49c3b60dd9d96c2f45a88d59...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Thu Nov 2 14:21:36 2023 +0300
uxtheme: If the application class is already set then OpenThemeData() should fail.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru
---
dlls/uxtheme/msstyles.c | 18 ++++++++++++------ dlls/uxtheme/tests/system.c | 2 -- 2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/dlls/uxtheme/msstyles.c b/dlls/uxtheme/msstyles.c index 4c67e3b15c5..4fc9a344661 100644 --- a/dlls/uxtheme/msstyles.c +++ b/dlls/uxtheme/msstyles.c @@ -1076,9 +1076,12 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList, U
parse_app_class_name(buf, szAppName, szClassName); if (szAppName[0]) - cls = MSSTYLES_FindClass(tfActiveTheme, szAppName, szClassName); - else - cls = MSSTYLES_FindClass(tfActiveTheme, pszAppName, szClassName); + { + /* If the application class is already set then fail */ + if (pszAppName) return NULL; + pszAppName = szAppName; + } + cls = MSSTYLES_FindClass(tfActiveTheme, pszAppName, szClassName);
/* Fall back to default class if the specified subclass is not found */ if (!cls) cls = MSSTYLES_FindClass(tfActiveTheme, NULL, szClassName); @@ -1088,9 +1091,12 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList, U if(!cls && *start) { parse_app_class_name(start, szAppName, szClassName); if (szAppName[0]) - cls = MSSTYLES_FindClass(tfActiveTheme, szAppName, szClassName); - else - cls = MSSTYLES_FindClass(tfActiveTheme, pszAppName, szClassName); + { + /* If the application class is already set then fail */ + if (pszAppName) return NULL; + pszAppName = szAppName; + } + cls = MSSTYLES_FindClass(tfActiveTheme, pszAppName, szClassName);
/* Fall back to default class if the specified subclass is not found */ if (!cls) cls = MSSTYLES_FindClass(tfActiveTheme, NULL, szClassName); diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c index 6c7e87c1040..c79a6c85a35 100644 --- a/dlls/uxtheme/tests/system.c +++ b/dlls/uxtheme/tests/system.c @@ -562,9 +562,7 @@ static void test_OpenThemeData(void) ok(hRes == S_OK, "Got unexpected hr %#lx.\n", hRes); SetLastError(0xdeadbeef); hTheme = OpenThemeData(hWnd, L"explorer::treeview"); - todo_wine ok(!hTheme, "OpenThemeData() should fail\n"); - todo_wine ok(GetLastError() == E_PROP_ID_UNSUPPORTED, "Got unexpected %#lx.\n", GetLastError()); SetWindowTheme(hWnd, NULL, NULL);