Jacek Caban : win32u: Move NtUserOpenWindowStation implementation from user32.
Alexandre Julliard
julliard at winehq.org
Thu Oct 14 15:09:34 CDT 2021
Module: wine
Branch: master
Commit: fd840680abada377cf0f2c054a33d4d3c2ff5436
URL: https://source.winehq.org/git/wine.git/?a=commit;h=fd840680abada377cf0f2c054a33d4d3c2ff5436
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Oct 14 15:20:56 2021 +0200
win32u: Move NtUserOpenWindowStation implementation from user32.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/winstation.c | 33 +++++++++++----------------------
dlls/win32u/syscall.c | 1 +
dlls/win32u/win32u.spec | 2 +-
dlls/win32u/winstation.c | 19 +++++++++++++++++++
dlls/wow64win/syscall.h | 1 +
dlls/wow64win/user.c | 10 ++++++++++
include/ntuser.h | 1 +
7 files changed, 44 insertions(+), 23 deletions(-)
diff --git a/dlls/user32/winstation.c b/dlls/user32/winstation.c
index c619d3d4658..ab1beed3c32 100644
--- a/dlls/user32/winstation.c
+++ b/dlls/user32/winstation.c
@@ -163,28 +163,17 @@ HWINSTA WINAPI OpenWindowStationA( LPCSTR name, BOOL inherit, ACCESS_MASK access
*/
HWINSTA WINAPI OpenWindowStationW( LPCWSTR name, 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;
- }
- if (!len)
- {
- name = get_winstation_default_name();
- len = lstrlenW( name );
- }
- SERVER_START_REQ( open_winstation )
- {
- req->access = access;
- req->attributes = OBJ_CASE_INSENSITIVE | (inherit ? OBJ_INHERIT : 0);
- req->rootdir = wine_server_obj_handle( get_winstations_dir_handle() );
- 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 );
+ if (!str.Length) RtlInitUnicodeString( &str, get_winstation_default_name() );
+
+ InitializeObjectAttributes( &attr, &str, OBJ_CASE_INSENSITIVE,
+ get_winstations_dir_handle(), NULL );
+ if (inherit) attr.Attributes |= OBJ_INHERIT;
+
+ return NtUserOpenWindowStation( &attr, access );
}
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index fb1bcfef093..e8c904f9f02 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -101,6 +101,7 @@ static void * const syscalls[] =
NtUserGetProcessWindowStation,
NtUserGetThreadDesktop,
NtUserOpenInputDesktop,
+ NtUserOpenWindowStation,
NtUserSetObjectInformation,
NtUserSetProcessWindowStation,
NtUserSetThreadDesktop,
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 013e8b89694..860b3626931 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -1094,7 +1094,7 @@
@ stub NtUserOpenDesktop
@ stdcall -syscall NtUserOpenInputDesktop(long long long)
@ stub NtUserOpenThreadDesktop
-@ stub NtUserOpenWindowStation
+@ stdcall -syscall NtUserOpenWindowStation(ptr long)
@ stub NtUserPaintDesktop
@ stub NtUserPaintMenuBar
@ stub NtUserPaintMonitor
diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c
index a0afe3a9606..bd8420df05f 100644
--- a/dlls/win32u/winstation.c
+++ b/dlls/win32u/winstation.c
@@ -61,6 +61,25 @@ HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK a
return ret;
}
+/******************************************************************************
+ * NtUserOpenWindowStation (win32u.@)
+ */
+HWINSTA WINAPI NtUserOpenWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK access )
+{
+ HANDLE ret = 0;
+
+ SERVER_START_REQ( open_winstation )
+ {
+ req->access = access;
+ req->attributes = attr->Attributes;
+ req->rootdir = wine_server_obj_handle( attr->RootDirectory );
+ 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;
+}
+
/***********************************************************************
* NtUserCloseWindowStation (win32u.@)
*/
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index 66b48f47154..371ce3665fd 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -87,6 +87,7 @@
SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \
SYSCALL_ENTRY( NtUserGetThreadDesktop ) \
SYSCALL_ENTRY( NtUserOpenInputDesktop ) \
+ SYSCALL_ENTRY( NtUserOpenWindowStation ) \
SYSCALL_ENTRY( NtUserSetObjectInformation ) \
SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \
SYSCALL_ENTRY( NtUserSetThreadDesktop )
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index bab04018163..80e85f8a631 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -44,6 +44,16 @@ NTSTATUS WINAPI wow64_NtUserCreateWindowStation( UINT *args )
arg3, arg4, arg5, arg6, arg7 ));
}
+NTSTATUS WINAPI wow64_NtUserOpenWindowStation( UINT *args )
+{
+ OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
+ ACCESS_MASK access = get_ulong( &args );
+
+ struct object_attr64 attr;
+
+ return HandleToUlong( NtUserOpenWindowStation( objattr_32to64( &attr, attr32 ), access ));
+}
+
NTSTATUS WINAPI wow64_NtUserCloseWindowStation( UINT *args )
{
HWINSTA handle = get_handle( &args );
diff --git a/include/ntuser.h b/include/ntuser.h
index c0976cac73d..648d4a3350d 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -30,6 +30,7 @@ BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info,
DWORD len, DWORD *needed );
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 NtUserOpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access );
BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle );
More information about the wine-cvs
mailing list