Alexandre Julliard : user32: Implement UserRegisterWowHandlers function and add a handler for the button winproc .
Alexandre Julliard
julliard at winehq.org
Tue Dec 15 09:40:20 CST 2009
Module: wine
Branch: master
Commit: 02e74fa8a65177a9200e5f8acee6b0e5e214a675
URL: http://source.winehq.org/git/wine.git/?a=commit;h=02e74fa8a65177a9200e5f8acee6b0e5e214a675
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Dec 15 13:16:50 2009 +0100
user32: Implement UserRegisterWowHandlers function and add a handler for the button winproc.
---
dlls/user32/button.c | 28 +++-------------------------
dlls/user32/controls.h | 20 ++++++++++++++++++++
dlls/user32/msg16.c | 34 ++++++++++++++++++++++++++++++++++
dlls/user32/user16.c | 1 +
dlls/user32/user32.spec | 2 +-
dlls/user32/winproc.c | 18 ++++++++++++++++++
6 files changed, 77 insertions(+), 26 deletions(-)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index 9eb731c..42163eb 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -73,7 +73,6 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
-#include "wine/winuser16.h"
#include "controls.h"
#include "win.h"
#include "user_private.h"
@@ -230,8 +229,7 @@ static void setup_clipping( HWND hwnd, HDC hdc )
/***********************************************************************
* ButtonWndProc_common
*/
-static LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg,
- WPARAM wParam, LPARAM lParam, BOOL unicode )
+LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode )
{
RECT rect;
POINT pt;
@@ -548,32 +546,12 @@ static LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg,
}
/***********************************************************************
- * ButtonWndProc_wrapper16
- */
-static LRESULT ButtonWndProc_wrapper16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
-{
- static const UINT msg16_offset = BM_GETCHECK16 - BM_GETCHECK;
-
- switch (msg)
- {
- case BM_GETCHECK16:
- case BM_SETCHECK16:
- case BM_GETSTATE16:
- case BM_SETSTATE16:
- case BM_SETSTYLE16:
- return ButtonWndProc_common( hwnd, msg - msg16_offset, wParam, lParam, FALSE );
- default:
- return ButtonWndProc_common( hwnd, msg, wParam, lParam, unicode );
- }
-}
-
-/***********************************************************************
* ButtonWndProcW
*/
static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (!IsWindow( hWnd )) return 0;
- return ButtonWndProc_wrapper16( hWnd, uMsg, wParam, lParam, TRUE );
+ return wow_handlers.button_proc( hWnd, uMsg, wParam, lParam, TRUE );
}
@@ -583,7 +561,7 @@ static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (!IsWindow( hWnd )) return 0;
- return ButtonWndProc_wrapper16( hWnd, uMsg, wParam, lParam, FALSE );
+ return wow_handlers.button_proc( hWnd, uMsg, wParam, lParam, FALSE );
}
diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h
index f51a3d9..a407c93 100644
--- a/dlls/user32/controls.h
+++ b/dlls/user32/controls.h
@@ -57,6 +57,26 @@ extern const struct builtin_class_descr MESSAGE_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr SCROLL_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr STATIC_builtin_class DECLSPEC_HIDDEN;
+/* Wow handlers */
+
+struct wow_handlers16
+{
+ LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
+};
+
+struct wow_handlers32
+{
+ LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
+};
+
+extern struct wow_handlers16 wow_handlers DECLSPEC_HIDDEN;
+
+extern LRESULT ButtonWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
+
+extern void register_wow_handlers(void) DECLSPEC_HIDDEN;
+extern void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new,
+ struct wow_handlers32 *orig );
+
extern WNDPROC EDIT_winproc_handle DECLSPEC_HIDDEN;
/* Class functions */
diff --git a/dlls/user32/msg16.c b/dlls/user32/msg16.c
index d5d4825..b677e51 100644
--- a/dlls/user32/msg16.c
+++ b/dlls/user32/msg16.c
@@ -23,12 +23,15 @@
#include "winerror.h"
#include "win.h"
#include "user_private.h"
+#include "controls.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msg);
DWORD USER16_AlertableWait = 0;
+static struct wow_handlers32 wow_handlers32;
+
static LRESULT cwp_hook_callback( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
LRESULT *result, void *arg )
{
@@ -584,3 +587,34 @@ BOOL16 WINAPI TranslateMDISysAccel16( HWND16 hwndClient, LPMSG16 msg )
}
return 0;
}
+
+
+/***********************************************************************
+ * button_proc16
+ */
+static LRESULT button_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
+{
+ static const UINT msg16_offset = BM_GETCHECK16 - BM_GETCHECK;
+
+ switch (msg)
+ {
+ case BM_GETCHECK16:
+ case BM_SETCHECK16:
+ case BM_GETSTATE16:
+ case BM_SETSTATE16:
+ case BM_SETSTYLE16:
+ return wow_handlers32.button_proc( hwnd, msg - msg16_offset, wParam, lParam, FALSE );
+ default:
+ return wow_handlers32.button_proc( hwnd, msg, wParam, lParam, unicode );
+ }
+}
+
+void register_wow_handlers(void)
+{
+ static const struct wow_handlers16 handlers16 =
+ {
+ button_proc16,
+ };
+
+ UserRegisterWowHandlers( &handlers16, &wow_handlers32 );
+}
diff --git a/dlls/user32/user16.c b/dlls/user32/user16.c
index 77b3759..34133e5 100644
--- a/dlls/user32/user16.c
+++ b/dlls/user32/user16.c
@@ -1387,6 +1387,7 @@ BOOL WINAPI DllEntryPoint( DWORD reason, HINSTANCE16 inst, WORD ds,
if (USER_HeapSel) return TRUE; /* already called */
USER_HeapSel = ds;
+ register_wow_handlers();
return TRUE;
}
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 8cdc24c..4492e58 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -738,7 +738,7 @@
# @ stub UserLpkPSMTextOut
# @ stub UserLpkTabbedTextOut
@ stdcall UserRealizePalette(long)
-@ stub UserRegisterWowHandlers
+@ stdcall UserRegisterWowHandlers(ptr ptr)
# @ stub UserSetDeviceHoldState
@ stdcall UserSignalProc(long long long long)
# @ stub VRipOutput
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c
index d08a59f..040fd72 100644
--- a/dlls/user32/winproc.c
+++ b/dlls/user32/winproc.c
@@ -2378,3 +2378,21 @@ INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam,
}
return ret;
}
+
+
+/**********************************************************************
+ * UserRegisterWowHandlers (USER32.@)
+ *
+ * NOTE: no attempt has been made to be compatible here,
+ * the Windows function is most likely completely different.
+ */
+void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wow_handlers32 *orig )
+{
+ orig->button_proc = ButtonWndProc_common;
+ wow_handlers = *new;
+}
+
+struct wow_handlers16 wow_handlers =
+{
+ ButtonWndProc_common,
+};
More information about the wine-cvs
mailing list