Commit 286b99a4 authored by Torge Matthies's avatar Torge Matthies Committed by Alexandre Julliard

win32u: Validate the info parameter in NtUserEnumDisplayDevices.

parent 28b77c9b
...@@ -1571,6 +1571,8 @@ NTSTATUS WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index, ...@@ -1571,6 +1571,8 @@ NTSTATUS WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index,
TRACE( "%s %u %p %#x\n", debugstr_us( device ), index, info, flags ); 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 (!lock_display_devices()) return STATUS_UNSUCCESSFUL;
if (!device || !device->Length) if (!device || !device->Length)
......
...@@ -45,15 +45,23 @@ static void test_NtUserEnumDisplayDevices(void) ...@@ -45,15 +45,23 @@ static void test_NtUserEnumDisplayDevices(void)
SetLastError( 0xdeadbeef ); SetLastError( 0xdeadbeef );
ret = NtUserEnumDisplayDevices( NULL, 0, &info, 0 ); ret = NtUserEnumDisplayDevices( NULL, 0, &info, 0 );
todo_wine ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef, ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef,
"NtUserEnumDisplayDevices returned %x %u\n", ret, "NtUserEnumDisplayDevices returned %x %u\n", ret, GetLastError() );
GetLastError() );
SetLastError( 0xdeadbeef ); SetLastError( 0xdeadbeef );
ret = NtUserEnumDisplayDevices( NULL, 12345, &info, 0 ); ret = NtUserEnumDisplayDevices( NULL, 12345, &info, 0 );
ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef, ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef,
"NtUserEnumDisplayDevices returned %x %u\n", ret, "NtUserEnumDisplayDevices returned %x %u\n", ret, GetLastError() );
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) static void test_NtUserCloseWindowStation(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment