Sync'ing remaining changes after recent CVS problems. Seem to now have my route back!

svn path=/trunk/; revision=3540
This commit is contained in:
Robert Dickenson 2002-09-24 14:22:48 +00:00
parent 5902c7241e
commit edfa8a7002
7 changed files with 928 additions and 880 deletions

View file

@ -181,15 +181,15 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
//
if (CpuUsage == 100)
{
_stprintf(Text, _T("%d%%"), CpuUsage);
_stprintf(Text, _T("%d%%"), (int)CpuUsage);
}
else if (CpuUsage < 10)
{
_stprintf(Text, _T(" %d%%"), CpuUsage);
_stprintf(Text, _T(" %d%%"), (int)CpuUsage);
}
else
{
_stprintf(Text, _T(" %d%%"), CpuUsage);
_stprintf(Text, _T(" %d%%"), (int)CpuUsage);
}
//
@ -347,7 +347,7 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
_stprintf(Text, _T("%dK"), CommitChargeTotal);
_stprintf(Text, _T("%dK"), (int)CommitChargeTotal);
//
// Draw the font text onto the graph

View file

@ -4,6 +4,7 @@
# Makefile
#
# Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
# 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
@ -19,77 +20,86 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
PATH_TO_TOP = ..
TARGET = taskmgr
BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400
RCFLAGS = -DGCC -D_WIN32_IE=0x0400
#export CPP = g++
#export LD = ld
#export AR = ar
#export RM = cmd /C del
#export CP = cmd /C copy
OBJS = about.o \
affinity.o \
applpage.o \
column.o \
debug.o \
endproc.o \
font.o \
graph.o \
optnmenu.o \
perfdata.o \
perfpage.o \
priority.o \
procpage.o \
proclist.o \
run.o \
trayicon.o \
taskmgr.o \
graphctl.o
FLAGS = -D_WIN32_IE=0x0400 -g
OBJS = about.o affinity.o applpage.o column.o debug.o endproc.o font.o \
graph.o optnmenu.o perfdata.o perfpage.o priority.o procpage.o \
proclist.o run.o trayicon.o taskmgr.o
LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32
all: taskmgr.exe
taskmgr.exe: $(OBJS)
$(CPP) -g -o taskmgr.exe $(OBJS) $(LIBS)
taskmgr.res: taskmgr.rc
about.o: about.c about.h
$(CPP) $(FLAGS) -o about.o -c about.c
taskmgr.exe: $(OBJS) taskmgr.coff
$(CPP) -Wl,--subsystem,windows -o taskmgr.exe $(OBJS) taskmgr.coff $(LIBS)
$(NM) --numeric-sort taskmgr.exe > taskmgr.sym
about.o: about.c about.h resource.h
affinity.o: affinity.c affinity.h
$(CPP) $(FLAGS) -o affinity.o -c affinity.c
applpage.o: applpage.c applpage.h
$(CPP) $(FLAGS) -o applpage.o -c applpage.c
applpage.o: applpage.c applpage.h procpage.h taskmgr.h resource.h
column.o: column.c column.h
$(CPP) $(FLAGS) -o column.o -c column.c
column.o: column.c column.h resource.h
debug.o: debug.c debug.h
$(CPP) $(FLAGS) -o debug.o -c debug.c
endproc.o: endproc.c endproc.h
$(CPP) $(FLAGS) -o endproc.o -c endproc.c
font.o: font.c font.h
$(CPP) $(FLAGS) -o font.o -c font.c
font.o: font.c font.h
graph.o: graph.c graph.h
$(CPP) $(FLAGS) -o graph.o -c graph.c
graph.o: graph.c graph.h resource.h
optnmenu.o: optnmenu.c optnmenu.h
$(CPP) $(FLAGS) -o optnmenu.o -c optnmenu.c
graphctl.o: graphctl.cpp graphctl.h resource.h
optnmenu.o: optnmenu.c optnmenu.h resource.h
perfdata.o: perfdata.c perfdata.h
$(CPP) $(FLAGS) -o perfdata.o -c perfdata.c
perfpage.o: perfpage.cpp perfpage.h
$(CPP) $(FLAGS) -o perfpage.o -c perfpage.cpp
perfpage.o: perfpage.cpp perfpage.h perfdata.h graphctl.h graph.h taskmgr.h resource.h
priority.o: priority.c priority.h
$(CPP) $(FLAGS) -o priority.o -c priority.c
procpage.o: procpage.c procpage.h
$(CPP) $(FLAGS) -o procpage.o -c procpage.c
procpage.o: procpage.c procpage.h perfdata.h column.h proclist.h taskmgr.h resource.h
proclist.o: proclist.c proclist.h
$(CPP) $(FLAGS) -o proclist.o -c proclist.c
run.o: run.c run.h
$(CPP) $(FLAGS) -o run.o -c run.c
run.o: run.c run.h
trayicon.o: trayicon.c trayicon.h
$(CPP) $(FLAGS) -o trayicon.o -c trayicon.c
trayicon.o: trayicon.c trayicon.h resource.h
taskmgr.o: taskmgr.c taskmgr.h
$(CPP) $(FLAGS) -o taskmgr.o -c taskmgr.c
taskmgr.o: taskmgr.c taskmgr.h resource.h
clean:
- $(RM) $(OBJS)
- $(RM) taskmgr.exe
- $(RM) taskmgr.sym
- $(RM) taskmgr.coff
include $(PATH_TO_TOP)/rules.mak

View file

@ -44,9 +44,9 @@ ULONG ProcessCount = 0;
double dbIdleTime;
double dbKernelTime;
double dbSystemTime;
LARGE_INTEGER liOldIdleTime = {0,0};
LARGE_INTEGER liOldIdleTime = {{0,0}};
double OldKernelTime = 0;
LARGE_INTEGER liOldSystemTime = {0,0};
LARGE_INTEGER liOldSystemTime = {{0,0}};
SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo;
SYSTEM_BASIC_INFORMATION SystemBasicInfo;
SYSTEM_CACHE_INFORMATION SystemCacheInfo;
@ -441,7 +441,7 @@ ULONG PerfDataGetCPUUsage(ULONG Index)
TIME PerfDataGetCPUTime(ULONG Index)
{
TIME CpuTime = {0,0};
TIME CpuTime = {{0,0}};
EnterCriticalSection(&PerfDataCriticalSection);

View file

@ -119,4 +119,4 @@ LRESULT CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
// We pass on all messages except WM_ERASEBKGND
//
return CallWindowProc((WNDPROC)OldProcessListWndProc, hWnd, message, wParam, lParam);
}
}

View file

@ -98,7 +98,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
#define _USE_CMD_MAP
#ifdef _USE_CMD_MAP
#define BEGIN_CMD_MAP(a) switch(##a) {
#define BEGIN_CMD_MAP(a) switch( ##a ) {
#define CMD_MAP_ENTRY(a, b) case a: b(); break;
#define END_CMD_MAP(a) }
@ -126,7 +126,7 @@ LRESULT CALLBACK TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
return TRUE;
}
#ifdef _USE_CMD_MAP
BEGIN_CMD_MAP(LOWORD(wParam))
BEGIN_CMD_MAP( LOWORD(wParam) )
CMD_MAP_ENTRY(ID_FILE_NEW, TaskManager_OnFileNew)
CMD_MAP_ENTRY(ID_OPTIONS_ALWAYSONTOP, TaskManager_OnOptionsAlwaysOnTop)
CMD_MAP_ENTRY(ID_OPTIONS_MINIMIZEONUSE, TaskManager_OnOptionsMinimizeOnUse)
@ -1012,7 +1012,7 @@ void TaskManager_OnTabWndSelChange(void)
}
}
LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize )
LPTSTR GetLastErrorText(LPTSTR lpszBuf, DWORD dwSize)
{
DWORD dwRet;
LPTSTR lpszTemp = NULL;
@ -1026,11 +1026,11 @@ LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize )
NULL );
// supplied buffer is not long enough
if (!dwRet || ( (long)dwSize < (long)dwRet+14 )) {
if (!dwRet || ( (long)dwSize < (long)dwRet+14)) {
lpszBuf[0] = TEXT('\0');
} else {
lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); //remove cr and newline character
_stprintf(lpszBuf, TEXT("%s (0x%x)"), lpszTemp, GetLastError() );
_stprintf(lpszBuf, TEXT("%s (0x%x)"), lpszTemp, (int)GetLastError());
}
if (lpszTemp) {
LocalFree((HLOCAL)lpszTemp);

View file

@ -1,140 +1,173 @@
/*
* ReactOS Task Manager
*
* taskmgr.h
*
* 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.
*/
#if !defined(AFX_TASKMGR_H__392F6393_0279_11D3_9C02_004005E27102__INCLUDED_)
#define AFX_TASKMGR_H__392F6393_0279_11D3_9C02_004005E27102__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "resource.h"
#define STATUS_WINDOW 2001
typedef struct
{
// Window size & position settings
BOOL Maximized;
int Left;
int Top;
int Right;
int Bottom;
// Tab settings
int ActiveTabPage;
// Options menu settings
BOOL AlwaysOnTop;
BOOL MinimizeOnUse;
BOOL HideWhenMinimized;
BOOL Show16BitTasks;
// Update speed settings
int UpdateSpeed; // How many half-seconds in between updates (i.e. 0 - Paused, 1 - High, 2 - Normal, 4 - Low)
// Applications page settings
BOOL View_LargeIcons;
BOOL View_SmallIcons;
BOOL View_Details;
// Processes page settings
BOOL ShowProcessesFromAllUsers; // Server-only?
BOOL Column_ImageName;
BOOL Column_PID;
BOOL Column_CPUUsage;
BOOL Column_CPUTime;
BOOL Column_MemoryUsage;
BOOL Column_MemoryUsageDelta;
BOOL Column_PeakMemoryUsage;
BOOL Column_PageFaults;
BOOL Column_USERObjects;
BOOL Column_IOReads;
BOOL Column_IOReadBytes;
BOOL Column_SessionID; // Server-only?
BOOL Column_UserName; // Server-only?
BOOL Column_PageFaultsDelta;
BOOL Column_VirtualMemorySize;
BOOL Column_PagedPool;
BOOL Column_NonPagedPool;
BOOL Column_BasePriority;
BOOL Column_HandleCount;
BOOL Column_ThreadCount;
BOOL Column_GDIObjects;
BOOL Column_IOWrites;
BOOL Column_IOWriteBytes;
BOOL Column_IOOther;
BOOL Column_IOOtherBytes;
int ColumnOrderArray[25];
int ColumnSizeArray[25];
int SortColumn;
BOOL SortAscending;
// Performance page settings
BOOL CPUHistory_OneGraphPerCPU;
BOOL ShowKernelTimes;
} TASKMANAGER_SETTINGS, *LPTASKMANAGER_SETTINGS;
// Global Variables:
extern HINSTANCE hInst; // current instance
extern HWND hMainWnd; // Main Window
extern HWND hStatusWnd; // Status Bar Window
extern HWND hTabWnd; // Tab Control Window
extern int nMinimumWidth; // Minimum width of the dialog (OnSize()'s cx)
extern int nMinimumHeight; // Minimum height of the dialog (OnSize()'s cy)
extern int nOldWidth; // Holds the previous client area width
extern int nOldHeight; // Holds the previous client area height
extern TASKMANAGER_SETTINGS TaskManagerSettings;
// Foward declarations of functions included in this code module:
LRESULT CALLBACK TaskManagerWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL OnCreate(HWND hWnd);
void OnSize( UINT nType, int cx, int cy );
void FillSolidRect(HDC hDC, LPCRECT lpRect, COLORREF clr);
void FillSolidRect(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);
void Draw3dRect(HDC hDC, LPRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight);
void LoadSettings(void);
void SaveSettings(void);
void TaskManager_OnEnterMenuLoop(HWND hWnd);
void TaskManager_OnExitMenuLoop(HWND hWnd);
void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu);
void TaskManager_OnViewUpdateSpeedHigh(void);
void TaskManager_OnViewUpdateSpeedNormal(void);
void TaskManager_OnViewUpdateSpeedLow(void);
void TaskManager_OnViewUpdateSpeedPaused(void);
void TaskManager_OnTabWndSelChange(void);
LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize );
#endif // !defined(AFX_TASKMGR_H__392F6393_0279_11D3_9C02_004005E27102__INCLUDED_)
/*
* ReactOS Task Manager
*
* taskmgr.h
*
* 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.
*/
#ifndef __TASKMGR_H__
#define __TASKMGR_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MSC_VER
typedef struct _IO_COUNTERS {
ULONGLONG ReadOperationCount;
ULONGLONG WriteOperationCount;
ULONGLONG OtherOperationCount;
ULONGLONG ReadTransferCount;
ULONGLONG WriteTransferCount;
ULONGLONG OtherTransferCount;
} IO_COUNTERS, *PIO_COUNTERS;
#else
#if __MINGW32_MAJOR_VERSION == 1
#define HDITEM HD_ITEM
#define LPNMLISTVIEW LPNM_LISTVIEW
#define HDN_ENDDRAG TBN_ENDDRAG
#define LVSICF_NOSCROLL LVS_NOSCROLL
#define HDM_GETORDERARRAY (HDM_FIRST+19) // TODO: FIX ME
#endif
#endif
#include "resource.h"
#define RUN_APPS_PAGE
#define RUN_PROC_PAGE
#define RUN_PERF_PAGE
#define STATUS_WINDOW 2001
typedef struct
{
// Window size & position settings
BOOL Maximized;
int Left;
int Top;
int Right;
int Bottom;
// Tab settings
int ActiveTabPage;
// Options menu settings
BOOL AlwaysOnTop;
BOOL MinimizeOnUse;
BOOL HideWhenMinimized;
BOOL Show16BitTasks;
// Update speed settings
int UpdateSpeed; // How many half-seconds in between updates (i.e. 0 - Paused, 1 - High, 2 - Normal, 4 - Low)
// Applications page settings
BOOL View_LargeIcons;
BOOL View_SmallIcons;
BOOL View_Details;
// Processes page settings
BOOL ShowProcessesFromAllUsers; // Server-only?
BOOL Column_ImageName;
BOOL Column_PID;
BOOL Column_CPUUsage;
BOOL Column_CPUTime;
BOOL Column_MemoryUsage;
BOOL Column_MemoryUsageDelta;
BOOL Column_PeakMemoryUsage;
BOOL Column_PageFaults;
BOOL Column_USERObjects;
BOOL Column_IOReads;
BOOL Column_IOReadBytes;
BOOL Column_SessionID; // Server-only?
BOOL Column_UserName; // Server-only?
BOOL Column_PageFaultsDelta;
BOOL Column_VirtualMemorySize;
BOOL Column_PagedPool;
BOOL Column_NonPagedPool;
BOOL Column_BasePriority;
BOOL Column_HandleCount;
BOOL Column_ThreadCount;
BOOL Column_GDIObjects;
BOOL Column_IOWrites;
BOOL Column_IOWriteBytes;
BOOL Column_IOOther;
BOOL Column_IOOtherBytes;
int ColumnOrderArray[25];
int ColumnSizeArray[25];
int SortColumn;
BOOL SortAscending;
// Performance page settings
BOOL CPUHistory_OneGraphPerCPU;
BOOL ShowKernelTimes;
} TASKMANAGER_SETTINGS, *LPTASKMANAGER_SETTINGS;
// Global Variables:
extern HINSTANCE hInst; // current instance
extern HWND hMainWnd; // Main Window
extern HWND hStatusWnd; // Status Bar Window
extern HWND hTabWnd; // Tab Control Window
extern int nMinimumWidth; // Minimum width of the dialog (OnSize()'s cx)
extern int nMinimumHeight; // Minimum height of the dialog (OnSize()'s cy)
extern int nOldWidth; // Holds the previous client area width
extern int nOldHeight; // Holds the previous client area height
extern TASKMANAGER_SETTINGS TaskManagerSettings;
// Foward declarations of functions included in this code module:
LRESULT 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 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);
void Draw3dRect2(HDC hDC, LPRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight);
void LoadSettings(void);
void SaveSettings(void);
void TaskManager_OnEnterMenuLoop(HWND hWnd);
void TaskManager_OnExitMenuLoop(HWND hWnd);
void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu);
void TaskManager_OnViewUpdateSpeedHigh(void);
void TaskManager_OnViewUpdateSpeedNormal(void);
void TaskManager_OnViewUpdateSpeedLow(void);
void TaskManager_OnViewUpdateSpeedPaused(void);
void TaskManager_OnViewRefresh(void);
void TaskManager_OnTabWndSelChange(void);
LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize );
#ifdef __cplusplus
};
#endif
#endif // __TASKMGR_H__

File diff suppressed because it is too large Load diff