Signed-off-by: Torge Matthies openglfreak@googlemail.com --- dlls/win32u/tests/win32u.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index a7c2e5ef029..7d1b7f3caa8 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -16,12 +16,33 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#include "ntstatus.h" +#define WIN32_NO_STATUS + #include "wine/test.h"
#include "winbase.h" #include "ntuser.h"
+static void test_NtUserEnumDisplayDevices(void) +{ + NTSTATUS ret; + DISPLAY_DEVICEW info; + + SetLastError( 0xdeadbeef ); + ret = NtUserEnumDisplayDevices( NULL, 0, &info, 0 ); + todo_wine ok( !ret && GetLastError() == 0xdeadbeef, + "NtUserEnumDisplayDevices returned %x %u\n", ret, + GetLastError() ); + + SetLastError( 0xdeadbeef ); + ret = NtUserEnumDisplayDevices( NULL, 12345, &info, 0 ); + todo_wine ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef, + "NtUserEnumDisplayDevices returned %x %u\n", ret, + GetLastError() ); +} + static void test_NtUserCloseWindowStation(void) { BOOL ret; @@ -67,6 +88,7 @@ START_TEST(win32u) /* native win32u.dll fails if user32 is not loaded, so make sure it's fully initialized */ GetDesktopWindow();
+ test_NtUserEnumDisplayDevices(); /* Must run before test_NtUserCloseWindowStation. */ test_NtUserCloseWindowStation(); test_window_props(); }
Signed-off-by: Torge Matthies openglfreak@googlemail.com --- Found while investigating high CPU usage in Overwatch.
dlls/user32/sysparams.c | 2 +- dlls/win32u/sysparams.c | 8 ++++---- dlls/win32u/tests/win32u.c | 10 ++++------ dlls/win32u/win32u_private.h | 2 +- dlls/win32u/wrappers.c | 4 ++-- include/ntuser.h | 4 ++-- 6 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index a21b5035048..9d553d7dfff 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -1216,7 +1216,7 @@ BOOL WINAPI EnumDisplayDevicesW( LPCWSTR device, DWORD index, DISPLAY_DEVICEW *i { UNICODE_STRING str; RtlInitUnicodeString( &str, device ); - return NtUserEnumDisplayDevices( &str, index, info, flags ); + return NT_SUCCESS(NtUserEnumDisplayDevices( &str, index, info, flags )); }
/********************************************************************** diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 94c7a58fc0e..b3d2b6c7d11 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1562,8 +1562,8 @@ static struct adapter *find_adapter( UNICODE_STRING *name ) /*********************************************************************** * NtUserEnumDisplayDevices (win32u.@) */ -BOOL WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index, - DISPLAY_DEVICEW *info, DWORD flags ) +NTSTATUS WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index, + DISPLAY_DEVICEW *info, DWORD flags ) { struct display_device *found = NULL; struct adapter *adapter; @@ -1571,7 +1571,7 @@ BOOL WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index,
TRACE( "%s %u %p %#x\n", debugstr_us( device ), index, info, flags );
- if (!lock_display_devices()) return FALSE; + if (!lock_display_devices()) return STATUS_UNSUCCESSFUL;
if (!device || !device->Length) { @@ -1613,7 +1613,7 @@ BOOL WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index, lstrcpyW( info->DeviceKey, found->device_key ); } unlock_display_devices(); - return !!found; + return found ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL; }
#define _X_FIELD(prefix, bits) \ diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index 7d1b7f3caa8..85f337eada8 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -32,15 +32,13 @@ static void test_NtUserEnumDisplayDevices(void)
SetLastError( 0xdeadbeef ); ret = NtUserEnumDisplayDevices( NULL, 0, &info, 0 ); - todo_wine ok( !ret && GetLastError() == 0xdeadbeef, - "NtUserEnumDisplayDevices returned %x %u\n", ret, - GetLastError() ); + ok( !ret && GetLastError() == 0xdeadbeef, + "NtUserEnumDisplayDevices returned %x %u\n", ret, GetLastError() );
SetLastError( 0xdeadbeef ); ret = NtUserEnumDisplayDevices( NULL, 12345, &info, 0 ); - todo_wine ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef, - "NtUserEnumDisplayDevices returned %x %u\n", ret, - GetLastError() ); + ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef, + "NtUserEnumDisplayDevices returned %x %u\n", ret, GetLastError() ); }
static void test_NtUserCloseWindowStation(void) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index d3abda5b47e..9bce2b7207b 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -197,7 +197,7 @@ struct unix_funcs LONG (WINAPI *pNtUserChangeDisplaySettings)( UNICODE_STRING *devname, DEVMODEW *devmode, HWND hwnd, DWORD flags, void *lparam ); INT (WINAPI *pNtUserCountClipboardFormats)(void); - BOOL (WINAPI *pNtUserEnumDisplayDevices)( UNICODE_STRING *device, DWORD index, + NTSTATUS (WINAPI *pNtUserEnumDisplayDevices)( UNICODE_STRING *device, DWORD index, DISPLAY_DEVICEW *info, DWORD flags ); BOOL (WINAPI *pNtUserEnumDisplayMonitors)( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp ); BOOL (WINAPI *pNtUserEnumDisplaySettings)( UNICODE_STRING *device, DWORD mode, diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 863c95caf1e..fe56f5e0e3c 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -726,8 +726,8 @@ INT WINAPI NtUserCountClipboardFormats(void) return unix_funcs->pNtUserCountClipboardFormats(); }
-BOOL WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index, - DISPLAY_DEVICEW *info, DWORD flags ) +NTSTATUS WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index, + DISPLAY_DEVICEW *info, DWORD flags ) { if (!unix_funcs) return FALSE; return unix_funcs->pNtUserEnumDisplayDevices( device, index, info, flags ); diff --git a/include/ntuser.h b/include/ntuser.h index 9583b78acf2..d03a36a5126 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -114,8 +114,8 @@ HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *d ULONG heap_size ); HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK mask, ULONG arg3, ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 ); -BOOL WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index, - DISPLAY_DEVICEW *info, DWORD flags ); +NTSTATUS WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index, + DISPLAY_DEVICEW *info, DWORD flags ); BOOL WINAPI NtUserEnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp ); BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD mode, DEVMODEW *dev_mode, DWORD flags );
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=103774
Your paranoid android.
=== w1064 (64 bit report) ===
win32u: win32u.c:35: Test failed: NtUserEnumDisplayDevices returned c0000001 3735928559
=== w1064_2qxl (64 bit report) ===
win32u: win32u.c:35: Test failed: NtUserEnumDisplayDevices returned c0000001 3735928559
=== w1064_tsign (64 bit report) ===
win32u: win32u.c:35: Test failed: NtUserEnumDisplayDevices returned c0000001 3735928559
=== w10pro64 (64 bit report) ===
win32u: win32u.c:35: Test failed: NtUserEnumDisplayDevices returned c0000001 3735928559
=== w10pro64_ar (64 bit report) ===
win32u: win32u.c:35: Test failed: NtUserEnumDisplayDevices returned c0000001 3735928559
=== w10pro64_he (64 bit report) ===
win32u: win32u.c:35: Test failed: NtUserEnumDisplayDevices returned c0000001 3735928559
=== w10pro64_ja (64 bit report) ===
win32u: win32u.c:35: Test failed: NtUserEnumDisplayDevices returned c0000001 3735928559
=== w10pro64_zh_CN (64 bit report) ===
win32u: win32u.c:35: Test failed: NtUserEnumDisplayDevices returned c0000001 3735928559