server: Don't allow an empty desktop name.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2020-06-24 11:37:22 +01:00 committed by Alexandre Julliard
parent 42e50e44f4
commit aec5ccfc06
2 changed files with 5 additions and 2 deletions

View File

@ -296,9 +296,7 @@ static void test_handles(void)
SetLastError( 0xdeadbeef );
d2 = CreateDesktopA( "", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
todo_wine
ok( !d2, "create empty desktop succeeded\n" );
todo_wine
ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
SetLastError( 0xdeadbeef );

View File

@ -513,6 +513,11 @@ DECL_HANDLER(create_desktop)
struct unicode_str name = get_req_unicode_str();
reply->handle = 0;
if (!name.len)
{
set_error( STATUS_INVALID_HANDLE );
return;
}
if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP )))
{
if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation )))