Jacek Caban : win32u: Allow NULL cbtc in NtUserCreateWindowEx.

Alexandre Julliard julliard at winehq.org
Fri May 6 15:38:40 CDT 2022


Module: wine
Branch: master
Commit: 21c8ff873b9657a1b8cb632ab4ec435d6ffdf065
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=21c8ff873b9657a1b8cb632ab4ec435d6ffdf065

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri May  6 03:04:20 2022 +0200

win32u: Allow NULL cbtc in NtUserCreateWindowEx.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/win32u/window.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index 9231f98539e..94cdd7f7280 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -4845,9 +4845,10 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name,
                                   HWND parent, HMENU menu, HINSTANCE instance, void *params,
                                   DWORD flags, CBT_CREATEWNDW *cbtc, DWORD unk, BOOL ansi )
 {
-    CREATESTRUCTW cs, *client_cs = cbtc->lpcs;
+    CREATESTRUCTW cs, *client_cs, cs_buf;
     UINT win_dpi, thread_dpi = get_thread_dpi();
     DPI_AWARENESS_CONTEXT context;
+    CBT_CREATEWNDW cbtc_buf;
     HWND hwnd, owner = 0;
     INT sw = SW_SHOW;
     RECT rect;
@@ -4855,8 +4856,24 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name,
 
     static const WCHAR messageW[] = {'M','e','s','s','a','g','e'};
 
+    /* FIXME: We should pass a packed struct to client instead of using client_cs */
+    if (cbtc)
+    {
+        client_cs = cbtc->lpcs;
+        cs.lpszName  = client_cs->lpszName;
+        cs.lpszClass = client_cs->lpszClass;
+        cs.hInstance = client_cs->hInstance; /* may be different than instance for win16 */
+    }
+    else
+    {
+        cbtc = &cbtc_buf;
+        client_cs = cbtc->lpcs = &cs_buf;
+        cs.lpszName = window_name ? window_name->Buffer : NULL;
+        cs.lpszClass = class_name->Buffer;
+        cs.hInstance = instance;
+    }
+
     cs.lpCreateParams = params;
-    cs.hInstance  = client_cs->hInstance; /* may be different than instance for win16 */
     cs.hMenu      = menu;
     cs.hwndParent = parent;
     cs.style      = style;
@@ -4865,10 +4882,6 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name,
     cs.y  = y;
     cs.cx = cx;
     cs.cy = cy;
-    /* We use client_cs to pass original class and name pointers,
-     * that's probably not how native handles it. */
-    cs.lpszName  = client_cs->lpszName;
-    cs.lpszClass = client_cs->lpszClass;
 
     /* Find the parent window */
     if (parent == HWND_MESSAGE)




More information about the wine-cvs mailing list