[ros-diffs] [fireball] 33947: - Fix a bug in timedate.cpl, where an incorrect color was passed. - Add bounds checking for GetSystemMetrics both in user32 and in kernel counterpart. - Based on a patch from bug 3316. See issue #3316 for more details.

fireball at svn.reactos.org fireball at svn.reactos.org
Thu Jun 12 11:50:13 CEST 2008


Author: fireball
Date: Thu Jun 12 04:50:12 2008
New Revision: 33947

URL: http://svn.reactos.org/svn/reactos?rev=33947&view=rev
Log:
- Fix a bug in timedate.cpl, where an incorrect color was passed.
- Add bounds checking for GetSystemMetrics both in user32 and in kernel counterpart.
- Based on a patch from bug 3316.
See issue #3316 for more details.

Modified:
    trunk/reactos/dll/cpl/timedate/monthcal.c
    trunk/reactos/dll/win32/user32/misc/desktop.c
    trunk/reactos/subsystems/win32/win32k/ntuser/metric.c

Modified: trunk/reactos/dll/cpl/timedate/monthcal.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/timedate/monthcal.c?rev=33947&r1=33946&r2=33947&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/timedate/monthcal.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/timedate/monthcal.c [iso-8859-1] Thu Jun 12 04:50:12 2008
@@ -504,7 +504,7 @@
             if (crOldCtrlText == CLR_INVALID)
             {
                 crOldCtrlText = SetTextColor(hDC,
-                                             infoPtr->Enabled ? MONTHCAL_CTRLFG : MONTHCAL_DISABLED_CTRLFG);
+                                             GetSysColor(infoPtr->Enabled ? MONTHCAL_CTRLFG : MONTHCAL_DISABLED_CTRLFG));
             }
 
             for (x = prcUpdate->left / infoPtr->CellSize.cx;

Modified: trunk/reactos/dll/win32/user32/misc/desktop.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/desktop.c?rev=33947&r1=33946&r2=33947&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/misc/desktop.c [iso-8859-1] Thu Jun 12 04:50:12 2008
@@ -100,9 +100,11 @@
 GetSystemMetrics(int nIndex)
 {
 //  FIXME("Global Sever Data -> %x\n",g_psi);
-  if (g_psi) return g_psi->SystemMetrics[nIndex];
+  if (nIndex < 0 || nIndex >= SM_CMETRICS) return 0;
+  if (g_psi)
+    return g_psi->SystemMetrics[nIndex];
   else
-  return(NtUserGetSystemMetrics(nIndex));
+    return(NtUserGetSystemMetrics(nIndex));
 }
 
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/metric.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/metric.c?rev=33947&r1=33946&r2=33947&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/metric.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/metric.c [iso-8859-1] Thu Jun 12 04:50:12 2008
@@ -278,6 +278,13 @@
    ULONG Width, Height, Result;
 
 //  DPRINT1("UserGetSystemMetrics -> %d\n",Index);
+
+  if (Index >= SM_CMETRICS)
+  {
+     DPRINT1("UserGetSystemMetrics() called with invalid index %d\n", Index);
+     return 0;
+  }
+
   if (gpsi && Setup)
      return gpsi->SystemMetrics[Index];
   else



More information about the Ros-diffs mailing list