Module: wine Branch: refs/heads/master Commit: 397bf3c2b133fe36529efcc4c1906bac1aac2da8 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=397bf3c2b133fe36529efcc4...
Author: Alexandre Julliard julliard@winehq.org Date: Tue May 9 20:33:11 2006 +0200
user: Added specific winproc functions for calling dialog procedures.
---
dlls/user/defdlg.c | 42 ++++++++------------------ dlls/user/winproc.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++ dlls/user/winproc.h | 4 +++ 3 files changed, 97 insertions(+), 30 deletions(-)
diff --git a/dlls/user/defdlg.c b/dlls/user/defdlg.c index 5cf01e9..abd19b1 100644 --- a/dlls/user/defdlg.c +++ b/dlls/user/defdlg.c @@ -35,9 +35,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(dialog); /*********************************************************************** * DEFDLG_GetDlgProc */ -static WNDPROC DEFDLG_GetDlgProc( HWND hwnd ) +static DLGPROC DEFDLG_GetDlgProc( HWND hwnd ) { - WNDPROC ret; + DLGPROC ret; WND *wndPtr = WIN_GetPtr( hwnd );
if (!wndPtr) return 0; @@ -46,7 +46,7 @@ static WNDPROC DEFDLG_GetDlgProc( HWND h ERR( "cannot get dlg proc %p from other process\n", hwnd ); return 0; } - ret = *(WNDPROC *)((char *)wndPtr->wExtra + DWLP_DLGPROC); + ret = *(DLGPROC *)((char *)wndPtr->wExtra + DWLP_DLGPROC); WIN_ReleasePtr( wndPtr ); return ret; } @@ -381,7 +381,7 @@ LRESULT WINAPI DefDlgProc16( HWND16 hwnd LPARAM lParam ) { DIALOGINFO *dlgInfo; - WNDPROC16 dlgproc; + DLGPROC16 dlgproc; HWND hwnd32 = WIN_Handle32( hwnd ); BOOL result = FALSE;
@@ -390,14 +390,8 @@ LRESULT WINAPI DefDlgProc16( HWND16 hwnd
SetWindowLongPtrW( hwnd32, DWLP_MSGRESULT, 0 );
- if ((dlgproc = (WNDPROC16)DEFDLG_GetDlgProc( hwnd32 ))) - { - /* Call dialog procedure */ - result = CallWindowProc16( dlgproc, hwnd, msg, wParam, lParam ); - /* 16 bit dlg procs only return BOOL16 */ - if( WINPROC_GetProcType( (WNDPROC)dlgproc ) == WIN_PROC_16 ) - result = LOWORD(result); - } + if ((dlgproc = (DLGPROC16)DEFDLG_GetDlgProc( hwnd32 ))) /* Call dialog procedure */ + result = WINPROC_CallDlgProc16( dlgproc, hwnd, msg, wParam, lParam );
if (!result && IsWindow(hwnd32)) { @@ -439,7 +433,7 @@ LRESULT WINAPI DefDlgProc16( HWND16 hwnd LRESULT WINAPI DefDlgProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { DIALOGINFO *dlgInfo; - WNDPROC dlgproc; + DLGPROC dlgproc; BOOL result = FALSE;
/* Perform DIALOGINFO initialization if not done */ @@ -447,14 +441,8 @@ LRESULT WINAPI DefDlgProcA( HWND hwnd, U
SetWindowLongPtrW( hwnd, DWLP_MSGRESULT, 0 );
- if ((dlgproc = DEFDLG_GetDlgProc( hwnd ))) - { - /* Call dialog procedure */ - result = CallWindowProcA( dlgproc, hwnd, msg, wParam, lParam ); - /* 16 bit dlg procs only return BOOL16 */ - if( WINPROC_GetProcType( dlgproc ) == WIN_PROC_16 ) - result = LOWORD(result); - } + if ((dlgproc = DEFDLG_GetDlgProc( hwnd ))) /* Call dialog procedure */ + result = WINPROC_CallDlgProcA( dlgproc, hwnd, msg, wParam, lParam );
if (!result && IsWindow(hwnd)) { @@ -497,21 +485,15 @@ LRESULT WINAPI DefDlgProcW( HWND hwnd, U { DIALOGINFO *dlgInfo; BOOL result = FALSE; - WNDPROC dlgproc; + DLGPROC dlgproc;
/* Perform DIALOGINFO intialization if not done */ if(!(dlgInfo = DIALOG_get_info( hwnd, TRUE ))) return -1;
SetWindowLongPtrW( hwnd, DWLP_MSGRESULT, 0 );
- if ((dlgproc = DEFDLG_GetDlgProc( hwnd ))) - { - /* Call dialog procedure */ - result = CallWindowProcW( dlgproc, hwnd, msg, wParam, lParam ); - /* 16 bit dlg procs only return BOOL16 */ - if( WINPROC_GetProcType( dlgproc ) == WIN_PROC_16 ) - result = LOWORD(result); - } + if ((dlgproc = DEFDLG_GetDlgProc( hwnd ))) /* Call dialog procedure */ + result = WINPROC_CallDlgProcW( dlgproc, hwnd, msg, wParam, lParam );
if (!result && IsWindow(hwnd)) { diff --git a/dlls/user/winproc.c b/dlls/user/winproc.c index 31a5632..975fe1b 100644 --- a/dlls/user/winproc.c +++ b/dlls/user/winproc.c @@ -3272,3 +3272,84 @@ LRESULT WINAPI CallWindowProcW( WNDPROC return 0; } } + + +/********************************************************************** + * WINPROC_CallDlgProc16 + */ +INT_PTR WINPROC_CallDlgProc16( DLGPROC16 func, HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam ) +{ + WINDOWPROC *proc; + + if (!func) return 0; + + if (!(proc = handle16_to_proc( (WNDPROC16)func ))) + return LOWORD( WINPROC_CallWndProc16( (WNDPROC16)func, hwnd, msg, wParam, lParam ) ); + + switch(proc->type) + { + case WIN_PROC_16: + return LOWORD( WINPROC_CallWndProc16( proc->proc16, hwnd, msg, wParam, lParam ) ); + case WIN_PROC_32A: + return __wine_call_wndproc_32A( hwnd, msg, wParam, lParam, proc->thunk.proc ); + case WIN_PROC_32W: + return __wine_call_wndproc_32W( hwnd, msg, wParam, lParam, proc->thunk.proc ); + default: + WARN_(relay)("Invalid proc %p\n", proc ); + return 0; + } +} + + +/********************************************************************** + * WINPROC_CallDlgProcA + */ +INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) +{ + WINDOWPROC *proc; + + if (!func) return 0; + + if (!(proc = handle_to_proc( (WNDPROC)func ))) + return WINPROC_CallWndProc( (WNDPROC)func, hwnd, msg, wParam, lParam ); + + switch(proc->type) + { + case WIN_PROC_16: + return LOWORD( WINPROC_CallProc32ATo16( proc->proc16, hwnd, msg, wParam, lParam ) ); + case WIN_PROC_32A: + return WINPROC_CallWndProc( proc->thunk.proc, hwnd, msg, wParam, lParam ); + case WIN_PROC_32W: + return WINPROC_CallProc32ATo32W( proc->thunk.proc, hwnd, msg, wParam, lParam ); + default: + WARN_(relay)("Invalid proc %p\n", proc ); + return 0; + } +} + + +/********************************************************************** + * WINPROC_CallDlgProcW + */ +INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) +{ + WINDOWPROC *proc; + + if (!func) return 0; + + if (!(proc = handle_to_proc( (WNDPROC)func ))) + return WINPROC_CallWndProc( (WNDPROC)func, hwnd, msg, wParam, lParam ); + + switch(proc->type) + { + case WIN_PROC_16: + return LOWORD( WINPROC_CallProc32WTo16( proc->proc16, hwnd, msg, wParam, lParam )); + case WIN_PROC_32A: + return WINPROC_CallProc32WTo32A( proc->thunk.proc, hwnd, msg, wParam, lParam ); + case WIN_PROC_32W: + return WINPROC_CallWndProc( proc->thunk.proc, hwnd, msg, wParam, lParam ); + default: + WARN_(relay)("Invalid proc %p\n", proc ); + return 0; + } +} diff --git a/dlls/user/winproc.h b/dlls/user/winproc.h index d03b4b8..a912bbf 100644 --- a/dlls/user/winproc.h +++ b/dlls/user/winproc.h @@ -85,6 +85,10 @@ extern void WINPROC_UnmapMsg32ATo16( HWN extern void WINPROC_UnmapMsg32WTo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, MSGPARAM16* pm16 );
+extern INT_PTR WINPROC_CallDlgProc16( DLGPROC16 func, HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam ); +extern INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); +extern INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); + /* map a Unicode string to a 16-bit pointer */ inline static SEGPTR map_str_32W_to_16( LPCWSTR str ) {