From 8494682f2d7bca32a89a82f266a5b97c979d92f3 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 17 Dec 2009 15:03:32 +0100 Subject: [PATCH] user32: Move 16-bit window creation functions to 16-bit files. --- dlls/user32/controls.h | 1 + dlls/user32/msg16.c | 67 +++++++++++++++++++++++++++++++++ dlls/user32/win.c | 84 +----------------------------------------- dlls/user32/win.h | 1 + dlls/user32/winproc.c | 1 + dlls/user32/wnd16.c | 13 +++++++ 6 files changed, 85 insertions(+), 82 deletions(-) diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index 9abc997f2e9..e7aa408769d 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -98,6 +98,7 @@ struct wow_handlers32 LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); + HWND (*create_window)(CREATESTRUCTW*,LPCWSTR,HINSTANCE,UINT); WNDPROC (*alloc_winproc)(WNDPROC,WNDPROC); }; diff --git a/dlls/user32/msg16.c b/dlls/user32/msg16.c index 27a47a4d035..0e57988d76c 100644 --- a/dlls/user32/msg16.c +++ b/dlls/user32/msg16.c @@ -2002,6 +2002,73 @@ BOOL16 WINAPI TranslateMDISysAccel16( HWND16 hwndClient, LPMSG16 msg ) } +/*********************************************************************** + * CreateWindowEx (USER.452) + */ +HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className, + LPCSTR windowName, DWORD style, INT16 x, + INT16 y, INT16 width, INT16 height, + HWND16 parent, HMENU16 menu, + HINSTANCE16 instance, LPVOID data ) +{ + CREATESTRUCTA cs; + char buffer[256]; + HWND hwnd; + + /* Fix the coordinates */ + + cs.x = (x == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)x; + cs.y = (y == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)y; + cs.cx = (width == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)width; + cs.cy = (height == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)height; + + /* Create the window */ + + cs.lpCreateParams = data; + cs.hInstance = HINSTANCE_32(instance); + cs.hMenu = HMENU_32(menu); + cs.hwndParent = WIN_Handle32( parent ); + cs.style = style; + cs.lpszName = windowName; + cs.lpszClass = className; + cs.dwExStyle = exStyle; + + /* map to module handle */ + if (instance) instance = GetExePtr( instance ); + + /* load the menu */ + if (!menu && (style & (WS_CHILD | WS_POPUP)) != WS_CHILD) + { + WNDCLASSA class; + + if (GetClassInfoA( HINSTANCE_32(instance), className, &class )) + cs.hMenu = HMENU_32( LoadMenu16( instance, class.lpszMenuName )); + } + + if (!IS_INTRESOURCE(className)) + { + WCHAR bufferW[256]; + + if (!MultiByteToWideChar( CP_ACP, 0, className, -1, bufferW, sizeof(bufferW)/sizeof(WCHAR) )) + return 0; + hwnd = wow_handlers32.create_window( (CREATESTRUCTW *)&cs, bufferW, + HINSTANCE_32(instance), 0 ); + } + else + { + if (!GlobalGetAtomNameA( LOWORD(className), buffer, sizeof(buffer) )) + { + ERR( "bad atom %x\n", LOWORD(className)); + return 0; + } + cs.lpszClass = buffer; + hwnd = wow_handlers32.create_window( (CREATESTRUCTW *)&cs, (LPCWSTR)className, + HINSTANCE_32(instance), 0 ); + } + return HWND_16( hwnd ); +} + + /*********************************************************************** * button_proc16 */ diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 9b2cc8999ad..8f43e92583a 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -27,9 +27,6 @@ #include #include "windef.h" #include "winbase.h" -#include "wine/winbase16.h" -#include "wine/winuser16.h" -#include "wownt32.h" #include "wine/server.h" #include "wine/unicode.h" #include "win.h" @@ -884,7 +881,7 @@ void WIN_DestroyThreadWindows( HWND hwnd ) */ static void WIN_FixCoordinates( CREATESTRUCTW *cs, INT *sw) { -#define IS_DEFAULT(x) ((x) == CW_USEDEFAULT || (x) == CW_USEDEFAULT16) +#define IS_DEFAULT(x) ((x) == CW_USEDEFAULT || (x) == (SHORT)0x8000) POINT pos[2]; if (cs->dwExStyle & WS_EX_MDICHILD) @@ -1072,7 +1069,7 @@ static void dump_window_styles( DWORD style, DWORD exstyle ) * * Implementation of CreateWindowEx(). */ -static HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, UINT flags ) +HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, UINT flags ) { INT cx, cy, style, sw = SW_SHOW; LRESULT result; @@ -1439,83 +1436,6 @@ failed: } -/*********************************************************************** - * CreateWindow (USER.41) - */ -HWND16 WINAPI CreateWindow16( LPCSTR className, LPCSTR windowName, - DWORD style, INT16 x, INT16 y, INT16 width, - INT16 height, HWND16 parent, HMENU16 menu, - HINSTANCE16 instance, LPVOID data ) -{ - return CreateWindowEx16( 0, className, windowName, style, - x, y, width, height, parent, menu, instance, data ); -} - - -/*********************************************************************** - * CreateWindowEx (USER.452) - */ -HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className, - LPCSTR windowName, DWORD style, INT16 x, - INT16 y, INT16 width, INT16 height, - HWND16 parent, HMENU16 menu, - HINSTANCE16 instance, LPVOID data ) -{ - CREATESTRUCTA cs; - char buffer[256]; - - /* Fix the coordinates */ - - cs.x = (x == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)x; - cs.y = (y == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)y; - cs.cx = (width == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)width; - cs.cy = (height == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)height; - - /* Create the window */ - - cs.lpCreateParams = data; - cs.hInstance = HINSTANCE_32(instance); - cs.hMenu = HMENU_32(menu); - cs.hwndParent = WIN_Handle32( parent ); - cs.style = style; - cs.lpszName = windowName; - cs.lpszClass = className; - cs.dwExStyle = exStyle; - - /* map to module handle */ - if (instance) instance = GetExePtr( instance ); - - /* load the menu */ - if (!menu && (style & (WS_CHILD | WS_POPUP)) != WS_CHILD) - { - WNDCLASSA class; - - if (GetClassInfoA( HINSTANCE_32(instance), className, &class )) - cs.hMenu = HMENU_32( LoadMenu16( instance, class.lpszMenuName )); - } - - if (!IS_INTRESOURCE(className)) - { - WCHAR bufferW[256]; - - if (!MultiByteToWideChar( CP_ACP, 0, className, -1, bufferW, sizeof(bufferW)/sizeof(WCHAR) )) - return 0; - return HWND_16( WIN_CreateWindowEx( (CREATESTRUCTW *)&cs, bufferW, HINSTANCE_32(instance), 0 )); - } - else - { - if (!GlobalGetAtomNameA( LOWORD(className), buffer, sizeof(buffer) )) - { - ERR( "bad atom %x\n", LOWORD(className)); - return 0; - } - cs.lpszClass = buffer; - return HWND_16( WIN_CreateWindowEx( (CREATESTRUCTW *)&cs, (LPCWSTR)className, - HINSTANCE_32(instance), 0 )); - } -} - - /*********************************************************************** * CreateWindowExA (USER32.@) */ diff --git a/dlls/user32/win.h b/dlls/user32/win.h index 743c67e1fa6..ab37e3e74ab 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -87,6 +87,7 @@ extern ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) DECLSPE extern BOOL WIN_GetRectangles( HWND hwnd, RECT *rectWindow, RECT *rectClient ) DECLSPEC_HIDDEN; extern LRESULT WIN_DestroyWindow( HWND hwnd ) DECLSPEC_HIDDEN; extern void WIN_DestroyThreadWindows( HWND hwnd ) DECLSPEC_HIDDEN; +extern HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, UINT flags ) DECLSPEC_HIDDEN; extern BOOL WIN_IsWindowDrawable( HWND hwnd, BOOL ) DECLSPEC_HIDDEN; extern HWND *WIN_ListChildren( HWND hwnd ) DECLSPEC_HIDDEN; extern LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOOL unicode ) DECLSPEC_HIDDEN; diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 5bfd407eff7..bd30b4963a0 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -1135,6 +1135,7 @@ void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wo orig->mdiclient_proc = MDIClientWndProc_common; orig->scrollbar_proc = ScrollBarWndProc_common; orig->static_proc = StaticWndProc_common; + orig->create_window = WIN_CreateWindowEx; orig->alloc_winproc = WINPROC_AllocProc; wow_handlers = *new; diff --git a/dlls/user32/wnd16.c b/dlls/user32/wnd16.c index f3f7e67fb9f..4c2f2f2125b 100644 --- a/dlls/user32/wnd16.c +++ b/dlls/user32/wnd16.c @@ -305,6 +305,19 @@ BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps ) } +/*********************************************************************** + * CreateWindow (USER.41) + */ +HWND16 WINAPI CreateWindow16( LPCSTR className, LPCSTR windowName, + DWORD style, INT16 x, INT16 y, INT16 width, + INT16 height, HWND16 parent, HMENU16 menu, + HINSTANCE16 instance, LPVOID data ) +{ + return CreateWindowEx16( 0, className, windowName, style, + x, y, width, height, parent, menu, instance, data ); +} + + /************************************************************************** * ShowWindow (USER.42) */