user: Added specific winproc functions for calling dialog procedures.

This commit is contained in:
Alexandre Julliard 2006-05-09 20:33:11 +02:00
parent c1f3adc4a4
commit 397bf3c2b1
3 changed files with 97 additions and 30 deletions

View File

@ -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 hwnd )
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, UINT16 msg, WPARAM16 wParam,
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, UINT16 msg, WPARAM16 wParam,
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, UINT16 msg, WPARAM16 wParam,
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, UINT msg, WPARAM wParam, LPARAM lParam )
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, UINT msg, WPARAM wParam, LPARAM lParam )
{
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))
{

View File

@ -3272,3 +3272,84 @@ LRESULT WINAPI CallWindowProcW( WNDPROC func, HWND hwnd, UINT msg,
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;
}
}

View File

@ -85,6 +85,10 @@ extern void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam,
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 )
{