win32u: Validate the info parameter in NtUserEnumDisplayDevices.

Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Torge Matthies 2021-12-10 02:07:00 +01:00 committed by Alexandre Julliard
parent 28b77c9b72
commit 286b99a4a2
2 changed files with 15 additions and 5 deletions

View File

@ -1571,6 +1571,8 @@ NTSTATUS WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index,
TRACE( "%s %u %p %#x\n", debugstr_us( device ), index, info, flags );
if (!info || !info->cb) return STATUS_UNSUCCESSFUL;
if (!lock_display_devices()) return STATUS_UNSUCCESSFUL;
if (!device || !device->Length)

View File

@ -45,15 +45,23 @@ static void test_NtUserEnumDisplayDevices(void)
SetLastError( 0xdeadbeef );
ret = NtUserEnumDisplayDevices( NULL, 0, &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() );
SetLastError( 0xdeadbeef );
ret = NtUserEnumDisplayDevices( NULL, 12345, &info, 0 );
ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef,
"NtUserEnumDisplayDevices returned %x %u\n", ret,
GetLastError() );
"NtUserEnumDisplayDevices returned %x %u\n", ret, GetLastError() );
SetLastError( 0xdeadbeef );
ret = NtUserEnumDisplayDevices( NULL, 0, NULL, 0 );
ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef,
"NtUserEnumDisplayDevices returned %x %u\n", ret, GetLastError() );
SetLastError( 0xdeadbeef );
ret = NtUserEnumDisplayDevices( NULL, 12345, NULL, 0 );
ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef,
"NtUserEnumDisplayDevices returned %x %u\n", ret, GetLastError() );
}
static void test_NtUserCloseWindowStation(void)