From e365a23341e0c77e8a032dee49fa504fe4a46df8 Mon Sep 17 00:00:00 2001 From: NF Stevens Date: Sun, 3 Jan 1999 16:13:08 +0000 Subject: [PATCH] Fix the return type of DLGPROC type and mask out the unset highword of the return when a 16 bit dialog proc is called. --- include/wintypes.h | 4 ++-- windows/defdlg.c | 39 ++++++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/include/wintypes.h b/include/wintypes.h index 6af790925d4..538f4cb6e3c 100644 --- a/include/wintypes.h +++ b/include/wintypes.h @@ -210,8 +210,8 @@ DECLARE_HANDLE(HRASCONN); typedef BOOL32 (CALLBACK* DATEFMT_ENUMPROC32A)(LPSTR); typedef BOOL32 (CALLBACK* DATEFMT_ENUMPROC32W)(LPWSTR); DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC) -typedef LRESULT (CALLBACK *DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM); -typedef LRESULT (CALLBACK *DLGPROC32)(HWND32,UINT32,WPARAM32,LPARAM); +typedef BOOL16 (CALLBACK *DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM); +typedef BOOL32 (CALLBACK *DLGPROC32)(HWND32,UINT32,WPARAM32,LPARAM); DECL_WINELIB_TYPE(DLGPROC) typedef LRESULT (CALLBACK *DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM); typedef LRESULT (CALLBACK *DRIVERPROC32)(DWORD,HDRVR32,UINT32,LPARAM,LPARAM); diff --git a/windows/defdlg.c b/windows/defdlg.c index dc273aa698f..7e1fdf576d4 100644 --- a/windows/defdlg.c +++ b/windows/defdlg.c @@ -263,12 +263,15 @@ LRESULT WINAPI DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, if (dlgInfo->dlgProc) { /* Call dialog procedure */ result = CallWindowProc16( (WNDPROC16)dlgInfo->dlgProc, hwnd, msg, wParam, lParam ); + /* 16 bit dlg procs only return BOOL16 */ + if( WINPROC_GetProcType( dlgInfo->dlgProc ) == WIN_PROC_16 ) + result = LOWORD(result); - /* Check if window was destroyed by dialog procedure */ - if (dlgInfo->flags & DF_END && !(dlgInfo->flags & DF_ENDING)) { - dlgInfo->flags |= DF_ENDING; - DestroyWindow32( hwnd ); - } + /* Check if window was destroyed by dialog procedure */ + if (dlgInfo->flags & DF_END && !(dlgInfo->flags & DF_ENDING)) { + dlgInfo->flags |= DF_ENDING; + DestroyWindow32( hwnd ); + } } if (!result && IsWindow32(hwnd)) @@ -323,12 +326,15 @@ LRESULT WINAPI DefDlgProc32A( HWND32 hwnd, UINT32 msg, if (dlgInfo->dlgProc) { /* Call dialog procedure */ result = CallWindowProc32A( (WNDPROC32)dlgInfo->dlgProc, hwnd, msg, wParam, lParam ); + /* 16 bit dlg procs only return BOOL16 */ + if( WINPROC_GetProcType( dlgInfo->dlgProc ) == WIN_PROC_16 ) + result = LOWORD(result); - /* Check if window was destroyed by dialog procedure */ - if (dlgInfo->flags & DF_END && !(dlgInfo->flags & DF_ENDING)) { - dlgInfo->flags |= DF_ENDING; - DestroyWindow32( hwnd ); - } + /* Check if window was destroyed by dialog procedure */ + if (dlgInfo->flags & DF_END && !(dlgInfo->flags & DF_ENDING)) { + dlgInfo->flags |= DF_ENDING; + DestroyWindow32( hwnd ); + } } if (!result && IsWindow32(hwnd)) @@ -383,12 +389,15 @@ LRESULT WINAPI DefDlgProc32W( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, if (dlgInfo->dlgProc) { /* Call dialog procedure */ result = CallWindowProc32W( (WNDPROC32)dlgInfo->dlgProc, hwnd, msg, wParam, lParam ); + /* 16 bit dlg procs only return BOOL16 */ + if( WINPROC_GetProcType( dlgInfo->dlgProc ) == WIN_PROC_16 ) + result = LOWORD(result); - /* Check if window was destroyed by dialog procedure */ - if (dlgInfo->flags & DF_END && !(dlgInfo->flags & DF_ENDING)) { - dlgInfo->flags |= DF_ENDING; - DestroyWindow32( hwnd ); - } + /* Check if window was destroyed by dialog procedure */ + if (dlgInfo->flags & DF_END && !(dlgInfo->flags & DF_ENDING)) { + dlgInfo->flags |= DF_ENDING; + DestroyWindow32( hwnd ); + } } if (!result && IsWindow32(hwnd))