comctl32: Fix possible use of uninitialised variable in REBAR_Paint.

In the case where an hdc is passed in via the wParam, ps.fErase could be 
uninitialised. Fix this by rearranging the code so that ps is only used 
when an hdc isn't passed in.
This commit is contained in:
Rob Shearman 2008-02-25 08:59:51 +00:00 committed by Alexandre Julliard
parent 4e0100ff06
commit f3c40f925d

View File

@ -3197,24 +3197,23 @@ REBAR_NotifyFormat (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
static LRESULT
REBAR_Paint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rc;
HDC hdc = (HDC)wParam;
GetClientRect(infoPtr->hwndSelf, &rc);
hdc = wParam==0 ? BeginPaint (infoPtr->hwndSelf, &ps) : (HDC)wParam;
TRACE("painting (%s) client (%s)\n",
wine_dbgstr_rect(&ps.rcPaint), wine_dbgstr_rect(&rc));
if (ps.fErase) {
/* Erase area of paint if requested */
REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint);
if (hdc) {
TRACE("painting\n");
REBAR_Refresh (infoPtr, hdc);
} else {
PAINTSTRUCT ps;
hdc = BeginPaint (infoPtr->hwndSelf, &ps);
TRACE("painting (%s)\n", wine_dbgstr_rect(&ps.rcPaint));
if (ps.fErase) {
/* Erase area of paint if requested */
REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint);
}
REBAR_Refresh (infoPtr, hdc);
EndPaint (infoPtr->hwndSelf, &ps);
}
REBAR_Refresh (infoPtr, hdc);
if (!wParam)
EndPaint (infoPtr->hwndSelf, &ps);
return 0;
}