[COMCTL32][USER32] Button: Fix DLGC_... handling (#6168)

Based on KRosUser's button.patch.
- Fix DLGC_... handling by using & operator
  in BUTTON_CheckAutoRadioButton
  in button.c.
- Fix DLGC_... handling by using & operator
  in IsDialogMessageW in dialog.c.
- BM_CLICK's wParam must be zero.
CORE-17210
This commit is contained in:
Katayama Hirofumi MZ 2023-12-16 09:29:13 +09:00 committed by GitHub
parent 8ab2e5a28a
commit d55add359c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View file

@ -1667,7 +1667,7 @@ static void BUTTON_CheckAutoRadioButton( HWND hwnd )
{
if (!sibling) break;
#ifdef __REACTOS__
if (SendMessageW( sibling, WM_GETDLGCODE, 0, 0 ) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
if ((SendMessageW(sibling, WM_GETDLGCODE, 0, 0) & (DLGC_BUTTON | DLGC_RADIOBUTTON)) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
SendMessageW( sibling, BM_SETCHECK, sibling == hwnd ? BST_CHECKED : BST_UNCHECKED, 0 );
#else
if ((hwnd != sibling) &&

View file

@ -1196,7 +1196,11 @@ static void BUTTON_CheckAutoRadioButton( HWND hwnd )
do
{
if (!sibling) break;
#ifdef __REACTOS__
if ((SendMessageW(sibling, WM_GETDLGCODE, 0, 0) & (DLGC_BUTTON | DLGC_RADIOBUTTON)) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
#else
if (SendMessageW( sibling, WM_GETDLGCODE, 0, 0 ) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
#endif
SendMessageW( sibling, BM_SETCHECK, sibling == hwnd ? BST_CHECKED : BST_UNCHECKED, 0 );
sibling = GetNextDlgGroupItem( parent, sibling, FALSE );
} while (sibling != start);

View file

@ -2628,12 +2628,14 @@ IsDialogMessageW(
break;
}
if (hwndNext && SendMessageW( hwndNext, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg ) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
if (hwndNext &&
((SendMessageW(hwndNext, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg) &
(DLGC_BUTTON | DLGC_RADIOBUTTON)) == (DLGC_BUTTON | DLGC_RADIOBUTTON)))
{
SetFocus( hwndNext );
if ((GetWindowLongW( hwndNext, GWL_STYLE ) & BS_TYPEMASK) == BS_AUTORADIOBUTTON &&
SendMessageW( hwndNext, BM_GETCHECK, 0, 0 ) != BST_CHECKED)
SendMessageW( hwndNext, BM_CLICK, 1, 0 );
SendMessageW(hwndNext, BM_CLICK, 0, 0);
}
else
SendMessageW( hDlg, WM_NEXTDLGCTL, (WPARAM)hwndNext, 1 );