- 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
This commit is contained in:
James Tabor 2009-08-24 06:10:52 +00:00
parent ddd06401af
commit e83ca9a324

View file

@ -142,6 +142,8 @@ const struct builtin_class_descr DIALOG_builtin_class =
* *
* Get the DIALOGINFO structure of a window, allocating it if needed * Get the DIALOGINFO structure of a window, allocating it if needed
* and 'create' is TRUE. * and 'create' is TRUE.
*
* ReactOS
*/ */
DIALOGINFO * DIALOG_get_info( HWND hWnd, BOOL create ) DIALOGINFO * DIALOG_get_info( HWND hWnd, BOOL create )
{ {
@ -151,6 +153,11 @@ DIALOGINFO * DIALOG_get_info( HWND hWnd, BOOL create )
if(!dlgInfo && create) if(!dlgInfo && create)
{ {
pWindow = ValidateHwnd( hWnd ); pWindow = ValidateHwnd( hWnd );
if (!pWindow)
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return NULL;
}
if (pWindow && pWindow->cbwndExtra >= DLGWINDOWEXTRA && hWnd != GetDesktopWindow()) 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 (!GetMessageW( &msg, 0, 0, 0 )) break;
} }
if (!IsWindow( hwnd )) return -1; if (!IsWindow( hwnd )) return 0;
if (!(dlgInfo->flags & DF_END) && !IsDialogMessageW( hwnd, &msg)) if (!(dlgInfo->flags & DF_END) && !IsDialogMessageW( hwnd, &msg))
{ {
TranslateMessage( &msg ); TranslateMessage( &msg );
@ -1585,7 +1592,7 @@ DefDlgProcA(
BOOL result = FALSE; BOOL result = FALSE;
/* Perform DIALOGINFO initialization if not done */ /* 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 ); SetWindowLongPtrW( hDlg, DWLP_MSGRESULT, 0 );
@ -1645,7 +1652,7 @@ DefDlgProcW(
BOOL result = FALSE; BOOL result = FALSE;
/* Perform DIALOGINFO initialization if not done */ /* 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 ); SetWindowLongPtrW( hDlg, DWLP_MSGRESULT, 0 );