mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
Patch by Heis Spiter <heis_spiter@hotmail.com>:
- Fix a handle leak See issue #2772 for more details. svn path=/trunk/; revision=29968
This commit is contained in:
parent
3e0b11c4bf
commit
b9ef3cb742
2 changed files with 8 additions and 3 deletions
|
@ -137,7 +137,7 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
||||||
RECT rcText;
|
RECT rcText;
|
||||||
COLORREF crPrevForeground;
|
COLORREF crPrevForeground;
|
||||||
TCHAR Text[260];
|
TCHAR Text[260];
|
||||||
HFONT hFont, hOldFont;
|
HFONT hOldFont;
|
||||||
ULONG CpuUsage;
|
ULONG CpuUsage;
|
||||||
ULONG CpuKernelUsage;
|
ULONG CpuKernelUsage;
|
||||||
int nBars;
|
int nBars;
|
||||||
|
@ -174,8 +174,7 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
||||||
rcText = rcClient;
|
rcText = rcClient;
|
||||||
InflateRect(&rcText, -2, -2);
|
InflateRect(&rcText, -2, -2);
|
||||||
crPrevForeground = SetTextColor(hDC, RGB(0, 255, 0));
|
crPrevForeground = SetTextColor(hDC, RGB(0, 255, 0));
|
||||||
hFont = GetStockObject(DEFAULT_GUI_FONT);
|
hOldFont = SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT));
|
||||||
hOldFont = SelectObject(hDC, hFont);
|
|
||||||
DrawText(hDC, Text, -1, &rcText, DT_BOTTOM | DT_CENTER | DT_NOPREFIX | DT_SINGLELINE);
|
DrawText(hDC, Text, -1, &rcText, DT_BOTTOM | DT_CENTER | DT_NOPREFIX | DT_SINGLELINE);
|
||||||
SelectObject(hDC, hOldFont);
|
SelectObject(hDC, hOldFont);
|
||||||
SetTextColor(hDC, crPrevForeground);
|
SetTextColor(hDC, crPrevForeground);
|
||||||
|
@ -297,6 +296,8 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
||||||
rcBarRight.bottom -=3;
|
rcBarRight.bottom -=3;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SelectObject(hDC, hOldFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
|
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
|
||||||
|
@ -403,6 +404,9 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
|
||||||
rcBarRight.top += 3;
|
rcBarRight.top += 3;
|
||||||
rcBarRight.bottom += 3;
|
rcBarRight.bottom += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SelectObject(hDC, hOldFont);
|
||||||
|
DeleteObject(hFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd)
|
void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd)
|
||||||
|
|
|
@ -74,6 +74,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
/* Get the debug privilege for this process. */
|
/* Get the debug privilege for this process. */
|
||||||
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
|
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
|
||||||
|
CloseHandle(hToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load our settings from the registry */
|
/* Load our settings from the registry */
|
||||||
|
|
Loading…
Reference in a new issue