https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d55add359cc96b38ce4e9ebf4eee845dfd64ba69

commit d55add359cc96b38ce4e9ebf4eee845dfd64ba69
Author:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
AuthorDate: Sat Dec 16 09:29:13 2023 +0900
Commit:     GitHub <nore...@github.com>
CommitDate: Sat Dec 16 09:29:13 2023 +0900

    [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
---
 dll/win32/comctl32/button.c           | 2 +-
 win32ss/user/user32/controls/button.c | 4 ++++
 win32ss/user/user32/windows/dialog.c  | 6 ++++--
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dll/win32/comctl32/button.c b/dll/win32/comctl32/button.c
index 095515c2775..d187ca4f1f2 100644
--- a/dll/win32/comctl32/button.c
+++ b/dll/win32/comctl32/button.c
@@ -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) &&
diff --git a/win32ss/user/user32/controls/button.c 
b/win32ss/user/user32/controls/button.c
index 69377a96b2d..7f220ed450a 100644
--- a/win32ss/user/user32/controls/button.c
+++ b/win32ss/user/user32/controls/button.c
@@ -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);
diff --git a/win32ss/user/user32/windows/dialog.c 
b/win32ss/user/user32/windows/dialog.c
index 0fb12e55e28..784b43b9493 100644
--- a/win32ss/user/user32/windows/dialog.c
+++ b/win32ss/user/user32/windows/dialog.c
@@ -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 );

Reply via email to