Commit c07dcf59 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserOpenDesktop implementation from user32.

parent 50013758
......@@ -290,24 +290,13 @@ HDESK WINAPI OpenDesktopA( LPCSTR name, DWORD flags, BOOL inherit, ACCESS_MASK a
HDESK open_winstation_desktop( HWINSTA hwinsta, LPCWSTR name, DWORD flags, BOOL inherit, ACCESS_MASK access )
{
HANDLE ret = 0;
DWORD len = name ? lstrlenW(name) : 0;
if (len >= MAX_PATH)
{
SetLastError( ERROR_FILENAME_EXCED_RANGE );
return 0;
}
SERVER_START_REQ( open_desktop )
{
req->winsta = wine_server_obj_handle( hwinsta );
req->flags = flags;
req->access = access;
req->attributes = OBJ_CASE_INSENSITIVE | (inherit ? OBJ_INHERIT : 0);
wine_server_add_data( req, name, len * sizeof(WCHAR) );
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
OBJECT_ATTRIBUTES attr;
UNICODE_STRING str;
RtlInitUnicodeString( &str, name );
InitializeObjectAttributes( &attr, &str, OBJ_CASE_INSENSITIVE, hwinsta, NULL );
if (inherit) attr.Attributes |= OBJ_INHERIT;
return NtUserOpenDesktop( &attr, flags, access );
}
......
......@@ -101,6 +101,7 @@ static void * const syscalls[] =
NtUserGetObjectInformation,
NtUserGetProcessWindowStation,
NtUserGetThreadDesktop,
NtUserOpenDesktop,
NtUserOpenInputDesktop,
NtUserOpenWindowStation,
NtUserSetObjectInformation,
......
......@@ -1091,7 +1091,7 @@
@ stub NtUserNotifyProcessCreate
@ stub NtUserNotifyWinEvent
@ stub NtUserOpenClipboard
@ stub NtUserOpenDesktop
@ stdcall -syscall NtUserOpenDesktop(ptr long long)
@ stdcall -syscall NtUserOpenInputDesktop(long long long)
@ stub NtUserOpenThreadDesktop
@ stdcall -syscall NtUserOpenWindowStation(ptr long)
......
......@@ -160,6 +160,30 @@ HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *dev
}
/***********************************************************************
* NtUserOpenDesktop (win32u.@)
*/
HDESK WINAPI NtUserOpenDesktop( OBJECT_ATTRIBUTES *attr, DWORD flags, ACCESS_MASK access )
{
HANDLE ret = 0;
if (attr->ObjectName->Length >= MAX_PATH * sizeof(WCHAR))
{
SetLastError( ERROR_FILENAME_EXCED_RANGE );
return 0;
}
SERVER_START_REQ( open_desktop )
{
req->winsta = wine_server_obj_handle( attr->RootDirectory );
req->flags = flags;
req->access = access;
req->attributes = attr->Attributes;
wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length );
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
}
/***********************************************************************
* NtUserCloseDesktop (win32u.@)
*/
BOOL WINAPI NtUserCloseDesktop( HDESK handle )
......
......@@ -87,6 +87,7 @@
SYSCALL_ENTRY( NtUserCreateWindowStation ) \
SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \
SYSCALL_ENTRY( NtUserGetThreadDesktop ) \
SYSCALL_ENTRY( NtUserOpenDesktop ) \
SYSCALL_ENTRY( NtUserOpenInputDesktop ) \
SYSCALL_ENTRY( NtUserOpenWindowStation ) \
SYSCALL_ENTRY( NtUserSetObjectInformation ) \
......
......@@ -92,6 +92,19 @@ NTSTATUS WINAPI wow64_NtUserCreateDesktopEx( UINT *args )
return HandleToUlong( ret );
}
NTSTATUS WINAPI wow64_NtUserOpenDesktop( UINT *args )
{
OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
DWORD flags = get_ulong( &args );
ACCESS_MASK access = get_ulong( &args );
struct object_attr64 attr;
HANDLE ret;
ret = NtUserOpenDesktop( objattr_32to64( &attr, attr32 ), flags, access );
return HandleToUlong( ret );
}
NTSTATUS WINAPI wow64_NtUserCloseDesktop( UINT *args )
{
HDESK handle = get_handle( &args );
......
......@@ -36,6 +36,7 @@ HWINSTA WINAPI NtUserGetProcessWindowStation(void);
HDESK WINAPI NtUserGetThreadDesktop( DWORD thread );
HWINSTA WINAPI NtUserOpenWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK access );
BOOL WINAPI NtUserSetObjectInformation( HANDLE handle, INT index, void *info, DWORD len );
HDESK WINAPI NtUserOpenDesktop( OBJECT_ATTRIBUTES *attr, DWORD flags, ACCESS_MASK access );
HDESK WINAPI NtUserOpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access );
BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle );
BOOL WINAPI NtUserSetThreadDesktop( HDESK handle );
......
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