Author: cwittich
Date: Mon Jan 8 05:40:38 2007
New Revision: 25363
URL:
http://svn.reactos.org/svn/reactos?rev=25363&view=rev
Log:
fixed most of the memory leaks
Modified:
trunk/reactos/base/applications/taskmgr/applpage.c
trunk/reactos/base/applications/taskmgr/column.c
trunk/reactos/base/applications/taskmgr/graph.c
trunk/reactos/base/applications/taskmgr/graph.h
trunk/reactos/base/applications/taskmgr/graphctl.c
trunk/reactos/base/applications/taskmgr/graphctl.h
trunk/reactos/base/applications/taskmgr/perfdata.c
trunk/reactos/base/applications/taskmgr/perfpage.c
trunk/reactos/base/applications/taskmgr/proclist.c
trunk/reactos/base/applications/taskmgr/procpage.c
trunk/reactos/base/applications/taskmgr/taskmgr.c
trunk/reactos/base/applications/taskmgr/taskmgr.h
trunk/reactos/base/applications/taskmgr/trayicon.c
Modified: trunk/reactos/base/applications/taskmgr/applpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/applpage.c (original)
+++ trunk/reactos/base/applications/taskmgr/applpage.c Mon Jan 8 05:40:38 2007
@@ -66,6 +66,7 @@
LV_COLUMN column;
TCHAR szTemp[256];
int cx, cy;
+ HANDLE hRefreshThread = NULL;
switch (message) {
case WM_INITDIALOG:
@@ -105,7 +106,7 @@
UpdateApplicationListControlViewSetting();
/* Start our refresh thread */
- CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, NULL);
+ hRefreshThread = CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0,
NULL);
return TRUE;
@@ -113,6 +114,7 @@
/* Close the event handle, this will make the */
/* refresh thread exit when the wait fails */
CloseHandle(hApplicationPageEvent);
+ CloseHandle(hRefreshThread);
break;
case WM_COMMAND:
@@ -283,8 +285,8 @@
if (!hIcon)
{
- hIcon = (HICON)GetClassLong(hWnd, bLargeIcon ? GCL_HICON : GCL_HICONSM);
- if (!hIcon) hIcon = (HICON)GetClassLong(hWnd, bLargeIcon ? GCL_HICONSM :
GCL_HICON);
+ hIcon = (HICON)(LONG_PTR)GetClassLongPtr(hWnd, bLargeIcon ? GCL_HICON :
GCL_HICONSM);
+ if (!hIcon) hIcon = (HICON)(LONG_PTR)GetClassLongPtr(hWnd, bLargeIcon ?
GCL_HICONSM : GCL_HICON);
if (!hIcon) SendMessageTimeout(hWnd, WM_QUERYDRAGICON, 0, 0, 0, 1000,
(PDWORD_PTR)xhIcon);
if (!hIcon) SendMessageTimeout(hWnd, WM_GETICON, bLargeIcon ? ICON_SMALL /*0*/ :
ICON_BIG /*1*/, 0, 0, 1000, (PDWORD_PTR)xhIcon);
}
Modified: trunk/reactos/base/applications/taskmgr/column.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/column.c (original)
+++ trunk/reactos/base/applications/taskmgr/column.c Mon Jan 8 05:40:38 2007
@@ -31,7 +31,7 @@
void AddColumns(void)
{
- int size;
+ LRESULT size;
if (TaskManagerSettings.Column_ImageName) {
LoadString(hInst, IDS_TAB_IMAGENAME, szTemp, 256);
@@ -188,7 +188,7 @@
HDITEM hditem;
int i;
TCHAR text[260];
- int size;
+ LRESULT size;
/* Reset column data */
for (i=0; i<25; i++)
@@ -551,31 +551,31 @@
if (LOWORD(wParam) == IDOK)
{
- TaskManagerSettings.Column_ImageName = SendMessage(GetDlgItem(hDlg,
IDC_IMAGENAME), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PID = SendMessage(GetDlgItem(hDlg, IDC_PID),
BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_UserName = SendMessage(GetDlgItem(hDlg,
IDC_USERNAME), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_SessionID = SendMessage(GetDlgItem(hDlg,
IDC_SESSIONID), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_CPUUsage = SendMessage(GetDlgItem(hDlg,
IDC_CPUUSAGE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_CPUTime = SendMessage(GetDlgItem(hDlg,
IDC_CPUTIME), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_MemoryUsage = SendMessage(GetDlgItem(hDlg,
IDC_MEMORYUSAGE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PeakMemoryUsage = SendMessage(GetDlgItem(hDlg,
IDC_PEAKMEMORYUSAGE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_MemoryUsageDelta = SendMessage(GetDlgItem(hDlg,
IDC_MEMORYUSAGEDELTA), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PageFaults = SendMessage(GetDlgItem(hDlg,
IDC_PAGEFAULTS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PageFaultsDelta = SendMessage(GetDlgItem(hDlg,
IDC_PAGEFAULTSDELTA), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_VirtualMemorySize = SendMessage(GetDlgItem(hDlg,
IDC_VIRTUALMEMORYSIZE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PagedPool = SendMessage(GetDlgItem(hDlg,
IDC_PAGEDPOOL), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_NonPagedPool = SendMessage(GetDlgItem(hDlg,
IDC_NONPAGEDPOOL), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_BasePriority = SendMessage(GetDlgItem(hDlg,
IDC_BASEPRIORITY), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_HandleCount = SendMessage(GetDlgItem(hDlg,
IDC_HANDLECOUNT), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_ThreadCount = SendMessage(GetDlgItem(hDlg,
IDC_THREADCOUNT), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_USERObjects = SendMessage(GetDlgItem(hDlg,
IDC_USEROBJECTS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_GDIObjects = SendMessage(GetDlgItem(hDlg,
IDC_GDIOBJECTS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOReads = SendMessage(GetDlgItem(hDlg,
IDC_IOREADS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOWrites = SendMessage(GetDlgItem(hDlg,
IDC_IOWRITES), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOOther = SendMessage(GetDlgItem(hDlg,
IDC_IOOTHER), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOReadBytes = SendMessage(GetDlgItem(hDlg,
IDC_IOREADBYTES), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOWriteBytes = SendMessage(GetDlgItem(hDlg,
IDC_IOWRITEBYTES), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOOtherBytes = SendMessage(GetDlgItem(hDlg,
IDC_IOOTHERBYTES), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_ImageName = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IMAGENAME), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_PID = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_PID), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_UserName = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_USERNAME), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_SessionID = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_SESSIONID), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_CPUUsage = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_CPUUSAGE), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_CPUTime = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_CPUTIME), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_MemoryUsage = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_MEMORYUSAGE), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_PeakMemoryUsage = (BOOL)
SendMessage(GetDlgItem(hDlg, IDC_PEAKMEMORYUSAGE), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_MemoryUsageDelta = (BOOL)
SendMessage(GetDlgItem(hDlg, IDC_MEMORYUSAGEDELTA), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_PageFaults = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_PAGEFAULTS), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_PageFaultsDelta = (BOOL)
SendMessage(GetDlgItem(hDlg, IDC_PAGEFAULTSDELTA), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_VirtualMemorySize = (BOOL)
SendMessage(GetDlgItem(hDlg, IDC_VIRTUALMEMORYSIZE), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_PagedPool = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_PAGEDPOOL), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_NonPagedPool = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_NONPAGEDPOOL), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_BasePriority = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_BASEPRIORITY), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_HandleCount = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_HANDLECOUNT), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_ThreadCount = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_THREADCOUNT), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_USERObjects = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_USEROBJECTS), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_GDIObjects = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_GDIOBJECTS), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOReads = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOREADS), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOWrites = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOWRITES), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOOther = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOOTHER), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOReadBytes = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOREADBYTES), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOWriteBytes = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOWRITEBYTES), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOOtherBytes = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOOTHERBYTES), BM_GETCHECK, 0, 0);
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
Modified: trunk/reactos/base/applications/taskmgr/graph.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/graph.c (original)
+++ trunk/reactos/base/applications/taskmgr/graph.c Mon Jan 8 05:40:38 2007
@@ -24,7 +24,7 @@
int nlastBarsUsed = 0;
-LONG OldGraphWndProc;
+WNDPROC OldGraphWndProc;
void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd);
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd);
@@ -162,7 +162,7 @@
* Get the CPU usage
*/
CpuUsage = PerfDataGetProcessorUsage();
- if (CpuUsage < 0) CpuUsage = 0;
+ if (CpuUsage <= 0) CpuUsage = 0;
if (CpuUsage > 100) CpuUsage = 100;
_stprintf(Text, _T("%d%%"), (int)CpuUsage);
@@ -190,9 +190,9 @@
if (TaskManagerSettings.ShowKernelTimes)
{
- CpuKernelUsage = PerfDataGetProcessorSystemUsage();
- if (CpuKernelUsage < 0) CpuKernelUsage = 0;
- if (CpuKernelUsage > 100) CpuKernelUsage = 100;
+ CpuKernelUsage = PerfDataGetProcessorSystemUsage();
+ if (CpuKernelUsage <= 0) CpuKernelUsage = 0;
+ if (CpuKernelUsage >= 100) CpuKernelUsage = 100;
nBarsUsedKernel = (nBars * CpuKernelUsage) / 100;
}
else
Modified: trunk/reactos/base/applications/taskmgr/graph.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/graph.h (original)
+++ trunk/reactos/base/applications/taskmgr/graph.h Mon Jan 8 05:40:38 2007
@@ -30,10 +30,10 @@
#define BRIGHT_GREEN RGB(0, 255, 0)
#define MEDIUM_GREEN RGB(0, 190, 0)
-#define DARK_GREEN RGB(0, 130, 0)
-#define RED RGB(255, 0, 0)
+#define DARK_GREEN RGB(0, 130, 0)
+#define RED RGB(255, 0, 0)
-extern LONG OldGraphWndProc;
+extern WNDPROC OldGraphWndProc;
INT_PTR CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
Modified: trunk/reactos/base/applications/taskmgr/graphctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/graphctl.c (original)
+++ trunk/reactos/base/applications/taskmgr/graphctl.c Mon Jan 8 05:40:38 2007
@@ -22,7 +22,7 @@
#include <precomp.h>
-LONG OldGraphCtrlWndProc;
+WNDPROC OldGraphCtrlWndProc;
static void GraphCtrl_Init(TGraphCtrl* this)
{
@@ -101,8 +101,14 @@
void GraphCtrl_Dispose(TGraphCtrl* this)
{
+ int plot;
+
+ for (plot = 0; plot < MAX_PLOTS; plot++)
+ DeleteObject(this->m_penPlot[plot]);
+
/* just to be picky restore the bitmaps for the two memory dc's */
/* (these dc's are being destroyed so there shouldn't be any leaks) */
+
if (this->m_bitmapOldGrid != NULL) SelectObject(this->m_dcGrid,
this->m_bitmapOldGrid);
if (this->m_bitmapOldPlot != NULL) SelectObject(this->m_dcPlot,
this->m_bitmapOldPlot);
if (this->m_bitmapGrid != NULL) DeleteObject(this->m_bitmapGrid);
@@ -209,6 +215,7 @@
// so create a new bitmap of the appropriate size
if(this->m_bitmapGrid != NULL)
{
+ this->m_bitmapGrid = (HBITMAP)SelectObject(this->m_dcGrid,
this->m_bitmapOldGrid);
DeleteObject(this->m_bitmapGrid);
this->m_bitmapGrid = CreateCompatibleBitmap(dc, this->m_nClientWidth,
this->m_nClientHeight);
SelectObject(this->m_dcGrid, this->m_bitmapGrid);
@@ -341,6 +348,7 @@
// so create a new bitmap of the appropriate size
if(this->m_bitmapPlot != NULL)
{
+ this->m_bitmapPlot = (HBITMAP)SelectObject(this->m_dcPlot,
this->m_bitmapOldPlot);
DeleteObject(this->m_bitmapPlot);
this->m_bitmapPlot = CreateCompatibleBitmap(dc, this->m_nClientWidth,
this->m_nClientHeight);
SelectObject(this->m_dcPlot, this->m_bitmapPlot);
Modified: trunk/reactos/base/applications/taskmgr/graphctl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/graphctl.h (original)
+++ trunk/reactos/base/applications/taskmgr/graphctl.h Mon Jan 8 05:40:38 2007
@@ -85,7 +85,7 @@
RECT m_rectPlot;
} TGraphCtrl;
-extern LONG OldGraphCtrlWndProc;
+extern WNDPROC OldGraphCtrlWndProc;
double GraphCtrl_AppendPoint(TGraphCtrl* this,
double dNewPoint0, double dNewPoint1,
double dNewPoint2, double dNewPoint3);
Modified: trunk/reactos/base/applications/taskmgr/perfdata.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/perfdata.c (original)
+++ trunk/reactos/base/applications/taskmgr/perfdata.c Mon Jan 8 05:40:38 2007
@@ -63,6 +63,10 @@
void PerfDataUninitialize(void)
{
+
+ if (pPerfData != NULL)
+ HeapFree(GetProcessHeap(), 0, pPerfData);
+
DeleteCriticalSection(&PerfDataCriticalSection);
if (SystemUserSid != NULL)
@@ -121,8 +125,13 @@
/* Get processor time information */
SysProcessorTimeInfo =
(PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)HeapAlloc(GetProcessHeap(), 0,
sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberOfProcessors);
status = NtQuerySystemInformation(SystemProcessorPerformanceInformation,
SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) *
SystemBasicInfo.NumberOfProcessors, &ulSize);
+
if (status != NO_ERROR)
+ {
+ if (SysProcessorTimeInfo != NULL)
+ HeapFree(GetProcessHeap(), 0, SysProcessorTimeInfo);
return;
+ }
/* Get handle information
* We don't know how much data there is so just keep
Modified: trunk/reactos/base/applications/taskmgr/perfpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/perfpage.c (original)
+++ trunk/reactos/base/applications/taskmgr/perfpage.c Mon Jan 8 05:40:38 2007
@@ -110,58 +110,63 @@
RECT rc;
int nXDifference;
int nYDifference;
-
+#ifdef RUN_PERF_PAGE
+ HANDLE hRefreshThread = NULL;
+#endif
/* HDC hdc; */
/* PAINTSTRUCT ps; */
switch (message) {
- case WM_DESTROY:
- GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph);
- GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph);
- break;
-
- case WM_INITDIALOG:
-
- /* Save the width and height */
- GetClientRect(hDlg, &rc);
- nPerformancePageWidth = rc.right;
- nPerformancePageHeight = rc.bottom;
-
- /* Update window position */
- SetWindowPos(hDlg, NULL, 15, 30, 0, 0,
SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
-
- /*
- * Get handles to all the controls
- */
- hPerformancePageTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME);
- hPerformancePageCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME);
- hPerformancePageKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME);
- hPerformancePagePhysicalMemoryFrame = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_FRAME);
-
- hPerformancePageCpuUsageFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME);
- hPerformancePageMemUsageFrame = GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME);
- hPerformancePageCpuUsageHistoryFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_FRAME);
- hPerformancePageMemUsageHistoryFrame = GetDlgItem(hDlg,
IDC_MEMORY_USAGE_HISTORY_FRAME);
-
- hPerformancePageCommitChargeTotalEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_TOTAL);
- hPerformancePageCommitChargeLimitEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_LIMIT);
- hPerformancePageCommitChargePeakEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_PEAK);
- hPerformancePageKernelMemoryTotalEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_TOTAL);
- hPerformancePageKernelMemoryPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_PAGED);
- hPerformancePageKernelMemoryNonPagedEdit = GetDlgItem(hDlg,
IDC_KERNEL_MEMORY_NONPAGED);
- hPerformancePagePhysicalMemoryTotalEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_TOTAL);
- hPerformancePagePhysicalMemoryAvailableEdit = GetDlgItem(hDlg,
IDC_PHYSICAL_MEMORY_AVAILABLE);
- hPerformancePagePhysicalMemorySystemCacheEdit = GetDlgItem(hDlg,
IDC_PHYSICAL_MEMORY_SYSTEM_CACHE);
- hPerformancePageTotalsHandleCountEdit = GetDlgItem(hDlg, IDC_TOTALS_HANDLE_COUNT);
- hPerformancePageTotalsProcessCountEdit = GetDlgItem(hDlg, IDC_TOTALS_PROCESS_COUNT);
- hPerformancePageTotalsThreadCountEdit = GetDlgItem(hDlg, IDC_TOTALS_THREAD_COUNT);
+ case WM_DESTROY:
+ GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph);
+ GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph);
+#ifdef RUN_PERF_PAGE
+ CloseHandle(hRefreshThread);
+#endif
+ break;
+
+ case WM_INITDIALOG:
+
+ /* Save the width and height */
+ GetClientRect(hDlg, &rc);
+ nPerformancePageWidth = rc.right;
+ nPerformancePageHeight = rc.bottom;
+
+ /* Update window position */
+ SetWindowPos(hDlg, NULL, 15, 30, 0, 0,
SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
+
+ /*
+ * Get handles to all the controls
+ */
+ hPerformancePageTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME);
+ hPerformancePageCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME);
+ hPerformancePageKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME);
+ hPerformancePagePhysicalMemoryFrame = GetDlgItem(hDlg,
IDC_PHYSICAL_MEMORY_FRAME);
+
+ hPerformancePageCpuUsageFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME);
+ hPerformancePageMemUsageFrame = GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME);
+ hPerformancePageCpuUsageHistoryFrame = GetDlgItem(hDlg,
IDC_CPU_USAGE_HISTORY_FRAME);
+ hPerformancePageMemUsageHistoryFrame = GetDlgItem(hDlg,
IDC_MEMORY_USAGE_HISTORY_FRAME);
+
+ hPerformancePageCommitChargeTotalEdit = GetDlgItem(hDlg,
IDC_COMMIT_CHARGE_TOTAL);
+ hPerformancePageCommitChargeLimitEdit = GetDlgItem(hDlg,
IDC_COMMIT_CHARGE_LIMIT);
+ hPerformancePageCommitChargePeakEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_PEAK);
+ hPerformancePageKernelMemoryTotalEdit = GetDlgItem(hDlg,
IDC_KERNEL_MEMORY_TOTAL);
+ hPerformancePageKernelMemoryPagedEdit = GetDlgItem(hDlg,
IDC_KERNEL_MEMORY_PAGED);
+ hPerformancePageKernelMemoryNonPagedEdit = GetDlgItem(hDlg,
IDC_KERNEL_MEMORY_NONPAGED);
+ hPerformancePagePhysicalMemoryTotalEdit = GetDlgItem(hDlg,
IDC_PHYSICAL_MEMORY_TOTAL);
+ hPerformancePagePhysicalMemoryAvailableEdit = GetDlgItem(hDlg,
IDC_PHYSICAL_MEMORY_AVAILABLE);
+ hPerformancePagePhysicalMemorySystemCacheEdit = GetDlgItem(hDlg,
IDC_PHYSICAL_MEMORY_SYSTEM_CACHE);
+ hPerformancePageTotalsHandleCountEdit = GetDlgItem(hDlg,
IDC_TOTALS_HANDLE_COUNT);
+ hPerformancePageTotalsProcessCountEdit = GetDlgItem(hDlg,
IDC_TOTALS_PROCESS_COUNT);
+ hPerformancePageTotalsThreadCountEdit = GetDlgItem(hDlg,
IDC_TOTALS_THREAD_COUNT);
hPerformancePageCpuUsageGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_GRAPH);
- hPerformancePageMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH);
- hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
+ hPerformancePageMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH);
+ hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg,
IDC_MEM_USAGE_HISTORY_GRAPH);
hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg,
IDC_CPU_USAGE_HISTORY_GRAPH);
-
- GetClientRect(hPerformancePageCpuUsageHistoryGraph, &rc);
+
+ GetClientRect(hPerformancePageCpuUsageHistoryGraph, &rc);
/* create the control */
/* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg,
IDC_CPU_USAGE_HISTORY_GRAPH); */
GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph,
hPerformancePageCpuUsageHistoryGraph, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
@@ -185,19 +190,19 @@
GraphCtrl_SetBackgroundColor(&PerformancePageMemUsageHistoryGraph, RGB(0, 0,
0)) ;
GraphCtrl_SetGridColor(&PerformancePageMemUsageHistoryGraph, RGB(152, 215,
152)) ;
GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph, 0, RGB(255, 255,
0)) ;
- /* Start our refresh thread */
+ /* Start our refresh thread */
#ifdef RUN_PERF_PAGE
- CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL);
+ hRefreshThread = CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0,
NULL);
#endif
- /*
- * Subclass graph buttons
- */
- OldGraphWndProc = SetWindowLongPtr(hPerformancePageCpuUsageGraph, GWL_WNDPROC,
(DWORD_PTR)Graph_WndProc);
- SetWindowLongPtr(hPerformancePageMemUsageGraph, GWL_WNDPROC,
(DWORD_PTR)Graph_WndProc);
- OldGraphCtrlWndProc = SetWindowLongPtr(hPerformancePageMemUsageHistoryGraph,
GWL_WNDPROC, (DWORD_PTR)GraphCtrl_WndProc);
- SetWindowLongPtr(hPerformancePageCpuUsageHistoryGraph, GWL_WNDPROC,
(DWORD_PTR)GraphCtrl_WndProc);
- return TRUE;
+ /*
+ * Subclass graph buttons
+ */
+ OldGraphWndProc = (WNDPROC)(LONG_PTR)
SetWindowLongPtr(hPerformancePageCpuUsageGraph, GWL_WNDPROC, (LONG_PTR)Graph_WndProc);
+ SetWindowLongPtr(hPerformancePageMemUsageGraph, GWL_WNDPROC,
(LONG_PTR)Graph_WndProc);
+ OldGraphCtrlWndProc = (WNDPROC)(LONG_PTR)
SetWindowLongPtr(hPerformancePageMemUsageHistoryGraph, GWL_WNDPROC,
(LONG_PTR)GraphCtrl_WndProc);
+ SetWindowLongPtr(hPerformancePageCpuUsageHistoryGraph, GWL_WNDPROC,
(LONG_PTR)GraphCtrl_WndProc);
+ return TRUE;
case WM_COMMAND:
break;
@@ -420,13 +425,13 @@
* Get the CPU usage
*/
CpuUsage = PerfDataGetProcessorUsage();
- if (CpuUsage < 0 ) CpuUsage = 0;
+ if (CpuUsage <= 0 ) CpuUsage = 0;
if (CpuUsage > 100) CpuUsage = 100;
if (TaskManagerSettings.ShowKernelTimes)
{
CpuKernelUsage = PerfDataGetProcessorSystemUsage();
- if (CpuKernelUsage < 0) CpuKernelUsage = 0;
+ if (CpuKernelUsage <= 0) CpuKernelUsage = 0;
if (CpuKernelUsage > 100) CpuKernelUsage = 100;
}
else
Modified: trunk/reactos/base/applications/taskmgr/proclist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/proclist.c (original)
+++ trunk/reactos/base/applications/taskmgr/proclist.c Mon Jan 8 05:40:38 2007
@@ -62,7 +62,7 @@
/*
* Get the background brush
*/
- hbrBackground = (HBRUSH) GetClassLong(hWnd, GCL_HBRBACKGROUND);
+ hbrBackground = (HBRUSH)(LONG_PTR) GetClassLongPtr(hWnd, GCL_HBRBACKGROUND);
/*
* Calculate the clip rect by getting the RECT
Modified: trunk/reactos/base/applications/taskmgr/procpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/procpage.c (original)
+++ trunk/reactos/base/applications/taskmgr/procpage.c Mon Jan 8 05:40:38 2007
@@ -42,10 +42,11 @@
INT_PTR CALLBACK
ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- RECT rc;
+ RECT rc;
int nXDifference;
int nYDifference;
int cx, cy;
+ HANDLE hRefreshThread = NULL;
switch (message) {
case WM_INITDIALOG:
@@ -79,10 +80,10 @@
/*
* Subclass the process list control so we can intercept WM_ERASEBKGND
*/
- OldProcessListWndProc = (WNDPROC)SetWindowLongPtr(hProcessPageListCtrl,
GWL_WNDPROC, (DWORD_PTR)ProcessListWndProc);
+ OldProcessListWndProc = (WNDPROC)(LONG_PTR)
SetWindowLongPtr(hProcessPageListCtrl, GWL_WNDPROC, (LONG_PTR)ProcessListWndProc);
/* Start our refresh thread */
- CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
+ hRefreshThread = CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
return TRUE;
@@ -90,6 +91,7 @@
/* Close the event handle, this will make the */
/* refresh thread exit when the wait fails */
CloseHandle(hProcessPageEvent);
+ CloseHandle(hRefreshThread);
SaveColumnSettings();
Modified: trunk/reactos/base/applications/taskmgr/taskmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/taskmgr.c (original)
+++ trunk/reactos/base/applications/taskmgr/taskmgr.c Mon Jan 8 05:40:38 2007
@@ -444,7 +444,7 @@
nParts[0] = 100;
nParts[1] = 210;
nParts[2] = 400;
- SendMessage(hStatusWnd, SB_SETPARTS, 3, (long)nParts);
+ SendMessage(hStatusWnd, SB_SETPARTS, 3, (LPARAM) (LPINT) nParts);
/* Create tab pages */
hTabWnd = GetDlgItem(hWnd, IDC_TAB);
@@ -596,7 +596,7 @@
* This function handles all the moving events for the application
* It moves every child window that needs moving
*/
-void OnMove( UINT nType, int cx, int cy )
+void OnMove( WPARAM nType, int cx, int cy )
{
#ifdef __GNUC__TEST__
MoveWindow(hApplicationPage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT,
TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right -
TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom -
TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE);
@@ -609,7 +609,7 @@
* This function handles all the sizing events for the application
* It re-sizes every window, and child window that needs re-sizing
*/
-void OnSize( UINT nType, int cx, int cy )
+void OnSize( WPARAM nType, int cx, int cy )
{
int nParts[3];
int nXDifference;
@@ -638,7 +638,7 @@
nParts[0] = bInMenuLoop ? -1 : 100;
nParts[1] = 210;
nParts[2] = cx;
- SendMessage(hStatusWnd, SB_SETPARTS, bInMenuLoop ? 1 : 3, (long)nParts);
+ SendMessage(hStatusWnd, SB_SETPARTS, bInMenuLoop ? 1 : 3, (LPARAM) (LPINT) nParts);
/* Resize the tab control */
GetWindowRect(hTabWnd, &rc);
@@ -814,7 +814,7 @@
/* Update the status bar pane sizes */
nParts = -1;
- SendMessage(hStatusWnd, SB_SETPARTS, 1, (long)&nParts);
+ SendMessage(hStatusWnd, SB_SETPARTS, 1, (LPARAM) (LPINT)&nParts);
bInMenuLoop = TRUE;
SendMessage(hStatusWnd, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
}
@@ -835,7 +835,7 @@
nParts[0] = 100;
nParts[1] = 210;
nParts[2] = rc.right;
- SendMessage(hStatusWnd, SB_SETPARTS, 3, (long)nParts);
+ SendMessage(hStatusWnd, SB_SETPARTS, 3, (LPARAM) (LPINT) nParts);
SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)_T(""));
wsprintf(text, szCpuUsage, PerfDataGetProcessorUsage());
SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text);
@@ -969,7 +969,7 @@
hSubMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_WINDOWSMENU));
LoadString(hInst, IDS_MENU_WINDOWS, szTemp, 256);
- InsertMenu(hMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT)hSubMenu, szTemp);
+ InsertMenu(hMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT_PTR) hSubMenu, szTemp);
DrawMenuBar(hMainWnd);
}
@@ -1028,7 +1028,7 @@
AppendMenu(hSubMenu, MF_STRING, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, szTemp);
LoadString(hInst, IDS_MENU_CPUHISTORY, szTemp, 256);
- AppendMenu(hViewMenu, MF_STRING|MF_POPUP, (UINT)hSubMenu, szTemp);
+ AppendMenu(hViewMenu, MF_STRING|MF_POPUP, (UINT_PTR) hSubMenu, szTemp);
LoadString(hInst, IDS_MENU_SHOWKERNELTIMES, szTemp, 256);
AppendMenu(hViewMenu, MF_STRING, ID_VIEW_SHOWKERNELTIMES, szTemp);
Modified: trunk/reactos/base/applications/taskmgr/taskmgr.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/taskmgr.h (original)
+++ trunk/reactos/base/applications/taskmgr/taskmgr.h Mon Jan 8 05:40:38 2007
@@ -127,8 +127,8 @@
/* Foward declarations of functions included in this code module: */
INT_PTR CALLBACK TaskManagerWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL OnCreate(HWND hWnd);
-void OnSize(UINT nType, int cx, int cy);
-void OnMove(UINT nType, int cx, int cy);
+void OnSize(WPARAM nType, int cx, int cy);
+void OnMove(WPARAM nType, int cx, int cy);
void FillSolidRect(HDC hDC, LPCRECT lpRect, COLORREF clr);
void FillSolidRect2(HDC hDC, int x, int y, int cx, int cy, COLORREF clr);
void Draw3dRect(HDC hDC, int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF
clrBottomRight);
Modified: trunk/reactos/base/applications/taskmgr/trayicon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/trayicon.c (original)
+++ trunk/reactos/base/applications/taskmgr/trayicon.c Mon Jan 8 05:40:38 2007
@@ -96,7 +96,7 @@
* Now that we are done drawing put the
* old bitmap back.
*/
- SelectObject(hDC, hOldBitmap);
+ hBitmap = SelectObject(hDC, hOldBitmap);
hOldBitmap = NULL;
iconInfo.fIcon = TRUE;
@@ -114,7 +114,7 @@
if (hScreenDC)
ReleaseDC(NULL, hScreenDC);
if (hOldBitmap)
- SelectObject(hDC, hOldBitmap);
+ hBitmap = SelectObject(hDC, hOldBitmap);
if (hDC)
DeleteDC(hDC);
if (hBitmapBrush)