Jacek Caban : user32: Pass window name as UNICODE_STRING to NtUserCreateWindowEx.

Alexandre Julliard julliard at winehq.org
Mon Aug 15 15:23:44 CDT 2022


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Aug 14 23:24:04 2022 +0200

user32: Pass window name as UNICODE_STRING to NtUserCreateWindowEx.

---

 dlls/user32/win.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index e246d112383..77bd2bfa3fe 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -300,9 +300,9 @@ static BOOL is_default_coord( int x )
  */
 HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, BOOL unicode )
 {
+    UNICODE_STRING class, window_name;
     HWND hwnd, top_child = 0;
     MDICREATESTRUCTW mdi_cs;
-    UNICODE_STRING class;
     CBT_CREATEWNDW cbtc;
     WNDCLASSEXW info;
     HMENU menu;
@@ -399,15 +399,21 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
         }
     }
 
+    if (unicode || !cs->lpszName)
+        RtlInitUnicodeString( &window_name, cs->lpszName );
+    else if (!RtlCreateUnicodeStringFromAsciiz( &window_name, (const char *)cs->lpszName ))
+        return 0;
+
     menu = cs->hMenu;
     if (!menu && info.lpszMenuName && (cs->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
         menu = LoadMenuW( cs->hInstance, info.lpszMenuName );
 
     cbtc.lpcs = cs;
-    hwnd = NtUserCreateWindowEx( cs->dwExStyle, &class, NULL, NULL, cs->style, cs->x, cs->y,
-                                 cs->cx, cs->cy, cs->hwndParent, menu, module,
+    hwnd = NtUserCreateWindowEx( cs->dwExStyle, &class, NULL, &window_name, cs->style,
+                                 cs->x, cs->y, cs->cx, cs->cy, cs->hwndParent, menu, module,
                                  cs->lpCreateParams, 0, &cbtc, 0, !unicode );
     if (!hwnd && menu && menu != cs->hMenu) NtUserDestroyMenu( menu );
+    if (!unicode) RtlFreeUnicodeString( &window_name );
     return hwnd;
 }
 




More information about the wine-cvs mailing list