From e83ca9a3240b44e4fb4bc14dfc1fa8d00440b92d Mon Sep 17 00:00:00 2001 From: James Tabor Date: Mon, 24 Aug 2009 06:10:52 +0000 Subject: [PATCH] - Patch by Dmitry Timoshkov : user32: Return 0 from DefDlgProc and dialog loop for invalid dialog handles. Need to update user32 wine tests. svn path=/trunk/; revision=42903 --- reactos/dll/win32/user32/windows/dialog.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/user32/windows/dialog.c b/reactos/dll/win32/user32/windows/dialog.c index 44e1d182ba1..3b4c0307a22 100644 --- a/reactos/dll/win32/user32/windows/dialog.c +++ b/reactos/dll/win32/user32/windows/dialog.c @@ -142,6 +142,8 @@ const struct builtin_class_descr DIALOG_builtin_class = * * Get the DIALOGINFO structure of a window, allocating it if needed * and 'create' is TRUE. +* +* ReactOS */ DIALOGINFO * DIALOG_get_info( HWND hWnd, BOOL create ) { @@ -151,6 +153,11 @@ DIALOGINFO * DIALOG_get_info( HWND hWnd, BOOL create ) if(!dlgInfo && create) { pWindow = ValidateHwnd( hWnd ); + if (!pWindow) + { + SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + return NULL; + } if (pWindow && pWindow->cbwndExtra >= DLGWINDOWEXTRA && hWnd != GetDesktopWindow()) { @@ -551,7 +558,7 @@ INT DIALOG_DoDialogBox( HWND hwnd, HWND owner ) if (!GetMessageW( &msg, 0, 0, 0 )) break; } - if (!IsWindow( hwnd )) return -1; + if (!IsWindow( hwnd )) return 0; if (!(dlgInfo->flags & DF_END) && !IsDialogMessageW( hwnd, &msg)) { TranslateMessage( &msg ); @@ -1585,7 +1592,7 @@ DefDlgProcA( BOOL result = FALSE; /* Perform DIALOGINFO initialization if not done */ - if(!(dlgInfo = DIALOG_get_info( hDlg, TRUE ))) return -1; + if(!(dlgInfo = DIALOG_get_info( hDlg, TRUE ))) return 0; SetWindowLongPtrW( hDlg, DWLP_MSGRESULT, 0 ); @@ -1645,7 +1652,7 @@ DefDlgProcW( BOOL result = FALSE; /* Perform DIALOGINFO initialization if not done */ - if(!(dlgInfo = DIALOG_get_info( hDlg, TRUE ))) return -1; + if(!(dlgInfo = DIALOG_get_info( hDlg, TRUE ))) return 0; SetWindowLongPtrW( hDlg, DWLP_MSGRESULT, 0 );