mirror of
https://github.com/reactos/reactos.git
synced 2025-06-28 15:29:43 +00:00
[DESK]
- fix a bunch of buffer overruns, negative array index accesses and uninitialized variables CID #1102296 CID #501468 CID #716755 CID #716756 CID #1102323 svn path=/trunk/; revision=62684
This commit is contained in:
parent
c2276e1b0c
commit
5cd83d03a1
4 changed files with 74 additions and 60 deletions
|
@ -275,7 +275,7 @@ SaveCurrentValues(HWND hwndDlg, GLOBALS *g)
|
||||||
plfFont->lfHeight = -MulDiv(GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, &bTranslated, FALSE), GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
|
plfFont->lfHeight = -MulDiv(GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, &bTranslated, FALSE), GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
|
||||||
plfFont->lfWeight = (SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0) == 1) ? FW_BOLD : FW_NORMAL;
|
plfFont->lfWeight = (SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0) == 1) ? FW_BOLD : FW_NORMAL;
|
||||||
plfFont->lfItalic = (BYTE)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0);
|
plfFont->lfItalic = (BYTE)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0);
|
||||||
GetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, plfFont->lfFaceName, LF_FACESIZE * sizeof(TCHAR));
|
GetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, plfFont->lfFaceName, LF_FACESIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReleaseDC(hwndDlg, hdcDlg);
|
ReleaseDC(hwndDlg, hdcDlg);
|
||||||
|
|
|
@ -69,6 +69,8 @@ MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, COLOR_SCHEME *sch
|
||||||
int LTpenplus = 0;
|
int LTpenplus = 0;
|
||||||
int RTpenplus = 0;
|
int RTpenplus = 0;
|
||||||
int RBpenplus = 0;
|
int RBpenplus = 0;
|
||||||
|
HBRUSH hbr;
|
||||||
|
|
||||||
/* Init some vars */
|
/* Init some vars */
|
||||||
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
|
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
|
||||||
SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
|
SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
|
||||||
|
@ -88,76 +90,84 @@ MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, COLOR_SCHEME *sch
|
||||||
if((uFlags & BF_TOPLEFT) == BF_TOPLEFT)
|
if((uFlags & BF_TOPLEFT) == BF_TOPLEFT)
|
||||||
LTpenplus = 1;
|
LTpenplus = 1;
|
||||||
|
|
||||||
if(LTInnerI != -1)
|
if((uFlags & MY_BF_ACTIVEBORDER))
|
||||||
LTInnerPen = GetStockObject(DC_PEN);
|
hbr = CreateSolidBrush(scheme->crColor[COLOR_ACTIVEBORDER]);
|
||||||
if(LTOuterI != -1)
|
else
|
||||||
LTOuterPen = GetStockObject(DC_PEN);
|
hbr = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]);
|
||||||
if(RBInnerI != -1)
|
|
||||||
RBInnerPen = GetStockObject(DC_PEN);
|
FillRect(hdc, &InnerRect, hbr);
|
||||||
if(RBOuterI != -1)
|
DeleteObject(hbr);
|
||||||
RBOuterPen = GetStockObject(DC_PEN);
|
|
||||||
{
|
|
||||||
HBRUSH hbr;
|
|
||||||
|
|
||||||
if((uFlags & MY_BF_ACTIVEBORDER))
|
|
||||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_ACTIVEBORDER]);
|
|
||||||
else
|
|
||||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]);
|
|
||||||
FillRect(hdc, &InnerRect, hbr);
|
|
||||||
DeleteObject(hbr);
|
|
||||||
}
|
|
||||||
MoveToEx(hdc, 0, 0, &SavePoint);
|
MoveToEx(hdc, 0, 0, &SavePoint);
|
||||||
|
|
||||||
/* Draw the outer edge */
|
/* Draw the outer edge */
|
||||||
SelectObject(hdc, LTOuterPen);
|
if(LTOuterI != -1)
|
||||||
SetDCPenColor(hdc, scheme->crColor[LTOuterI]);
|
|
||||||
if(uFlags & BF_TOP)
|
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
|
LTOuterPen = GetStockObject(DC_PEN);
|
||||||
LineTo(hdc, InnerRect.right, InnerRect.top);
|
SelectObject(hdc, LTOuterPen);
|
||||||
|
SetDCPenColor(hdc, scheme->crColor[LTOuterI]);
|
||||||
|
if(uFlags & BF_TOP)
|
||||||
|
{
|
||||||
|
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
|
||||||
|
LineTo(hdc, InnerRect.right, InnerRect.top);
|
||||||
|
}
|
||||||
|
if(uFlags & BF_LEFT)
|
||||||
|
{
|
||||||
|
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
|
||||||
|
LineTo(hdc, InnerRect.left, InnerRect.bottom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(uFlags & BF_LEFT)
|
|
||||||
|
if(RBOuterI != -1)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
|
RBOuterPen = GetStockObject(DC_PEN);
|
||||||
LineTo(hdc, InnerRect.left, InnerRect.bottom);
|
SelectObject(hdc, RBOuterPen);
|
||||||
}
|
SetDCPenColor(hdc, scheme->crColor[RBOuterI]);
|
||||||
SelectObject(hdc, RBOuterPen);
|
if(uFlags & BF_BOTTOM)
|
||||||
SetDCPenColor(hdc, scheme->crColor[RBOuterI]);
|
{
|
||||||
if(uFlags & BF_BOTTOM)
|
MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
|
||||||
{
|
LineTo(hdc, InnerRect.right, InnerRect.bottom-1);
|
||||||
MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
|
}
|
||||||
LineTo(hdc, InnerRect.right, InnerRect.bottom-1);
|
if(uFlags & BF_RIGHT)
|
||||||
}
|
{
|
||||||
if(uFlags & BF_RIGHT)
|
MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL);
|
||||||
{
|
LineTo(hdc, InnerRect.right-1, InnerRect.bottom);
|
||||||
MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL);
|
}
|
||||||
LineTo(hdc, InnerRect.right-1, InnerRect.bottom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the inner edge */
|
/* Draw the inner edge */
|
||||||
SelectObject(hdc, LTInnerPen);
|
if(LTInnerI != -1)
|
||||||
SetDCPenColor(hdc, scheme->crColor[LTInnerI]);
|
|
||||||
if(uFlags & BF_TOP)
|
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
|
LTInnerPen = GetStockObject(DC_PEN);
|
||||||
LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
|
SelectObject(hdc, LTInnerPen);
|
||||||
|
SetDCPenColor(hdc, scheme->crColor[LTInnerI]);
|
||||||
|
if(uFlags & BF_TOP)
|
||||||
|
{
|
||||||
|
MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
|
||||||
|
LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
|
||||||
|
}
|
||||||
|
if(uFlags & BF_LEFT)
|
||||||
|
{
|
||||||
|
MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
|
||||||
|
LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(uFlags & BF_LEFT)
|
|
||||||
|
if(RBInnerI != -1)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
|
RBInnerPen = GetStockObject(DC_PEN);
|
||||||
LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
|
SelectObject(hdc, RBInnerPen);
|
||||||
}
|
SetDCPenColor(hdc, scheme->crColor[RBInnerI]);
|
||||||
SelectObject(hdc, RBInnerPen);
|
if(uFlags & BF_BOTTOM)
|
||||||
SetDCPenColor(hdc, scheme->crColor[RBInnerI]);
|
{
|
||||||
if(uFlags & BF_BOTTOM)
|
MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
|
||||||
{
|
LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2);
|
||||||
MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
|
}
|
||||||
LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2);
|
if(uFlags & BF_RIGHT)
|
||||||
}
|
{
|
||||||
if(uFlags & BF_RIGHT)
|
MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL);
|
||||||
{
|
LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus);
|
||||||
MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL);
|
}
|
||||||
LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uFlags & BF_ADJUST)
|
if (uFlags & BF_ADJUST)
|
||||||
|
@ -245,6 +255,8 @@ MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
|
||||||
case DFCS_CAPTIONRESTORE:
|
case DFCS_CAPTIONRESTORE:
|
||||||
Symbol = '2';
|
Symbol = '2';
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT, scheme);
|
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT, scheme);
|
||||||
ZeroMemory(&lf, sizeof(LOGFONT));
|
ZeroMemory(&lf, sizeof(LOGFONT));
|
||||||
|
@ -313,6 +325,9 @@ MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
|
||||||
case DFCS_SCROLLRIGHT:
|
case DFCS_SCROLLRIGHT:
|
||||||
Symbol = '4';
|
Symbol = '4';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT, scheme);
|
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT, scheme);
|
||||||
ZeroMemory(&lf, sizeof(LOGFONT));
|
ZeroMemory(&lf, sizeof(LOGFONT));
|
||||||
|
|
|
@ -33,7 +33,7 @@ InitFontSizeList(HWND hWnd)
|
||||||
TCHAR Buffer[LINE_LEN];
|
TCHAR Buffer[LINE_LEN];
|
||||||
TCHAR Desc[LINE_LEN];
|
TCHAR Desc[LINE_LEN];
|
||||||
|
|
||||||
if (SetupGetStringField(&Context, 0, Buffer, sizeof(Buffer), NULL) &&
|
if (SetupGetStringField(&Context, 0, Buffer, sizeof(Buffer) / sizeof(TCHAR), NULL) &&
|
||||||
SetupGetIntField(&Context, 1, &ci))
|
SetupGetIntField(&Context, 1, &ci))
|
||||||
{
|
{
|
||||||
_stprintf(Desc, _T("%s (%d DPI)"), Buffer, ci);
|
_stprintf(Desc, _T("%s (%d DPI)"), Buffer, ci);
|
||||||
|
|
|
@ -340,7 +340,6 @@ SearchScreenSavers(HWND hwndScreenSavers,
|
||||||
|
|
||||||
ScreenSaverCount = pData->ScreenSaverCount;
|
ScreenSaverCount = pData->ScreenSaverCount;
|
||||||
|
|
||||||
|
|
||||||
hr = StringCbCopy(szSearchPath, sizeof(szSearchPath), pszSearchPath);
|
hr = StringCbCopy(szSearchPath, sizeof(szSearchPath), pszSearchPath);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue