Jacek Caban : win32u: Use syscall interface for NtUserCreateWindowEx and NtUserDestroyWindow.

Alexandre Julliard julliard at winehq.org
Mon Jul 25 16:18:23 CDT 2022


Module: wine
Branch: master
Commit: d50112b4b6e82782d3924a8dbd443f82f64e510d
URL:    https://gitlab.winehq.org/wine/wine/-/commit/d50112b4b6e82782d3924a8dbd443f82f64e510d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jul 21 18:49:53 2022 +0200

win32u: Use syscall interface for NtUserCreateWindowEx and NtUserDestroyWindow.

---

 dlls/win32u/gdiobj.c         |  2 --
 dlls/win32u/syscall.c        |  2 ++
 dlls/win32u/win32u.spec      |  4 ++--
 dlls/win32u/win32u_private.h |  6 ------
 dlls/win32u/wrappers.c       | 18 ------------------
 dlls/wow64win/syscall.h      |  2 ++
 dlls/wow64win/user.c         | 39 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 45 insertions(+), 28 deletions(-)

diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c
index d4c9a1a3861..b3db2b11531 100644
--- a/dlls/win32u/gdiobj.c
+++ b/dlls/win32u/gdiobj.c
@@ -1136,10 +1136,8 @@ static struct unix_funcs unix_funcs =
     NtGdiUnrealizeObject,
     NtGdiUpdateColors,
     NtGdiWidenPath,
-    NtUserCreateWindowEx,
     NtUserDeferWindowPosAndBand,
     NtUserDestroyMenu,
-    NtUserDestroyWindow,
     NtUserDrawCaptionTemp,
     NtUserDrawMenuBarTemp,
     NtUserEnableMenuItem,
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index d04e4dc2cf3..02a845f1a48 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -127,11 +127,13 @@ static void * const syscalls[] =
     NtUserCreateCaret,
     NtUserCreateDesktopEx,
     NtUserCreateInputContext,
+    NtUserCreateWindowEx,
     NtUserCreateWindowStation,
     NtUserDeleteMenu,
     NtUserDestroyAcceleratorTable,
     NtUserDestroyCursor,
     NtUserDestroyInputContext,
+    NtUserDestroyWindow,
     NtUserDisableThreadIme,
     NtUserDispatchMessage,
     NtUserDragDetect,
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 555aaecdfb5..9d9bec9dfb8 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -814,7 +814,7 @@
 @ stdcall -syscall NtUserCreateInputContext(ptr)
 @ stub NtUserCreateLocalMemHandle
 @ stub NtUserCreatePalmRejectionDelayZone
-@ stdcall NtUserCreateWindowEx(long ptr ptr ptr long long long long long long long long ptr long long long long)
+@ stdcall -syscall NtUserCreateWindowEx(long ptr ptr ptr long long long long long long long long ptr long long long long)
 @ stub NtUserCreateWindowGroup
 @ stdcall -syscall NtUserCreateWindowStation(ptr long long long long long long)
 @ stub NtUserCtxDisplayIOCtl
@@ -834,7 +834,7 @@
 @ stdcall -syscall NtUserDestroyInputContext(long)
 @ stdcall NtUserDestroyMenu(long)
 @ stub NtUserDestroyPalmRejectionDelayZone
-@ stdcall NtUserDestroyWindow(long)
+@ stdcall -syscall NtUserDestroyWindow(long)
 @ stub NtUserDisableImmersiveOwner
 @ stub NtUserDisableProcessWindowFiltering
 @ stdcall -syscall NtUserDisableThreadIme(long)
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index c7aac2edd75..392c167bf95 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -186,16 +186,10 @@ struct unix_funcs
     BOOL     (WINAPI *pNtGdiUnrealizeObject)( HGDIOBJ obj );
     BOOL     (WINAPI *pNtGdiUpdateColors)( HDC hdc );
     BOOL     (WINAPI *pNtGdiWidenPath)( HDC hdc );
-    HWND     (WINAPI *pNtUserCreateWindowEx)( DWORD ex_style, UNICODE_STRING *class_name,
-                                              UNICODE_STRING *version, UNICODE_STRING *window_name,
-                                              DWORD style, INT x, INT y, INT width, INT height,
-                                              HWND parent, HMENU menu, HINSTANCE instance, void *params,
-                                              DWORD flags, CBT_CREATEWNDW *cbtc, DWORD unk, BOOL ansi );
     HDWP     (WINAPI *pNtUserDeferWindowPosAndBand)( HDWP hdwp, HWND hwnd, HWND after,
                                                      INT x, INT y, INT cx, INT cy,
                                                      UINT flags, UINT unk1, UINT unk2 );
     BOOL     (WINAPI *pNtUserDestroyMenu)( HMENU handle );
-    BOOL     (WINAPI *pNtUserDestroyWindow)( HWND hwnd );
     BOOL     (WINAPI *pNtUserDrawCaptionTemp)( HWND hwnd, HDC hdc, const RECT *rect, HFONT font,
                                                HICON icon, const WCHAR *str, UINT flags );
     DWORD    (WINAPI *pNtUserDrawMenuBarTemp)( HWND hwnd, HDC hdc, RECT *rect, HMENU handle, HFONT font );
diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c
index f4847d06480..a3e617fe75f 100644
--- a/dlls/win32u/wrappers.c
+++ b/dlls/win32u/wrappers.c
@@ -725,18 +725,6 @@ NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER
     return unix_funcs->pNtGdiDdDDISetVidPnSourceOwner( desc );
 }
 
-HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name,
-                                  UNICODE_STRING *version, UNICODE_STRING *window_name,
-                                  DWORD style, INT x, INT y, INT width, INT height,
-                                  HWND parent, HMENU menu, HINSTANCE instance, void *params,
-                                  DWORD flags, CBT_CREATEWNDW *cbtc, DWORD unk, BOOL ansi )
-{
-    if (!unix_funcs) return 0;
-    return unix_funcs->pNtUserCreateWindowEx( ex_style, class_name, version, window_name,
-                                              style, x, y, width, height, parent, menu,
-                                              instance, params, flags, cbtc, unk, ansi );
-}
-
 HDWP WINAPI NtUserDeferWindowPosAndBand( HDWP hdwp, HWND hwnd, HWND after,
                                          INT x, INT y, INT cx, INT cy,
                                          UINT flags, UINT unk1, UINT unk2 )
@@ -752,12 +740,6 @@ BOOL WINAPI NtUserDestroyMenu( HMENU handle )
     return unix_funcs->pNtUserDestroyMenu( handle );
 }
 
-BOOL WINAPI NtUserDestroyWindow( HWND hwnd )
-{
-    if (!unix_funcs) return FALSE;
-    return unix_funcs->pNtUserDestroyWindow( hwnd );
-}
-
 BOOL WINAPI NtUserDrawCaptionTemp( HWND hwnd, HDC hdc, const RECT *rect, HFONT font,
                                    HICON icon, const WCHAR *str, UINT flags )
 {
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index 95ceeb9e16d..7125838dd35 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -114,11 +114,13 @@
     SYSCALL_ENTRY( NtUserCreateCaret ) \
     SYSCALL_ENTRY( NtUserCreateDesktopEx ) \
     SYSCALL_ENTRY( NtUserCreateInputContext ) \
+    SYSCALL_ENTRY( NtUserCreateWindowEx ) \
     SYSCALL_ENTRY( NtUserCreateWindowStation ) \
     SYSCALL_ENTRY( NtUserDeleteMenu ) \
     SYSCALL_ENTRY( NtUserDestroyAcceleratorTable ) \
     SYSCALL_ENTRY( NtUserDestroyCursor ) \
     SYSCALL_ENTRY( NtUserDestroyInputContext ) \
+    SYSCALL_ENTRY( NtUserDestroyWindow ) \
     SYSCALL_ENTRY( NtUserDisableThreadIme ) \
     SYSCALL_ENTRY( NtUserDispatchMessage ) \
     SYSCALL_ENTRY( NtUserDragDetect ) \
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index a3e880c46ed..20648a6620f 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -411,6 +411,38 @@ NTSTATUS WINAPI wow64_NtUserCreateInputContext( UINT *args )
     return HandleToUlong( NtUserCreateInputContext( client_ptr ));
 }
 
+NTSTATUS WINAPI wow64_NtUserCreateWindowEx( UINT *args )
+{
+    DWORD ex_style = get_ulong( &args );
+    UNICODE_STRING32 *class_name32 = get_ptr( &args );
+    UNICODE_STRING32 *version32 = get_ptr( &args );
+    UNICODE_STRING32 *window_name32 = get_ptr( &args );
+    DWORD style = get_ulong( &args );
+    int x = get_ulong( &args );
+    int y = get_ulong( &args );
+    int width = get_ulong( &args );
+    int height = get_ulong( &args );
+    HWND parent = get_handle( &args );
+    HMENU menu = get_handle( &args );
+    HINSTANCE instance = get_handle( &args );
+    void *params = get_ptr( &args );
+    DWORD flags = get_ulong( &args );
+    void *cbtc = get_ptr( &args );
+    DWORD unk = get_ulong( &args );
+    BOOL ansi = get_ulong( &args );
+
+    UNICODE_STRING class_name, version, window_name;
+    HWND ret;
+
+    ret = NtUserCreateWindowEx( ex_style,
+                                unicode_str_32to64( &class_name, class_name32),
+                                unicode_str_32to64( &version, version32 ),
+                                unicode_str_32to64( &window_name, window_name32 ),
+                                style, x, y, width, height, parent, menu,
+                                instance, params, flags, cbtc, unk, ansi );
+    return HandleToUlong( ret );
+}
+
 NTSTATUS WINAPI wow64_NtUserCreateWindowStation( UINT *args )
 {
     OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
@@ -458,6 +490,13 @@ NTSTATUS WINAPI wow64_NtUserDestroyInputContext( UINT *args )
     return NtUserDestroyInputContext( handle );
 }
 
+NTSTATUS WINAPI wow64_NtUserDestroyWindow( UINT *args )
+{
+    HWND hwnd = get_handle( &args );
+
+    return NtUserDestroyWindow( hwnd );
+}
+
 NTSTATUS WINAPI wow64_NtUserDisableThreadIme( UINT *args )
 {
     DWORD thread_id = get_ulong( &args );




More information about the wine-cvs mailing list