here are a couple of changes to ROS' taskmanager in order to make it
compile under Wine. It would be great if they were merged into ROS tree.
ChangeLog:
+ Compilation issues
- replaced process.h dependency with winnt.h (when needed)
- converted perfpage.cpp and graphctl.cpp into C code
+ Don't depend on msvcrt
- replaced _beginthread with CreateThread
- added wine only dumb macros for _ui64toa and _ultoa
+ Misc.
- protected some code against division by zero (Wine won't be
able to return lots of system internal values)
- removed ReactOS in title/version information
Let me know if it breaks something on ROS.
(I didn't update ROS' makefile, you have to replace in it the C++ files
in the new C files).
(BTW, it works with a couple of pending patches to Wine. There are still
some bad artifacts in children painting, likely because of
WS_EX_TRANSPARENT style in the performance page. The rest seems ok).
--
Eric Pouech
diff -u -N taskmgr.org/about.c taskmgr/about.c
--- taskmgr.org/about.c 2002-09-10 04:05:22.000000000 +0200
+++ taskmgr/about.c 2003-09-13 14:04:47.000000000 +0200
@@ -27,7 +27,6 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
#include "taskmgr.h"
diff -u -N taskmgr.org/affinity.c taskmgr/affinity.c
--- taskmgr.org/affinity.c 2002-09-10 04:05:22.000000000 +0200
+++ taskmgr/affinity.c 2003-09-12 21:26:34.000000000 +0200
@@ -27,7 +27,7 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
+#include <winnt.h>
#include <stdio.h>
#include "taskmgr.h"
diff -u -N taskmgr.org/applpage.c taskmgr/applpage.c
--- taskmgr.org/applpage.c 2003-08-17 19:29:12.000000000 +0200
+++ taskmgr/applpage.c 2003-09-13 14:19:46.000000000 +0200
@@ -27,7 +27,6 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
#include "taskmgr.h"
@@ -56,7 +55,7 @@
static BOOL bSortAscending = TRUE;
-void ApplicationPageRefreshThread(void *lpParameter);
+DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter);
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung);
void ApplicationPageUpdate(void);
@@ -116,7 +115,7 @@
UpdateApplicationListControlViewSetting();
// Start our refresh thread
- _beginthread(ApplicationPageRefreshThread, 0, NULL);
+ CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, NULL);
return TRUE;
@@ -222,14 +221,14 @@
RefreshApplicationPage();
}
-void ApplicationPageRefreshThread(void *lpParameter)
+DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter)
{
// Create the event
hApplicationPageEvent = CreateEvent(NULL, TRUE, TRUE, _T("Application Page Event"));
// If we couldn't create the event then exit the thread
if (!hApplicationPageEvent)
- return;
+ return 0;
while (1)
{
@@ -241,7 +240,7 @@
// If the wait failed then the event object must have been
// closed and the task manager is exiting so exit this thread
if (dwWaitVal == WAIT_FAILED)
- return;
+ return 0;
if (dwWaitVal == WAIT_OBJECT_0)
{
diff -u -N taskmgr.org/column.c taskmgr/column.c
--- taskmgr.org/column.c 2002-09-10 04:05:22.000000000 +0200
+++ taskmgr/column.c 2003-09-12 21:27:42.000000000 +0200
@@ -27,7 +27,6 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
#include "taskmgr.h"
diff -u -N taskmgr.org/debug.c taskmgr/debug.c
--- taskmgr.org/debug.c 2002-09-10 04:05:22.000000000 +0200
+++ taskmgr/debug.c 2003-09-12 21:27:12.000000000 +0200
@@ -27,8 +27,8 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
+#include <winnt.h>
#include "taskmgr.h"
#include "debug.h"
diff -u -N taskmgr.org/endproc.c taskmgr/endproc.c
--- taskmgr.org/endproc.c 2002-09-10 04:05:22.000000000 +0200
+++ taskmgr/endproc.c 2003-09-12 21:27:21.000000000 +0200
@@ -27,8 +27,8 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
+#include <winnt.h>
#include "taskmgr.h"
#include "endproc.h"
diff -u -N taskmgr.org/font.c taskmgr/font.c
--- taskmgr.org/font.c 2002-09-10 04:05:22.000000000 +0200
+++ taskmgr/font.c 2003-09-12 21:27:42.000000000 +0200
@@ -27,7 +27,6 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
#include "taskmgr.h"
diff -u -N taskmgr.org/graph.c taskmgr/graph.c
--- taskmgr.org/graph.c 2002-09-24 16:22:48.000000000 +0200
+++ taskmgr/graph.c 2003-09-13 13:56:31.000000000 +0200
@@ -27,8 +27,8 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
+#include <winnt.h>
#include "taskmgr.h"
#include "graph.h"
@@ -47,12 +47,11 @@
HDC hdc;
PAINTSTRUCT ps;
LONG WindowId;
-
+
switch (message)
{
case WM_ERASEBKGND:
-
- return TRUE;
+ return TRUE;
//
// Filter out mouse & keyboard messages
@@ -130,7 +129,7 @@
}
EndPaint(hWnd, &ps);
-
+
return 0;
}
@@ -327,7 +326,7 @@
ULONGLONG CommitChargeTotal;
ULONGLONG CommitChargeLimit;
int nBars;
- int nBarsUsed; // Bottom bars that are "used", i.e. are bright green, representing used memory
+ int nBarsUsed = 0; // Bottom bars that are "used", i.e. are bright green, representing used memory
int nBarsFree; // Top bars that are "unused", i.e. are dark green, representing free memory
int i;
@@ -360,7 +359,8 @@
// So first find out how many bars we can fit
//
nBars = ((rcClient.bottom - rcClient.top) - 25) / 3;
- nBarsUsed = (nBars * (int)((CommitChargeTotal * 100) / CommitChargeLimit)) / 100;
+ if (CommitChargeLimit)
+ nBarsUsed = (nBars * (int)((CommitChargeTotal * 100) / CommitChargeLimit)) / 100;
nBarsFree = nBars - nBarsUsed;
if (nBarsUsed < 0) nBarsUsed = 0;
diff -u -N taskmgr.org/graphctl.c taskmgr/graphctl.c
--- taskmgr.org/graphctl.c 1970-01-01 01:00:00.000000000 +0100
+++ taskmgr/graphctl.c 2003-09-13 13:39:54.000000000 +0200
@@ -0,0 +1,648 @@
+/*
+ * ReactOS Task Manager
+ *
+ * GraphCtrl.cpp
+ *
+ * Copyright (C) 2002 Robert Dickenson
robd@reactos.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#include <windows.h>
+#include <commctrl.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <memory.h>
+#include <tchar.h>
+#include <stdio.h>
+
+#include <math.h>
+#include "graphctl.h"
+#include "taskmgr.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+
+LONG OldGraphCtrlWndProc;
+
+static void GraphCtrl_Init(TGraphCtrl* this)
+{
+ int i;
+
+ this->m_hWnd = 0;
+ this->m_hParentWnd = 0;
+ this->m_dcGrid = 0;
+ this->m_dcPlot = 0;
+ this->m_bitmapOldGrid = 0;
+ this->m_bitmapOldPlot = 0;
+ this->m_bitmapGrid = 0;
+ this->m_bitmapPlot = 0;
+ this->m_brushBack = 0;
+
+ this->m_penPlot[0] = 0;
+ this->m_penPlot[1] = 0;
+ this->m_penPlot[2] = 0;
+ this->m_penPlot[3] = 0;
+
+ // since plotting is based on a LineTo for each new point
+ // we need a starting point (i.e. a "previous" point)
+ // use 0.0 as the default first point.
+ // these are public member variables, and can be changed outside
+ // (after construction). Therefore m_perviousPosition could be set to
+ // a more appropriate value prior to the first call to SetPosition.
+ this->m_dPreviousPosition[0] = 0.0;
+ this->m_dPreviousPosition[1] = 0.0;
+ this->m_dPreviousPosition[2] = 0.0;
+ this->m_dPreviousPosition[3] = 0.0;
+
+ // public variable for the number of decimal places on the y axis
+ this->m_nYDecimals = 3;
+
+ // set some initial values for the scaling until "SetRange" is called.
+ // these are protected varaibles and must be set with SetRange
+ // in order to ensure that m_dRange is updated accordingly
+ // m_dLowerLimit = -10.0;
+ // m_dUpperLimit = 10.0;
+ this->m_dLowerLimit = 0.0;
+ this->m_dUpperLimit = 100.0;
+ this->m_dRange = this->m_dUpperLimit - this->m_dLowerLimit; // protected member variable
+
+ // m_nShiftPixels determines how much the plot shifts (in terms of pixels)
+ // with the addition of a new data point
+ this->m_nShiftPixels = 4;
+ this->m_nHalfShiftPixels = this->m_nShiftPixels/2; // protected
+ this->m_nPlotShiftPixels = this->m_nShiftPixels + this->m_nHalfShiftPixels; // protected
+
+ // background, grid and data colors
+ // these are public variables and can be set directly
+ this->m_crBackColor = RGB( 0, 0, 0); // see also SetBackgroundColor
+ this->m_crGridColor = RGB( 0, 255, 255); // see also SetGridColor
+ this->m_crPlotColor[0] = RGB(255, 255, 255); // see also SetPlotColor
+ this->m_crPlotColor[1] = RGB(100, 255, 255); // see also SetPlotColor
+ this->m_crPlotColor[2] = RGB(255, 100, 255); // see also SetPlotColor
+ this->m_crPlotColor[3] = RGB(255, 255, 100); // see also SetPlotColor
+
+ // protected variables
+ for (i = 0; i < MAX_PLOTS; i++)
+ {
+ this->m_penPlot[i] = CreatePen(PS_SOLID, 0, this->m_crPlotColor[i]);
+ }
+ this->m_brushBack = CreateSolidBrush(this->m_crBackColor);
+
+ // public member variables, can be set directly
+ strcpy(this->m_strXUnitsString, "Samples"); // can also be set with SetXUnits
+ strcpy(this->m_strYUnitsString, "Y units"); // can also be set with SetYUnits
+
+ // protected bitmaps to restore the memory DC's
+ this->m_bitmapOldGrid = NULL;
+ this->m_bitmapOldPlot = NULL;
+}
+
+#if 0
+/////////////////////////////////////////////////////////////////////////////
+TGraphCtrl::~TGraphCtrl()
+{
+ // 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 (m_bitmapOldGrid != NULL) SelectObject(m_dcGrid, m_bitmapOldGrid);
+ if (m_bitmapOldPlot != NULL) SelectObject(m_dcPlot, m_bitmapOldPlot);
+ if (m_bitmapGrid != NULL) DeleteObject(m_bitmapGrid);
+ if (m_bitmapPlot != NULL) DeleteObject(m_bitmapPlot);
+ if (m_dcGrid != NULL) DeleteDC(m_dcGrid);
+ if (m_dcPlot != NULL) DeleteDC(m_dcPlot);
+ if (m_brushBack != NULL) DeleteObject(m_brushBack);
+}
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID)
+{
+ BOOL result = 0;
+
+ GraphCtrl_Init(this);
+ this->m_hParentWnd = hParentWnd;
+ this->m_hWnd = hWnd;
+ GraphCtrl_Resize(this);
+ if (result != 0)
+ GraphCtrl_InvalidateCtrl(this);
+ return result;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+void GraphCtrl_SetRange(TGraphCtrl* this, double dLower, double dUpper, int nDecimalPlaces)
+{
+ //ASSERT(dUpper > dLower);
+ this->m_dLowerLimit = dLower;
+ this->m_dUpperLimit = dUpper;
+ this->m_nYDecimals = nDecimalPlaces;
+ this->m_dRange = this->m_dUpperLimit - this->m_dLowerLimit;
+ this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange;
+ // clear out the existing garbage, re-start with a clean plot
+ GraphCtrl_InvalidateCtrl(this);
+}
+
+#if 0
+/////////////////////////////////////////////////////////////////////////////
+void TGraphCtrl::SetXUnits(const char* string)
+{
+ strncpy(m_strXUnitsString, string, sizeof(m_strXUnitsString) - 1);
+ // clear out the existing garbage, re-start with a clean plot
+ InvalidateCtrl();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+void TGraphCtrl::SetYUnits(const char* string)
+{
+ strncpy(m_strYUnitsString, string, sizeof(m_strYUnitsString) - 1);
+ // clear out the existing garbage, re-start with a clean plot
+ InvalidateCtrl();
+}
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+void GraphCtrl_SetGridColor(TGraphCtrl* this, COLORREF color)
+{
+ this->m_crGridColor = color;
+ // clear out the existing garbage, re-start with a clean plot
+ GraphCtrl_InvalidateCtrl(this);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+void GraphCtrl_SetPlotColor(TGraphCtrl* this, int plot, COLORREF color)
+{
+ this->m_crPlotColor[plot] = color;
+ DeleteObject(this->m_penPlot[plot]);
+ this->m_penPlot[plot] = CreatePen(PS_SOLID, 0, this->m_crPlotColor[plot]);
+ // clear out the existing garbage, re-start with a clean plot
+ GraphCtrl_InvalidateCtrl(this);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+void GraphCtrl_SetBackgroundColor(TGraphCtrl* this, COLORREF color)
+{
+ this->m_crBackColor = color;
+ DeleteObject(this->m_brushBack);
+ this->m_brushBack = CreateSolidBrush(this->m_crBackColor);
+ // clear out the existing garbage, re-start with a clean plot
+ GraphCtrl_InvalidateCtrl(this);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+void GraphCtrl_InvalidateCtrl(TGraphCtrl* this)
+{
+ // There is a lot of drawing going on here - particularly in terms of
+ // drawing the grid. Don't panic, this is all being drawn (only once)
+ // to a bitmap. The result is then BitBlt'd to the control whenever needed.
+ int i, j;
+ int nCharacters;
+ int nTopGridPix, nMidGridPix, nBottomGridPix;
+
+ HPEN oldPen;
+ HPEN solidPen = CreatePen(PS_SOLID, 0, this->m_crGridColor);
+ //HFONT axisFont, yUnitFont, oldFont;
+ //char strTemp[50];
+
+ // in case we haven't established the memory dc's
+ //CClientDC dc(this);
+ HDC dc = GetDC(this->m_hParentWnd);
+
+ // if we don't have one yet, set up a memory dc for the grid
+ if (this->m_dcGrid == NULL)
+ {
+ this->m_dcGrid = CreateCompatibleDC(dc);
+ this->m_bitmapGrid = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
+ this->m_bitmapOldGrid = (HBITMAP)SelectObject(this->m_dcGrid, this->m_bitmapGrid);
+ }
+
+ SetBkColor(this->m_dcGrid, this->m_crBackColor);
+
+ // fill the grid background
+ FillRect(this->m_dcGrid, &this->m_rectClient, this->m_brushBack);
+
+ // draw the plot rectangle:
+ // determine how wide the y axis scaling values are
+ nCharacters = abs((int)log10(fabs(this->m_dUpperLimit)));
+ nCharacters = max(nCharacters, abs((int)log10(fabs(this->m_dLowerLimit))));
+
+ // add the units digit, decimal point and a minus sign, and an extra space
+ // as well as the number of decimal places to display
+ nCharacters = nCharacters + 4 + this->m_nYDecimals;
+
+ // adjust the plot rectangle dimensions
+ // assume 6 pixels per character (this may need to be adjusted)
+ // m_rectPlot.left = m_rectClient.left + 6*(nCharacters);
+ this->m_rectPlot.left = this->m_rectClient.left;
+ this->m_nPlotWidth = this->m_rectPlot.right - this->m_rectPlot.left;//m_rectPlot.Width();
+
+ // draw the plot rectangle
+ oldPen = (HPEN)SelectObject(this->m_dcGrid, solidPen);
+ MoveToEx(this->m_dcGrid, this->m_rectPlot.left, this->m_rectPlot.top, NULL);
+ LineTo(this->m_dcGrid, this->m_rectPlot.right+1, this->m_rectPlot.top);
+ LineTo(this->m_dcGrid, this->m_rectPlot.right+1, this->m_rectPlot.bottom+1);
+ LineTo(this->m_dcGrid, this->m_rectPlot.left, this->m_rectPlot.bottom+1);
+ // LineTo(m_dcGrid, m_rectPlot.left, m_rectPlot.top);
+ SelectObject(this->m_dcGrid, oldPen);
+ DeleteObject(solidPen);
+
+ // draw the dotted lines,
+ // use SetPixel instead of a dotted pen - this allows for a
+ // finer dotted line and a more "technical" look
+ nMidGridPix = (this->m_rectPlot.top + this->m_rectPlot.bottom)/2;
+ nTopGridPix = nMidGridPix - this->m_nPlotHeight/4;
+ nBottomGridPix = nMidGridPix + this->m_nPlotHeight/4;
+
+ for (i=this->m_rectPlot.left; i<this->m_rectPlot.right; i+=2)
+ {
+ SetPixel(this->m_dcGrid, i, nTopGridPix, this->m_crGridColor);
+ SetPixel(this->m_dcGrid, i, nMidGridPix, this->m_crGridColor);
+ SetPixel(this->m_dcGrid, i, nBottomGridPix, this->m_crGridColor);
+ }
+
+ for (i=this->m_rectPlot.left; i<this->m_rectPlot.right; i+=10)
+ {
+ for (j=this->m_rectPlot.top; j<this->m_rectPlot.bottom; j+=2)
+ {
+ SetPixel(this->m_dcGrid, i, j, this->m_crGridColor);
+ // SetPixel(m_dcGrid, i, j, m_crGridColor);
+ // SetPixel(m_dcGrid, i, j, m_crGridColor);
+ }
+ }
+
+#if 0
+ // create some fonts (horizontal and vertical)
+ // use a height of 14 pixels and 300 weight
+ // (these may need to be adjusted depending on the display)
+ axisFont = CreateFont (14, 0, 0, 0, 300,
+ FALSE, FALSE, 0, ANSI_CHARSET,
+ OUT_DEFAULT_PRECIS,
+ CLIP_DEFAULT_PRECIS,
+ DEFAULT_QUALITY,
+ DEFAULT_PITCH|FF_SWISS, "Arial");
+ yUnitFont = CreateFont (14, 0, 900, 0, 300,
+ FALSE, FALSE, 0, ANSI_CHARSET,
+ OUT_DEFAULT_PRECIS,
+ CLIP_DEFAULT_PRECIS,
+ DEFAULT_QUALITY,
+ DEFAULT_PITCH|FF_SWISS, "Arial");
+
+ // grab the horizontal font
+ oldFont = (HFONT)SelectObject(m_dcGrid, axisFont);
+
+ // y max
+ SetTextColor(m_dcGrid, m_crGridColor);
+ SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP);
+ sprintf(strTemp, "%.*lf", m_nYDecimals, m_dUpperLimit);
+ TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.top, strTemp, _tcslen(strTemp));
+
+ // y min
+ SetTextAlign(m_dcGrid, TA_RIGHT|TA_BASELINE);
+ sprintf(strTemp, "%.*lf", m_nYDecimals, m_dLowerLimit);
+ TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.bottom, strTemp, _tcslen(strTemp));
+
+ // x min
+ SetTextAlign(m_dcGrid, TA_LEFT|TA_TOP);
+ TextOut(m_dcGrid, m_rectPlot.left, m_rectPlot.bottom+4, "0", 1);
+
+ // x max
+ SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP);
+ sprintf(strTemp, "%d", m_nPlotWidth/m_nShiftPixels);
+ TextOut(m_dcGrid, m_rectPlot.right, m_rectPlot.bottom+4, strTemp, _tcslen(strTemp));
+
+ // x units
+ SetTextAlign(m_dcGrid, TA_CENTER|TA_TOP);
+ TextOut(m_dcGrid, (m_rectPlot.left+m_rectPlot.right)/2,
+ m_rectPlot.bottom+4, m_strXUnitsString, _tcslen(m_strXUnitsString));
+
+ // restore the font
+ SelectObject(m_dcGrid, oldFont);
+
+ // y units
+ oldFont = (HFONT)SelectObject(m_dcGrid, yUnitFont);
+ SetTextAlign(m_dcGrid, TA_CENTER|TA_BASELINE);
+ TextOut(m_dcGrid, (m_rectClient.left+m_rectPlot.left)/2,
+ (m_rectPlot.bottom+m_rectPlot.top)/2, m_strYUnitsString, _tcslen(m_strYUnitsString));
+ SelectObject(m_dcGrid, oldFont);
+#endif
+ // at this point we are done filling the the grid bitmap,
+ // no more drawing to this bitmap is needed until the setting are changed
+
+ // if we don't have one yet, set up a memory dc for the plot
+ if (this->m_dcPlot == NULL)
+ {
+ this->m_dcPlot = CreateCompatibleDC(dc);
+ this->m_bitmapPlot = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
+ this->m_bitmapOldPlot = (HBITMAP)SelectObject(this->m_dcPlot, this->m_bitmapPlot);
+ }
+
+ // make sure the plot bitmap is cleared
+ SetBkColor(this->m_dcPlot, this->m_crBackColor);
+ FillRect(this->m_dcPlot, &this->m_rectClient, this->m_brushBack);
+
+ // finally, force the plot area to redraw
+ InvalidateRect(this->m_hParentWnd, &this->m_rectClient, TRUE);
+ ReleaseDC(this->m_hParentWnd, dc);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+double GraphCtrl_AppendPoint(TGraphCtrl* this,
+ double dNewPoint0, double dNewPoint1,
+ double dNewPoint2, double dNewPoint3)
+{
+ // append a data point to the plot & return the previous point
+ double dPrevious;
+
+ dPrevious = this->m_dCurrentPosition[0];
+ this->m_dCurrentPosition[0] = dNewPoint0;
+ this->m_dCurrentPosition[1] = dNewPoint1;
+ this->m_dCurrentPosition[2] = dNewPoint2;
+ this->m_dCurrentPosition[3] = dNewPoint3;
+ GraphCtrl_DrawPoint(this);
+ //Invalidate();
+ return dPrevious;
+}
+
+////////////////////////////////////////////////////////////////////////////
+void GraphCtrl_Paint(TGraphCtrl* this, HWND hWnd, HDC dc)
+{
+ HDC memDC;
+ HBITMAP memBitmap;
+ HBITMAP oldBitmap; // bitmap originally found in CMemDC
+
+// RECT rcClient;
+// GetClientRect(hWnd, &rcClient);
+// FillSolidRect(dc, &rcClient, RGB(255, 0, 255));
+// m_nClientWidth = rcClient.right - rcClient.left;
+// m_nClientHeight = rcClient.bottom - rcClient.top;
+
+ // no real plotting work is performed here,
+ // just putting the existing bitmaps on the client
+
+ // to avoid flicker, establish a memory dc, draw to it
+ // and then BitBlt it to the client
+ memDC = CreateCompatibleDC(dc);
+ memBitmap = (HBITMAP)CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
+ oldBitmap = (HBITMAP)SelectObject(memDC, memBitmap);
+
+ if (memDC != NULL)
+ {
+ // first drop the grid on the memory dc
+ BitBlt(memDC, 0, 0, this->m_nClientWidth, this->m_nClientHeight, this->m_dcGrid, 0, 0, SRCCOPY);
+ // now add the plot on top as a "pattern" via SRCPAINT.
+ // works well with dark background and a light plot
+ BitBlt(memDC, 0, 0, this->m_nClientWidth, this->m_nClientHeight, this->m_dcPlot, 0, 0, SRCPAINT); //SRCPAINT
+ // finally send the result to the display
+ BitBlt(dc, 0, 0, this->m_nClientWidth, this->m_nClientHeight, memDC, 0, 0, SRCCOPY);
+ }
+ SelectObject(memDC, oldBitmap);
+ DeleteObject(memBitmap);
+ DeleteDC(memDC);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+void GraphCtrl_DrawPoint(TGraphCtrl* this)
+{
+ // this does the work of "scrolling" the plot to the left
+ // and appending a new data point all of the plotting is
+ // directed to the memory based bitmap associated with m_dcPlot
+ // the will subsequently be BitBlt'd to the client in Paint
+
+ int currX, prevX, currY, prevY;
+ HPEN oldPen;
+ RECT rectCleanUp;
+ int i;
+
+ if (this->m_dcPlot != NULL)
+ {
+ // shift the plot by BitBlt'ing it to itself
+ // note: the m_dcPlot covers the entire client
+ // but we only shift bitmap that is the size
+ // of the plot rectangle
+ // grab the right side of the plot (exluding m_nShiftPixels on the left)
+ // move this grabbed bitmap to the left by m_nShiftPixels
+
+ BitBlt(this->m_dcPlot, this->m_rectPlot.left, this->m_rectPlot.top+1,
+ this->m_nPlotWidth, this->m_nPlotHeight, this->m_dcPlot,
+ this->m_rectPlot.left+this->m_nShiftPixels, this->m_rectPlot.top+1,
+ SRCCOPY);
+
+ // establish a rectangle over the right side of plot
+ // which now needs to be cleaned up proir to adding the new point
+ rectCleanUp = this->m_rectPlot;
+ rectCleanUp.left = rectCleanUp.right - this->m_nShiftPixels;
+
+ // fill the cleanup area with the background
+ FillRect(this->m_dcPlot, &rectCleanUp, this->m_brushBack);
+
+ // draw the next line segement
+ for (i = 0; i < MAX_PLOTS; i++)
+ {
+ // grab the plotting pen
+ oldPen = (HPEN)SelectObject(this->m_dcPlot, this->m_penPlot[i]);
+
+ // move to the previous point
+ prevX = this->m_rectPlot.right-this->m_nPlotShiftPixels;
+ prevY = this->m_rectPlot.bottom -
+ (long)((this->m_dPreviousPosition[i] - this->m_dLowerLimit) * this->m_dVerticalFactor);
+ MoveToEx(this->m_dcPlot, prevX, prevY, NULL);
+
+ // draw to the current point
+ currX = this->m_rectPlot.right-this->m_nHalfShiftPixels;
+ currY = this->m_rectPlot.bottom -
+ (long)((this->m_dCurrentPosition[i] - this->m_dLowerLimit) * this->m_dVerticalFactor);
+ LineTo(this->m_dcPlot, currX, currY);
+
+ // Restore the pen
+ SelectObject(this->m_dcPlot, oldPen);
+
+ // if the data leaks over the upper or lower plot boundaries
+ // fill the upper and lower leakage with the background
+ // this will facilitate clipping on an as needed basis
+ // as opposed to always calling IntersectClipRect
+
+ if ((prevY <= this->m_rectPlot.top) || (currY <= this->m_rectPlot.top))
+ {
+ RECT rc;
+ rc.bottom = this->m_rectPlot.top+1;
+ rc.left = prevX;
+ rc.right = currX+1;
+ rc.top = this->m_rectClient.top;
+ FillRect(this->m_dcPlot, &rc, this->m_brushBack);
+ }
+ if ((prevY >= this->m_rectPlot.bottom) || (currY >= this->m_rectPlot.bottom))
+ {
+ RECT rc;
+ rc.bottom = this->m_rectClient.bottom+1;
+ rc.left = prevX;
+ rc.right = currX+1;
+ rc.top = this->m_rectPlot.bottom+1;
+ //RECT rc(prevX, m_rectPlot.bottom+1, currX+1, m_rectClient.bottom+1);
+ FillRect(this->m_dcPlot, &rc, this->m_brushBack);
+ }
+
+ // store the current point for connection to the next point
+ this->m_dPreviousPosition[i] = this->m_dCurrentPosition[i];
+ }
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+void GraphCtrl_Resize(TGraphCtrl* this)
+{
+ // NOTE: Resize automatically gets called during the setup of the control
+ GetClientRect(this->m_hWnd, &this->m_rectClient);
+
+ // set some member variables to avoid multiple function calls
+ this->m_nClientHeight = this->m_rectClient.bottom - this->m_rectClient.top;//m_rectClient.Height();
+ this->m_nClientWidth = this->m_rectClient.right - this->m_rectClient.left;//m_rectClient.Width();
+
+ // the "left" coordinate and "width" will be modified in
+ // InvalidateCtrl to be based on the width of the y axis scaling
+#if 0
+ this->m_rectPlot.left = 20;
+ this->m_rectPlot.top = 10;
+ this->m_rectPlot.right = this->m_rectClient.right-10;
+ this->m_rectPlot.bottom = this->m_rectClient.bottom-25;
+#else
+ this->m_rectPlot.left = 0;
+ this->m_rectPlot.top = -1;
+ this->m_rectPlot.right = this->m_rectClient.right-0;
+ this->m_rectPlot.bottom = this->m_rectClient.bottom-0;
+#endif
+
+ // set some member variables to avoid multiple function calls
+ this->m_nPlotHeight = this->m_rectPlot.bottom - this->m_rectPlot.top;//m_rectPlot.Height();
+ this->m_nPlotWidth = this->m_rectPlot.right - this->m_rectPlot.left;//m_rectPlot.Width();
+
+ // set the scaling factor for now, this can be adjusted
+ // in the SetRange functions
+ this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange;
+}
+
+#if 0
+/////////////////////////////////////////////////////////////////////////////
+void TGraphCtrl::Reset()
+{
+ // to clear the existing data (in the form of a bitmap)
+ // simply invalidate the entire control
+ InvalidateCtrl();
+}
+#endif
+
+extern TGraphCtrl PerformancePageCpuUsageHistoryGraph;
+extern TGraphCtrl PerformancePageMemUsageHistoryGraph;
+extern HWND hPerformancePageCpuUsageHistoryGraph;
+extern HWND hPerformancePageMemUsageHistoryGraph;
+
+LRESULT CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ RECT rcClient;
+ HDC hdc;
+ PAINTSTRUCT ps;
+
+ switch (message)
+ {
+ case WM_ERASEBKGND:
+ return TRUE;
+ //
+ // Filter out mouse & keyboard messages
+ //
+ //case WM_APPCOMMAND:
+ case WM_CAPTURECHANGED:
+ case WM_LBUTTONDBLCLK:
+ case WM_LBUTTONDOWN:
+ case WM_LBUTTONUP:
+ case WM_MBUTTONDBLCLK:
+ case WM_MBUTTONDOWN:
+ case WM_MBUTTONUP:
+ case WM_MOUSEACTIVATE:
+ case WM_MOUSEHOVER:
+ case WM_MOUSELEAVE:
+ case WM_MOUSEMOVE:
+ //case WM_MOUSEWHEEL:
+ case WM_NCHITTEST:
+ case WM_NCLBUTTONDBLCLK:
+ case WM_NCLBUTTONDOWN:
+ case WM_NCLBUTTONUP:
+ case WM_NCMBUTTONDBLCLK:
+ case WM_NCMBUTTONDOWN:
+ case WM_NCMBUTTONUP:
+ //case WM_NCMOUSEHOVER:
+ //case WM_NCMOUSELEAVE:
+ case WM_NCMOUSEMOVE:
+ case WM_NCRBUTTONDBLCLK:
+ case WM_NCRBUTTONDOWN:
+ case WM_NCRBUTTONUP:
+ //case WM_NCXBUTTONDBLCLK:
+ //case WM_NCXBUTTONDOWN:
+ //case WM_NCXBUTTONUP:
+ case WM_RBUTTONDBLCLK:
+ case WM_RBUTTONDOWN:
+ case WM_RBUTTONUP:
+ //case WM_XBUTTONDBLCLK:
+ //case WM_XBUTTONDOWN:
+ //case WM_XBUTTONUP:
+ case WM_ACTIVATE:
+ case WM_CHAR:
+ case WM_DEADCHAR:
+ case WM_GETHOTKEY:
+ case WM_HOTKEY:
+ case WM_KEYDOWN:
+ case WM_KEYUP:
+ case WM_KILLFOCUS:
+ case WM_SETFOCUS:
+ case WM_SETHOTKEY:
+ case WM_SYSCHAR:
+ case WM_SYSDEADCHAR:
+ case WM_SYSKEYDOWN:
+ case WM_SYSKEYUP:
+ return 0;
+
+ case WM_NCCALCSIZE:
+ return 0;
+
+ case WM_SIZE:
+ if (hWnd == hPerformancePageMemUsageHistoryGraph)
+ {
+ GraphCtrl_Resize(&PerformancePageMemUsageHistoryGraph);
+ GraphCtrl_InvalidateCtrl(&PerformancePageMemUsageHistoryGraph);
+ }
+ if (hWnd == hPerformancePageCpuUsageHistoryGraph)
+ {
+ GraphCtrl_Resize(&PerformancePageCpuUsageHistoryGraph);
+ GraphCtrl_InvalidateCtrl(&PerformancePageCpuUsageHistoryGraph);
+ }
+ return 0;
+
+ case WM_PAINT:
+ hdc = BeginPaint(hWnd, &ps);
+ GetClientRect(hWnd, &rcClient);
+ if (hWnd == hPerformancePageMemUsageHistoryGraph)
+ GraphCtrl_Paint(&PerformancePageMemUsageHistoryGraph, hWnd, hdc);
+ if (hWnd == hPerformancePageCpuUsageHistoryGraph)
+ GraphCtrl_Paint(&PerformancePageCpuUsageHistoryGraph, hWnd, hdc);
+ EndPaint(hWnd, &ps);
+ return 0;
+ }
+
+ //
+ // We pass on all non-handled messages
+ //
+ return CallWindowProc((WNDPROC)OldGraphCtrlWndProc, hWnd, message, wParam, lParam);
+}
diff -u -N taskmgr.org/graphctl.h taskmgr/graphctl.h
--- taskmgr.org/graphctl.h 2002-09-10 04:05:22.000000000 +0200
+++ taskmgr/graphctl.h 2003-09-13 14:13:17.000000000 +0200
@@ -26,41 +26,23 @@
#define MAX_PLOTS 4
#define MAX_CTRLS 4
-
#ifdef __cplusplus
+extern "C" {
+#endif
-
-class TGraphCtrl
-{
+#if 0
// Attributes
public:
- double AppendPoint(double dNewPoint0, double dNewPoint1 = 0.0,
- double dNewPoint2 = 0.0, double dNewPoint3 = 0.0);
- void SetRange(double dLower, double dUpper, int nDecimalPlaces=1);
void SetXUnits(const char* string);
void SetYUnits(const char* string);
- void SetGridColor(COLORREF color);
- void SetPlotColor(int plot, COLORREF color);
- void SetBackgroundColor(COLORREF color);
- void InvalidateCtrl();
- void DrawPoint();
- void Reset();
// Operations
public:
BOOL Create(DWORD dwStyle, const RECT& rect, HWND hParentWnd, UINT nID=NULL);
- BOOL Create(HWND hWnd, HWND hParentWnd, UINT nID=NULL);
- void Paint(HWND hWnd, HDC dc);
- void Resize(void);
-
-#if 0
- static TGraphCtrl* LookupGraphCtrl(HWND hWnd);
- static TGraphCtrl* pCtrlArray[MAX_CTRLS];
- static int CtrlCount;
#endif
-// Implementation
-public:
+typedef struct
+{
int m_nShiftPixels; // amount to shift with each new point
int m_nYDecimals;
@@ -74,12 +56,7 @@
double m_dCurrentPosition[MAX_PLOTS]; // current position
double m_dPreviousPosition[MAX_PLOTS]; // previous position
-// Construction
-public:
- TGraphCtrl();
- virtual ~TGraphCtrl();
-
-protected:
+/* those were protected fields */
int m_nHalfShiftPixels;
int m_nPlotShiftPixels;
int m_nClientHeight;
@@ -104,18 +81,28 @@
HPEN m_penPlot[MAX_PLOTS];
RECT m_rectClient;
RECT m_rectPlot;
-};
-
-extern "C" {
-#endif
+} TGraphCtrl;
extern LONG OldGraphCtrlWndProc;
+double GraphCtrl_AppendPoint(TGraphCtrl* this,
+ double dNewPoint0, double dNewPoint1,
+ double dNewPoint2, double dNewPoint3);
+BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID);
+void GraphCtrl_DrawPoint(TGraphCtrl* this);
+void GraphCtrl_InvalidateCtrl(TGraphCtrl* this);
+void GraphCtrl_Paint(TGraphCtrl* this, HWND hWnd, HDC dc);
+void GraphCtrl_Reset(TGraphCtrl* this);
+void GraphCtrl_Resize(TGraphCtrl* this);
+void GraphCtrl_SetBackgroundColor(TGraphCtrl* this, COLORREF color);
+void GraphCtrl_SetGridColor(TGraphCtrl* this, COLORREF color);
+void GraphCtrl_SetPlotColor(TGraphCtrl* this, int plot, COLORREF color);
+void GraphCtrl_SetRange(TGraphCtrl* this, double dLower, double dUpper, int nDecimalPlaces);
+
LRESULT CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
#ifdef __cplusplus
-};
+}
#endif
-
#endif /* __GRAPH_CTRL_H__ */
diff -u -N taskmgr.org/optnmenu.c taskmgr/optnmenu.c
--- taskmgr.org/optnmenu.c 2002-09-10 04:06:10.000000000 +0200
+++ taskmgr/optnmenu.c 2003-09-12 21:32:10.000000000 +0200
@@ -33,7 +33,6 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
#include "taskmgr.h"
diff -u -N taskmgr.org/perfdata.c taskmgr/perfdata.c
--- taskmgr.org/perfdata.c 2002-09-24 16:22:48.000000000 +0200
+++ taskmgr/perfdata.c 2003-09-13 13:57:47.000000000 +0200
@@ -27,9 +27,8 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
-
+#include <winnt.h>
#include "taskmgr.h"
#include "perfdata.h"
diff -u -N taskmgr.org/perfpage.c taskmgr/perfpage.c
--- taskmgr.org/perfpage.c 1970-01-01 01:00:00.000000000 +0100
+++ taskmgr/perfpage.c 2003-09-13 14:35:54.000000000 +0200
@@ -0,0 +1,520 @@
+/*
+ * ReactOS Task Manager
+ *
+ * perfpage.c
+ *
+ * Copyright (C) 1999 - 2001 Brian Palmer
brianp@reactos.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#include <windows.h>
+#include <commctrl.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <memory.h>
+#include <tchar.h>
+#include <stdio.h>
+#include <winnt.h>
+
+#include "taskmgr.h"
+#include "perfpage.h"
+#include "perfdata.h"
+
+#include "graph.h"
+#include "graphctl.h"
+
+TGraphCtrl PerformancePageCpuUsageHistoryGraph;
+TGraphCtrl PerformancePageMemUsageHistoryGraph;
+
+HWND hPerformancePage; // Performance Property Page
+
+HWND hPerformancePageCpuUsageGraph; // CPU Usage Graph
+HWND hPerformancePageMemUsageGraph; // MEM Usage Graph
+HWND hPerformancePageCpuUsageHistoryGraph; // CPU Usage History Graph
+HWND hPerformancePageMemUsageHistoryGraph; // Memory Usage History Graph
+
+HWND hPerformancePageTotalsFrame; // Totals Frame
+HWND hPerformancePageCommitChargeFrame; // Commit Charge Frame
+HWND hPerformancePageKernelMemoryFrame; // Kernel Memory Frame
+HWND hPerformancePagePhysicalMemoryFrame; // Physical Memory Frame
+
+HWND hPerformancePageCpuUsageFrame;
+HWND hPerformancePageMemUsageFrame;
+HWND hPerformancePageCpuUsageHistoryFrame;
+HWND hPerformancePageMemUsageHistoryFrame;
+
+HWND hPerformancePageCommitChargeTotalEdit; // Commit Charge Total Edit Control
+HWND hPerformancePageCommitChargeLimitEdit; // Commit Charge Limit Edit Control
+HWND hPerformancePageCommitChargePeakEdit; // Commit Charge Peak Edit Control
+
+HWND hPerformancePageKernelMemoryTotalEdit; // Kernel Memory Total Edit Control
+HWND hPerformancePageKernelMemoryPagedEdit; // Kernel Memory Paged Edit Control
+HWND hPerformancePageKernelMemoryNonPagedEdit; // Kernel Memory NonPaged Edit Control
+
+HWND hPerformancePagePhysicalMemoryTotalEdit; // Physical Memory Total Edit Control
+HWND hPerformancePagePhysicalMemoryAvailableEdit; // Physical Memory Available Edit Control
+HWND hPerformancePagePhysicalMemorySystemCacheEdit; // Physical Memory System Cache Edit Control
+
+HWND hPerformancePageTotalsHandleCountEdit; // Total Handles Edit Control
+HWND hPerformancePageTotalsProcessCountEdit; // Total Processes Edit Control
+HWND hPerformancePageTotalsThreadCountEdit; // Total Threads Edit Control
+
+
+static int nPerformancePageWidth;
+static int nPerformancePageHeight;
+
+static HANDLE hPerformancePageEvent = NULL; // When this event becomes signaled then we refresh the performance page
+
+DWORD WINAPI PerformancePageRefreshThread(void *lpParameter);
+
+void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
+{
+ RECT rc;
+ int cx, cy, sx, sy;
+
+ GetClientRect(hCntrl, &rc);
+ MapWindowPoints(hCntrl, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)));
+ if (pos) {
+ cx = rc.left;
+ cy = rc.top;
+ sx = rc.right - rc.left;
+ switch (pos) {
+ case 1:
+ break;
+ case 2:
+ cy += nYDifference / 2;
+ break;
+ case 3:
+ sx += nXDifference;
+ break;
+ case 4:
+ cy += nYDifference / 2;
+ sx += nXDifference;
+ break;
+ }
+ sy = rc.bottom - rc.top + nYDifference / 2;
+ SetWindowPos(hCntrl, NULL, cx, cy, sx, sy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER);
+ } else {
+ cx = rc.left + nXDifference;
+ cy = rc.top + nYDifference;
+ sx = sy = 0;
+ SetWindowPos(hCntrl, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
+ }
+ InvalidateRect(hCntrl, NULL, TRUE);
+}
+
+void AdjustControlPostion(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference)
+{
+ AdjustFrameSize(hCntrl, hDlg, nXDifference, nYDifference, 0);
+}
+
+void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
+{
+ AdjustFrameSize(GetDlgItem(hDlg, ctrl_id), hDlg, nXDifference, nYDifference, 0);
+}
+
+LRESULT CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ RECT rc;
+ int nXDifference;
+ int nYDifference;
+
+// HDC hdc;
+// PAINTSTRUCT ps;
+
+ switch (message) {
+ 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);
+ hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
+
+ 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);
+ // customize the control
+ GraphCtrl_SetRange(&PerformancePageCpuUsageHistoryGraph, 0.0, 100.0, 10);
+// PerformancePageCpuUsageHistoryGraph.SetYUnits("Current") ;
+// PerformancePageCpuUsageHistoryGraph.SetXUnits("Samples (Windows Timer: 100 msec)") ;
+// PerformancePageCpuUsageHistoryGraph.SetBackgroundColor(RGB(0, 0, 64)) ;
+// PerformancePageCpuUsageHistoryGraph.SetGridColor(RGB(192, 192, 255)) ;
+// PerformancePageCpuUsageHistoryGraph.SetPlotColor(RGB(255, 255, 255)) ;
+ GraphCtrl_SetBackgroundColor(&PerformancePageCpuUsageHistoryGraph, RGB(0, 0, 0)) ;
+ GraphCtrl_SetGridColor(&PerformancePageCpuUsageHistoryGraph, RGB(152, 205, 152)) ;
+ GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 0, RGB(255, 0, 0)) ;
+ GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph, 1, RGB(0, 255, 0)) ;
+
+ GetClientRect(hPerformancePageMemUsageHistoryGraph, &rc);
+ GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph, hPerformancePageMemUsageHistoryGraph, hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
+ GraphCtrl_SetRange(&PerformancePageMemUsageHistoryGraph, 0.0, 100.0, 10) ;
+ 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
+#ifdef RUN_PERF_PAGE
+ CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL);
+#endif
+
+ //
+ // Subclass graph buttons
+ //
+ OldGraphWndProc = SetWindowLong(hPerformancePageCpuUsageGraph, GWL_WNDPROC, (LONG)Graph_WndProc);
+ SetWindowLong(hPerformancePageMemUsageGraph, GWL_WNDPROC, (LONG)Graph_WndProc);
+ OldGraphCtrlWndProc = SetWindowLong(hPerformancePageMemUsageHistoryGraph, GWL_WNDPROC, (LONG)GraphCtrl_WndProc);
+ SetWindowLong(hPerformancePageCpuUsageHistoryGraph, GWL_WNDPROC, (LONG)GraphCtrl_WndProc);
+ return TRUE;
+
+ case WM_COMMAND:
+ break;
+#if 0
+ case WM_NCPAINT:
+ hdc = GetDC(hDlg);
+ GetClientRect(hDlg, &rc);
+ Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
+ ReleaseDC(hDlg, hdc);
+ break;
+
+ case WM_PAINT:
+ hdc = BeginPaint(hDlg, &ps);
+ GetClientRect(hDlg, &rc);
+ Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
+ EndPaint(hDlg, &ps);
+ break;
+#endif
+ case WM_SIZE:
+ do {
+ int cx, cy;
+
+ if (wParam == SIZE_MINIMIZED)
+ return 0;
+
+ cx = LOWORD(lParam);
+ cy = HIWORD(lParam);
+ nXDifference = cx - nPerformancePageWidth;
+ nYDifference = cy - nPerformancePageHeight;
+ nPerformancePageWidth = cx;
+ nPerformancePageHeight = cy;
+ } while (0);
+
+ // Reposition the performance page's controls
+ AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0);
+ AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0);
+ AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0);
+ AdjustFrameSize(hPerformancePagePhysicalMemoryFrame, hDlg, 0, nYDifference, 0);
+ AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference);
+ AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT, hDlg, 0, nYDifference);
+
+ AdjustControlPostion(hPerformancePageCommitChargeTotalEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePageCommitChargeLimitEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePageCommitChargePeakEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePageKernelMemoryTotalEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePageKernelMemoryPagedEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePageKernelMemoryNonPagedEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePagePhysicalMemoryTotalEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePagePhysicalMemoryAvailableEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePagePhysicalMemorySystemCacheEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePageTotalsHandleCountEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePageTotalsProcessCountEdit, hDlg, 0, nYDifference);
+ AdjustControlPostion(hPerformancePageTotalsThreadCountEdit, hDlg, 0, nYDifference);
+
+ static int lastX, lastY;
+
+ nXDifference += lastX;
+ nYDifference += lastY;
+ lastX = lastY = 0;
+ if (nXDifference % 2) {
+ if (nXDifference > 0) {
+ nXDifference--;
+ lastX++;
+ } else {
+ nXDifference++;
+ lastX--;
+ }
+ }
+ if (nYDifference % 2) {
+ if (nYDifference > 0) {
+ nYDifference--;
+ lastY++;
+ } else {
+ nYDifference++;
+ lastY--;
+ }
+ }
+ AdjustFrameSize(hPerformancePageCpuUsageFrame, hDlg, nXDifference, nYDifference, 1);
+ AdjustFrameSize(hPerformancePageMemUsageFrame, hDlg, nXDifference, nYDifference, 2);
+ AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3);
+ AdjustFrameSize(hPerformancePageMemUsageHistoryFrame, hDlg, nXDifference, nYDifference, 4);
+ AdjustFrameSize(hPerformancePageCpuUsageGraph, hDlg, nXDifference, nYDifference, 1);
+ AdjustFrameSize(hPerformancePageMemUsageGraph, hDlg, nXDifference, nYDifference, 2);
+ AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3);
+ AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4);
+ break;
+ }
+ return 0;
+}
+
+void RefreshPerformancePage(void)
+{
+ // Signal the event so that our refresh thread
+ // will wake up and refresh the performance page
+ SetEvent(hPerformancePageEvent);
+}
+
+DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
+{
+ ULONG CommitChargeTotal;
+ ULONG CommitChargeLimit;
+ ULONG CommitChargePeak;
+
+ ULONG KernelMemoryTotal;
+ ULONG KernelMemoryPaged;
+ ULONG KernelMemoryNonPaged;
+
+ ULONG PhysicalMemoryTotal;
+ ULONG PhysicalMemoryAvailable;
+ ULONG PhysicalMemorySystemCache;
+
+ ULONG TotalHandles;
+ ULONG TotalThreads;
+ ULONG TotalProcesses;
+
+ TCHAR Text[260];
+
+ // Create the event
+ hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, _T("Performance Page Event"));
+
+ // If we couldn't create the event then exit the thread
+ if (!hPerformancePageEvent)
+ return 0;
+
+ while (1)
+ {
+ DWORD dwWaitVal;
+
+ // Wait on the event
+ dwWaitVal = WaitForSingleObject(hPerformancePageEvent, INFINITE);
+
+ // If the wait failed then the event object must have been
+ // closed and the task manager is exiting so exit this thread
+ if (dwWaitVal == WAIT_FAILED)
+ return 0;
+
+ if (dwWaitVal == WAIT_OBJECT_0)
+ {
+ // Reset our event
+ ResetEvent(hPerformancePageEvent);
+
+ //
+ // Update the commit charge info
+ //
+ CommitChargeTotal = PerfDataGetCommitChargeTotalK();
+ CommitChargeLimit = PerfDataGetCommitChargeLimitK();
+ CommitChargePeak = PerfDataGetCommitChargePeakK();
+ _ultot(CommitChargeTotal, Text, 10);
+ SetWindowText(hPerformancePageCommitChargeTotalEdit, Text);
+ _ultot(CommitChargeLimit, Text, 10);
+ SetWindowText(hPerformancePageCommitChargeLimitEdit, Text);
+ _ultot(CommitChargePeak, Text, 10);
+ SetWindowText(hPerformancePageCommitChargePeakEdit, Text);
+ wsprintf(Text, _T("Mem Usage: %dK / %dK"), CommitChargeTotal, CommitChargeLimit);
+ SendMessage(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text);
+
+ //
+ // Update the kernel memory info
+ //
+ KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
+ KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
+ KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
+ _ultot(KernelMemoryTotal, Text, 10);
+ SetWindowText(hPerformancePageKernelMemoryTotalEdit, Text);
+ _ultot(KernelMemoryPaged, Text, 10);
+ SetWindowText(hPerformancePageKernelMemoryPagedEdit, Text);
+ _ultot(KernelMemoryNonPaged, Text, 10);
+ SetWindowText(hPerformancePageKernelMemoryNonPagedEdit, Text);
+
+ //
+ // Update the physical memory info
+ //
+ PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
+ PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
+ PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
+ _ultot(PhysicalMemoryTotal, Text, 10);
+ SetWindowText(hPerformancePagePhysicalMemoryTotalEdit, Text);
+ _ultot(PhysicalMemoryAvailable, Text, 10);
+ SetWindowText(hPerformancePagePhysicalMemoryAvailableEdit, Text);
+ _ultot(PhysicalMemorySystemCache, Text, 10);
+ SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit, Text);
+
+ //
+ // Update the totals info
+ //
+ TotalHandles = PerfDataGetSystemHandleCount();
+ TotalThreads = PerfDataGetTotalThreadCount();
+ TotalProcesses = PerfDataGetProcessCount();
+ _ultot(TotalHandles, Text, 10);
+ SetWindowText(hPerformancePageTotalsHandleCountEdit, Text);
+ _ultot(TotalThreads, Text, 10);
+ SetWindowText(hPerformancePageTotalsThreadCountEdit, Text);
+ _ultot(TotalProcesses, Text, 10);
+ SetWindowText(hPerformancePageTotalsProcessCountEdit, Text);
+
+ //
+ // Redraw the graphs
+ //
+ InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE);
+ InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE);
+
+ //
+
+ ULONG CpuUsage;
+ ULONG CpuKernelUsage;
+ ULONGLONG CommitChargeTotal;
+ ULONGLONG CommitChargeLimit;
+ ULONG PhysicalMemoryTotal;
+ ULONG PhysicalMemoryAvailable;
+ int nBarsUsed1;
+ int nBarsUsed2;
+
+ //
+ // Get the CPU usage
+ //
+ CpuUsage = PerfDataGetProcessorUsage();
+ CpuKernelUsage = PerfDataGetProcessorSystemUsage();
+ if (CpuUsage < 0 ) CpuUsage = 0;
+ if (CpuUsage > 100) CpuUsage = 100;
+ if (CpuKernelUsage < 0) CpuKernelUsage = 0;
+ if (CpuKernelUsage > 100) CpuKernelUsage = 100;
+
+ //
+ // Get the memory usage
+ //
+ CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
+ CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
+ nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0;
+
+ PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
+ PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
+ nBarsUsed2 = PhysicalMemoryTotal ? ((PhysicalMemoryAvailable * 100) / PhysicalMemoryTotal) : 0;
+
+
+ GraphCtrl_AppendPoint(&PerformancePageCpuUsageHistoryGraph, CpuUsage, CpuKernelUsage, 0.0, 0.0);
+ GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph, nBarsUsed1, nBarsUsed2, 0.0, 0.0);
+ //PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ;
+ InvalidateRect(hPerformancePageMemUsageHistoryGraph, NULL, FALSE);
+ InvalidateRect(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE);
+ }
+ }
+ return 0;
+}
+
+void PerformancePage_OnViewShowKernelTimes(void)
+{
+ HMENU hMenu;
+ HMENU hViewMenu;
+
+ hMenu = GetMenu(hMainWnd);
+ hViewMenu = GetSubMenu(hMenu, 2);
+
+ // Check or uncheck the show 16-bit tasks menu item
+ if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & MF_CHECKED)
+ {
+ CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED);
+ TaskManagerSettings.ShowKernelTimes = FALSE;
+ }
+ else
+ {
+ CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED);
+ TaskManagerSettings.ShowKernelTimes = TRUE;
+ }
+
+ RefreshPerformancePage();
+}
+
+void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
+{
+ HMENU hMenu;
+ HMENU hViewMenu;
+ HMENU hCPUHistoryMenu;
+
+ hMenu = GetMenu(hMainWnd);
+ hViewMenu = GetSubMenu(hMenu, 2);
+ hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
+
+ TaskManagerSettings.CPUHistory_OneGraphPerCPU = FALSE;
+ CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND);
+}
+
+void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
+{
+ HMENU hMenu;
+ HMENU hViewMenu;
+ HMENU hCPUHistoryMenu;
+
+ hMenu = GetMenu(hMainWnd);
+ hViewMenu = GetSubMenu(hMenu, 2);
+ hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
+
+ TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE;
+ CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND);
+}
+
diff -u -N taskmgr.org/priority.c taskmgr/priority.c
--- taskmgr.org/priority.c 2002-09-10 04:06:10.000000000 +0200
+++ taskmgr/priority.c 2003-09-12 21:32:10.000000000 +0200
@@ -27,8 +27,8 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
+#include <winnt.h>
#include "taskmgr.h"
#include "priority.h"
diff -u -N taskmgr.org/proclist.c taskmgr/proclist.c
--- taskmgr.org/proclist.c 2002-09-24 16:22:48.000000000 +0200
+++ taskmgr/proclist.c 2003-09-12 21:32:09.000000000 +0200
@@ -27,8 +27,8 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
+#include <winnt.h>
#include "taskmgr.h"
#include "procpage.h"
diff -u -N taskmgr.org/procpage.c taskmgr/procpage.c
--- taskmgr.org/procpage.c 2002-09-10 04:06:10.000000000 +0200
+++ taskmgr/procpage.c 2003-09-12 21:50:05.000000000 +0200
@@ -27,8 +27,8 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
+#include <winnt.h>
#include "taskmgr.h"
#include "procpage.h"
@@ -52,7 +52,7 @@
void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam);
void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount);
void ProcessPageShowContextMenu(DWORD dwProcessId);
-void ProcessPageRefreshThread(void *lpParameter);
+DWORD WINAPI ProcessPageRefreshThread(void *lpParameter);
LRESULT CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
@@ -96,7 +96,7 @@
OldProcessListWndProc = SetWindowLong(hProcessPageListCtrl, GWL_WNDPROC, (LONG)ProcessListWndProc);
// Start our refresh thread
- _beginthread(ProcessPageRefreshThread, 0, NULL);
+ CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
return TRUE;
@@ -488,7 +488,7 @@
SetEvent(hProcessPageEvent);
}
-void ProcessPageRefreshThread(void *lpParameter)
+DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
{
ULONG OldProcessorUsage = 0;
ULONG OldProcessCount = 0;
@@ -498,7 +498,7 @@
// If we couldn't create the event then exit the thread
if (!hProcessPageEvent)
- return;
+ return 0;
while (1) {
DWORD dwWaitVal;
@@ -509,7 +509,7 @@
// If the wait failed then the event object must have been
// closed and the task manager is exiting so exit this thread
if (dwWaitVal == WAIT_FAILED)
- return;
+ return 0;
if (dwWaitVal == WAIT_OBJECT_0) {
TCHAR text[260];
@@ -535,4 +535,5 @@
}
}
}
+ return 0;
}
Common subdirectories: taskmgr.org/res and taskmgr/res
diff -u -N taskmgr.org/run.c taskmgr/run.c
--- taskmgr.org/run.c 2002-09-10 04:06:10.000000000 +0200
+++ taskmgr/run.c 2003-09-12 21:32:09.000000000 +0200
@@ -27,7 +27,6 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
#include "taskmgr.h"
diff -u -N taskmgr.org/taskmgr.c taskmgr/taskmgr.c
--- taskmgr.org/taskmgr.c 2003-01-15 21:55:30.000000000 +0100
+++ taskmgr/taskmgr.c 2003-09-13 11:40:53.000000000 +0200
@@ -8,8 +8,8 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
+#include <winnt.h>
#include "resource.h"
#include "taskmgr.h"
diff -u -N taskmgr.org/taskmgr.h taskmgr/taskmgr.h
--- taskmgr.org/taskmgr.h 2003-08-17 19:29:12.000000000 +0200
+++ taskmgr/taskmgr.h 2003-09-13 14:37:58.000000000 +0200
@@ -178,6 +178,12 @@
LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize );
+#ifdef WITH_WINE
+/* temporary work around for wine (in order not to link against msvcrt) */
+/* hopefully, noone uses a radix not equal to 10 */
+#define _ui64toa(ui,b,r) sprintf(b,"%llu",ui)
+#define _ultoa(lu,b,r) sprintf(b,"%lu",lu)
+#endif
#ifdef __cplusplus
};
diff -u -N taskmgr.org/taskmgr.rc taskmgr/taskmgr.rc
--- taskmgr.org/taskmgr.rc 2003-01-15 21:55:30.000000000 +0100
+++ taskmgr/taskmgr.rc 2003-09-13 14:41:23.000000000 +0200
@@ -198,7 +198,7 @@
STYLE DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP |
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU |
WS_THICKFRAME
-CAPTION "ReactOS Task Manager"
+CAPTION "Task Manager"
MENU IDR_TASKMANAGER
FONT 8, "Tahoma"
BEGIN
@@ -229,11 +229,11 @@
END
//IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
-IDD_PERFORMANCE_PAGE DIALOG DISCARDABLE 0, 0, 247, 210
+IDD_PERFORMANCE_PAGE DIALOGEX DISCARDABLE 0, 0, 247, 210
STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "Tahoma"
BEGIN
- GROUPBOX "CPU Usage",IDC_CPU_USAGE_FRAME,5,5,60,54,WS_TABSTOP, WS_EX_TRANSPARENT
+ GROUPBOX "CPU Usage",IDC_CPU_USAGE_FRAME,5,5,60,54,WS_TABSTOP,WS_EX_TRANSPARENT
GROUPBOX "MEM Usage",IDC_MEM_USAGE_FRAME,5,63,60,54,BS_LEFTTEXT, WS_EX_TRANSPARENT
GROUPBOX "Totals",IDC_TOTALS_FRAME,5,122,111,39,0,WS_EX_TRANSPARENT
GROUPBOX "Commit Charge (K)",IDC_COMMIT_CHARGE_FRAME,5,166,111,39,0,WS_EX_TRANSPARENT
@@ -278,7 +278,7 @@
GROUPBOX "CPU Usage History",IDC_CPU_USAGE_HISTORY_FRAME,74,5,168,54,0,WS_EX_TRANSPARENT
GROUPBOX "Memory Usage History",IDC_MEMORY_USAGE_HISTORY_FRAME,74,63,168,54,0,WS_EX_TRANSPARENT
PUSHBUTTON "CPU Usage Display",IDC_CPU_USAGE_GRAPH,12,17,47,37,0,
- WS_EX_CLIENTEDGE
+ WS_EX_CLIENTEDGE
PUSHBUTTON "MEM Usage Display",IDC_MEM_USAGE_GRAPH,12,75,47,37,0,
WS_EX_CLIENTEDGE
PUSHBUTTON "CPU Usage History",IDC_CPU_USAGE_HISTORY_GRAPH,81,17,
@@ -573,12 +573,12 @@
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Brian Palmer\0"
- VALUE "FileDescription", "ReactOS Task Manager by Brian Palmer\0"
+ VALUE "FileDescription", "Task Manager by Brian Palmer\0"
VALUE "FileVersion", "1.0.0.1\0"
VALUE "InternalName", "taskmgr\0"
VALUE "LegalCopyright", "Copyright © Brian Palmer 2000\0"
VALUE "OriginalFilename", "taskmgr.exe\0"
- VALUE "ProductName", "ReactOS Task Manager by Brian Palmer\0"
+ VALUE "ProductName", "Task Manager by Brian Palmer\0"
VALUE "ProductVersion", "1.0.0.1\0"
END
END
diff -u -N taskmgr.org/trayicon.c taskmgr/trayicon.c
--- taskmgr.org/trayicon.c 2002-09-10 04:07:02.000000000 +0200
+++ taskmgr/trayicon.c 2003-09-12 21:32:06.000000000 +0200
@@ -27,8 +27,8 @@
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
-#include <process.h>
#include <stdio.h>
+#include <winnt.h>
#include "taskmgr.h"
#include "trayicon.h"