win32u: Move NtUserCreateDesktopEx implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-10-14 15:21:15 +02:00 committed by Alexandre Julliard
parent fd840680ab
commit 50013758ff
7 changed files with 66 additions and 20 deletions

View File

@ -253,31 +253,20 @@ HDESK WINAPI CreateDesktopA( LPCSTR name, LPCSTR device, LPDEVMODEA devmode,
HDESK WINAPI CreateDesktopW( LPCWSTR name, LPCWSTR device, LPDEVMODEW devmode, HDESK WINAPI CreateDesktopW( LPCWSTR name, LPCWSTR device, LPDEVMODEW devmode,
DWORD flags, ACCESS_MASK access, LPSECURITY_ATTRIBUTES sa ) DWORD flags, ACCESS_MASK access, LPSECURITY_ATTRIBUTES sa )
{ {
HANDLE ret; OBJECT_ATTRIBUTES attr;
DWORD len = name ? lstrlenW(name) : 0; UNICODE_STRING str;
if (device || devmode) if (device || devmode)
{ {
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return 0; return 0;
} }
if (len >= MAX_PATH)
{ RtlInitUnicodeString( &str, name );
SetLastError( ERROR_FILENAME_EXCED_RANGE ); InitializeObjectAttributes( &attr, &str, OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
return 0; get_winstations_dir_handle(), NULL );
} if (sa && sa->bInheritHandle) attr.Attributes |= OBJ_INHERIT;
SERVER_START_REQ( create_desktop ) return NtUserCreateDesktopEx( &attr, NULL, devmode, flags, access, 0 );
{
req->flags = flags;
req->access = access;
req->attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF |
((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0);
wine_server_add_data( req, name, len * sizeof(WCHAR) );
wine_server_call_err( req );
ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
} }

View File

@ -96,6 +96,7 @@ static void * const syscalls[] =
NtGdiTransformPoints, NtGdiTransformPoints,
NtUserCloseDesktop, NtUserCloseDesktop,
NtUserCloseWindowStation, NtUserCloseWindowStation,
NtUserCreateDesktopEx,
NtUserCreateWindowStation, NtUserCreateWindowStation,
NtUserGetObjectInformation, NtUserGetObjectInformation,
NtUserGetProcessWindowStation, NtUserGetProcessWindowStation,

View File

@ -809,7 +809,7 @@
@ stub NtUserCreateActivationObject @ stub NtUserCreateActivationObject
@ stub NtUserCreateCaret @ stub NtUserCreateCaret
@ stub NtUserCreateDCompositionHwndTarget @ stub NtUserCreateDCompositionHwndTarget
@ stub NtUserCreateDesktopEx @ stdcall -syscall NtUserCreateDesktopEx(ptr ptr ptr long long long)
@ stub NtUserCreateEmptyCursorObject @ stub NtUserCreateEmptyCursorObject
@ stub NtUserCreateInputContext @ stub NtUserCreateInputContext
@ stub NtUserCreateLocalMemHandle @ stub NtUserCreateLocalMemHandle

View File

@ -127,6 +127,38 @@ BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle )
return ret; return ret;
} }
/***********************************************************************
* NtUserCreateDesktopEx (win32u.@)
*/
HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *device,
DEVMODEW *devmode, DWORD flags, ACCESS_MASK access,
ULONG heap_size )
{
HANDLE ret;
if ((device && device->Length) || devmode)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
if (attr->ObjectName->Length >= MAX_PATH * sizeof(WCHAR))
{
SetLastError( ERROR_FILENAME_EXCED_RANGE );
return 0;
}
SERVER_START_REQ( create_desktop )
{
req->flags = flags;
req->access = access;
req->attributes = attr->Attributes;
wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length );
wine_server_call_err( req );
ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
}
/*********************************************************************** /***********************************************************************
* NtUserCloseDesktop (win32u.@) * NtUserCloseDesktop (win32u.@)
*/ */

View File

@ -83,6 +83,7 @@
SYSCALL_ENTRY( NtGdiTransformPoints ) \ SYSCALL_ENTRY( NtGdiTransformPoints ) \
SYSCALL_ENTRY( NtUserCloseDesktop ) \ SYSCALL_ENTRY( NtUserCloseDesktop ) \
SYSCALL_ENTRY( NtUserCloseWindowStation ) \ SYSCALL_ENTRY( NtUserCloseWindowStation ) \
SYSCALL_ENTRY( NtUserCreateDesktopEx ) \
SYSCALL_ENTRY( NtUserCreateWindowStation ) \ SYSCALL_ENTRY( NtUserCreateWindowStation ) \
SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \ SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \
SYSCALL_ENTRY( NtUserGetThreadDesktop ) \ SYSCALL_ENTRY( NtUserGetThreadDesktop ) \

View File

@ -73,6 +73,25 @@ NTSTATUS WINAPI wow64_NtUserSetProcessWindowStation( UINT *args )
return NtUserSetProcessWindowStation( handle ); return NtUserSetProcessWindowStation( handle );
} }
NTSTATUS WINAPI wow64_NtUserCreateDesktopEx( UINT *args )
{
OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
UNICODE_STRING32 *device32 = get_ptr( &args );
DEVMODEW *devmode = get_ptr( &args );
DWORD flags = get_ulong( &args );
ACCESS_MASK access = get_ulong( &args );
ULONG heap_size = get_ulong( &args );
struct object_attr64 attr;
UNICODE_STRING device;
HANDLE ret;
ret = NtUserCreateDesktopEx( objattr_32to64( &attr, attr32 ),
unicode_str_32to64( &device, device32 ),
devmode, flags, access, heap_size );
return HandleToUlong( ret );
}
NTSTATUS WINAPI wow64_NtUserCloseDesktop( UINT *args ) NTSTATUS WINAPI wow64_NtUserCloseDesktop( UINT *args )
{ {
HDESK handle = get_handle( &args ); HDESK handle = get_handle( &args );

View File

@ -20,10 +20,14 @@
#define _NTUSER_ #define _NTUSER_
#include <winuser.h> #include <winuser.h>
#include <wingdi.h>
#include <winternl.h> #include <winternl.h>
BOOL WINAPI NtUserCloseDesktop( HDESK handle ); BOOL WINAPI NtUserCloseDesktop( HDESK handle );
BOOL WINAPI NtUserCloseWindowStation( HWINSTA handle ); BOOL WINAPI NtUserCloseWindowStation( HWINSTA handle );
HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *device,
DEVMODEW *devmode, DWORD flags, ACCESS_MASK access,
ULONG heap_size );
HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK mask, ULONG arg3, HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK mask, ULONG arg3,
ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 ); ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 );
BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info, BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info,