From 0d0f2067f89545539ab3ae0ccd802239a2dce98e Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sun, 14 Aug 2022 23:24:04 +0200 Subject: [PATCH] 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; }