Kevin Groeneveld kgroeneveld at
Tue Sep 2 22:10:55 CDT 2003

There appears to be a small difference in the way the CheckRadioButton
function works in wine than Windows.  This function takes three
parameters: the id of the first radio button in a group, the id of the
last radio button in a group and the id of the one which should be
checked.  I have found a Windows program which passes a value of zero
for third parameter.  In all versions of Windows I tested, this results
in all the radio buttons in the group being unchecked.

The current implementation for CheckRadioButton in wine will adjust the
first two parameters to make sure the third falls within the range.  If
the third paramter is zero, this results in the first id being set to
zero.  When this happens all radio buttons in the dialog with an id less
than the upper id are cleared instead of only the ones in the specified

It is unclear from the msdn documentation what CheckRadioButton should
do if the third parameter is not in the range of the first two, but I
would suggest the wine implementation be changed to use all parameters
as is to be consistent with how Windows works.  Even without the checks,
no harm is done in the current implementation even if the parameters
passed do not make any sense.

   Kevin Groeneveld <kgroeneveld at>
   Modify CheckRadioButton function to be more consistent with Windows.

-------------- next part --------------
diff -ur wine-20030813/windows/dialog.c wine-20030813.patched/windows/dialog.c
--- wine-20030813/windows/dialog.c	2003-08-23 23:12:51.000000000 -0400
+++ wine-20030813.patched/windows/dialog.c	2003-08-23 23:42:06.000000000 -0400
@@ -1293,9 +1293,8 @@
     RADIOGROUP radioGroup;
-    /* perform bounds checking for a radio button group */
-    radioGroup.firstID = min(min(firstID, lastID), checkID);
-    radioGroup.lastID = max(max(firstID, lastID), checkID);
+    radioGroup.firstID = firstID;
+    radioGroup.lastID = lastID;
     radioGroup.checkID = checkID;
     return EnumChildWindows(hwndDlg, (WNDENUMPROC)CheckRB,

More information about the wine-patches mailing list