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