- 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.

svn path=/trunk/; revision=33947
This commit is contained in:
Aleksey Bragin 2008-06-12 09:50:12 +00:00
parent 57da8d9f18
commit cb467b55e9
3 changed files with 12 additions and 3 deletions

View file

@ -504,7 +504,7 @@ MonthCalPaint(IN PMONTHCALWND infoPtr,
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;

View file

@ -100,9 +100,11 @@ int STDCALL
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));
}

View file

@ -278,6 +278,13 @@ UserGetSystemMetrics(ULONG Index)
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