From: Rémi Bernon rbernon@codeweavers.com
--- dlls/user32/tests/msg.c | 6 ++++ dlls/user32/tests/user32_test.h | 57 +++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 dlls/user32/tests/user32_test.h
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 6faaa2c2f40..e8a05cf87d7 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -36,6 +36,8 @@
#include "wine/test.h"
+#include "user32_test.h" + #define MDI_FIRST_CHILD_ID 2004
/* undocumented SWP flags - from SDK 3.1 */ @@ -12806,9 +12808,11 @@ static DWORD WINAPI test_edit_ime_messages(void *unused_arg)
himc = ImmGetContext(hwnd); ret = ImmSetCompositionStringA(himc, SCS_SETSTR, "Wine", 4, NULL, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmSetCompositionStringA failed.\n"); flush_sequence(); ret = ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmNotifyIME failed.\n"); /* Note that the following message loop is necessary to get the WM_CHAR messages because they * are posted. Same for the later message loops in this function. */ @@ -12828,9 +12832,11 @@ static DWORD WINAPI test_edit_ime_messages(void *unused_arg) ok(lr == EIMES_GETCOMPSTRATONCE, "Got unexpected lr %#Ix.\n", lr);
ret = ImmSetCompositionStringA(himc, SCS_SETSTR, "Wine", 4, NULL, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmSetCompositionStringA failed.\n"); flush_sequence(); ret = ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmNotifyIME failed.\n"); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok_sequence(edit_eimes_getcompstratonce_seq, diff --git a/dlls/user32/tests/user32_test.h b/dlls/user32/tests/user32_test.h new file mode 100644 index 00000000000..30ef19cdcc1 --- /dev/null +++ b/dlls/user32/tests/user32_test.h @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> +#include <stddef.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" + +#include "wine/test.h" + +static inline BOOL is_driver( const WCHAR *match ) +{ + static WCHAR *cache; + + WCHAR *tmp = NULL, driver[MAX_PATH] = {0}, path[sizeof("System\CurrentControlSet\Control\Video\{}\0000") + 40]; + DWORD size = sizeof(driver); + UINT guid_atom; + HKEY key; + + if (cache) return !wcscmp( cache, match ); + + guid_atom = HandleToULong( GetPropW( GetDesktopWindow(), L"__wine_display_device_guid" ) ); + wcscpy( path, L"System\CurrentControlSet\Control\Video\{" ); + if (GlobalGetAtomNameW( guid_atom, path + wcslen( path ), 40 )) + { + wcscat( path, L"}\0000" ); + if (!RegOpenKeyW( HKEY_LOCAL_MACHINE, path, &key )) + { + if (!RegQueryValueExW( key, L"GraphicsDriver", NULL, NULL, (BYTE *)&driver, &size )) + tmp = wcsdup( driver ); + RegCloseKey(key); + } + } + + if (!tmp) tmp = wcsdup( L"" ); + if ((tmp = InterlockedExchangePointer( (void *)&cache, tmp ))) free( tmp ); + + return !wcscmp( cache, match ); +}