Hervé Poussineau <hpoussineau@fr.st>

Add localization to ctm

svn path=/trunk/; revision=13057
This commit is contained in:
Gé van Geldorp 2005-01-15 15:28:51 +00:00
parent 274efb4364
commit e3ea6fc396
5 changed files with 279 additions and 113 deletions

View file

@ -0,0 +1,31 @@
// English (U.S.) resources
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Console TaskManager v0.1 by Aleksey Bragin <aleksey@studiocerebral.com>"
IDS_COLUMN_IMAGENAME "Image name "
IDS_COLUMN_PID "PID "
IDS_COLUMN_CPU "CPU"
IDS_COLUMN_MEM "Mem Usage"
IDS_COLUMN_MEM_UNIT "Kb"
IDS_COLUMN_PF "Page Faults"
IDS_IDLE_PROCESS "System Idle Process"
IDS_YES "y"
IDS_NO "n"
IDS_MENU "Press: q - quit, k - kill process"
IDS_MENU_QUIT "q"
IDS_MENU_KILL_PROCESS "k"
IDS_KILL_PROCESS "Are you sure you want to kill this process? (y/n)"
IDS_KILL_PROCESS_ERR1 "Unable to terminate this process..."
IDS_KILL_PROCESS_ERR2 "Unable to terminate process %3d (unable to OpenProcess)"
IDS_CTM_GENERAL_ERR1 "ctm: can't use console."
IDS_CTM_GENERAL_ERR2 "ctm: can't GetConsoleMode() for input console."
IDS_CTM_GENERAL_ERR3 "ctm: can't GetConsoleMode() for output console."
END

View file

@ -0,0 +1,31 @@
// French (France) resources
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Console TaskManager v0.1 par Aleksey Bragin <aleksey@studiocerebral.com>"
IDS_COLUMN_IMAGENAME "Processus "
IDS_COLUMN_PID "PID "
IDS_COLUMN_CPU "CPU"
IDS_COLUMN_MEM "Util. mém"
IDS_COLUMN_MEM_UNIT "Ko"
IDS_COLUMN_PF "Défauts de page"
IDS_IDLE_PROCESS "Processus inactif du système"
IDS_YES "O"
IDS_NO "N"
IDS_MENU "Menu: Quitter (q), Tuer processus (t)"
IDS_MENU_QUIT "Q"
IDS_MENU_KILL_PROCESS "T"
IDS_KILL_PROCESS "Etes-vous sûr de vouloir tuer ce processus (o/n) ?"
IDS_KILL_PROCESS_ERR1 "Impossible de terminer ce processus..."
IDS_KILL_PROCESS_ERR2 "Impossible de terminer le processus %3d (erreur lors de OpenProcess)"
IDS_CTM_GENERAL_ERR1 "ctm: impossible d'utiliser la console."
IDS_CTM_GENERAL_ERR2 "ctm: impossible de récupérer les paramètres de la console d'entrée."
IDS_CTM_GENERAL_ERR3 "ctm: impossible de récupérer les paramètres de la console de sortie."
END

View file

@ -1,3 +1,6 @@
#define UNICODE
#define _UNICODE
/* Console Task Manager /* Console Task Manager
ctm.c - main program file ctm.c - main program file
@ -7,7 +10,10 @@
Most of the code dealing with getting system parameters is taken from Most of the code dealing with getting system parameters is taken from
ReactOS Task Manager written by Brian Palmer (brianp@reactos.org) ReactOS Task Manager written by Brian Palmer (brianp@reactos.org)
Localization features added by Hervé Poussineau (hpoussineau@fr.st)
History: History:
24 October 2004 - added localization features
09 April 2003 - v0.1, fixed bugs, added features, ported to mingw 09 April 2003 - v0.1, fixed bugs, added features, ported to mingw
20 March 2003 - v0.03, works good under ReactOS, and allows process 20 March 2003 - v0.03, works good under ReactOS, and allows process
killing killing
@ -42,17 +48,30 @@
#include <ntos/zwtypes.h> #include <ntos/zwtypes.h>
#include "ctm.h" #include "ctm.h"
#include "resource.h"
#define MAX_PROC 17 #define MAX_PROC 17
#define TIMES #define TIMES
HANDLE hStdin; HANDLE hStdin;
HANDLE hStdout; HANDLE hStdout;
HINSTANCE hInst;
DWORD inConMode; DWORD inConMode;
DWORD outConMode; DWORD outConMode;
//PROCNTQSI NtQuerySystemInformation= NULL; DWORD columnRightPositions[5];
TCHAR lpSeparator[80];
TCHAR lpHeader[80];
TCHAR lpMemUnit[3];
TCHAR lpIdleProcess[80];;
TCHAR lpTitle[80];
TCHAR lpHeader[80];
TCHAR lpMenu[80];
TCHAR lpEmpty[80];
TCHAR KEY_QUIT, KEY_KILL;
TCHAR KEY_YES, KEY_NO;
const int ProcPerScreen = 17; // 17 processess are displayed on one page const int ProcPerScreen = 17; // 17 processess are displayed on one page
ULONG ProcessCountOld = 0; ULONG ProcessCountOld = 0;
@ -70,9 +89,11 @@ PPERFDATA pPerfData = NULL; // Most recent copy of perf data
int selection=0; int selection=0;
int scrolled=0; // offset from which process start showing int scrolled=0; // offset from which process start showing
int first = 0; // first time in DisplayScreen
#define NEW_CONSOLE #define NEW_CONSOLE
// Functions that are needed by epsapi
void *PsaiMalloc(SIZE_T size) { return malloc(size); } void *PsaiMalloc(SIZE_T size) { return malloc(size); }
void *PsaiRealloc(void *ptr, SIZE_T size) { return realloc(ptr, size); } void *PsaiRealloc(void *ptr, SIZE_T size) { return realloc(ptr, size); }
void PsaiFree(void *ptr) { free(ptr); } void PsaiFree(void *ptr) { free(ptr); }
@ -120,37 +141,31 @@ void DisplayScreen()
int posStr; int posStr;
DWORD numChars; DWORD numChars;
int lines; int lines;
int idx; int idx, i;
static int first = 0;
if (first == 0) if (first == 0)
{ {
// Header // Header
pos.X = 2; pos.Y = 2; pos.X = 2; pos.Y = 2;
_tcscpy(lpStr, _T("Console TaskManager v0.1 by Aleksey Bragin <aleksey@studiocerebral.com>")); WriteConsoleOutputCharacter(hStdout, lpTitle, _tcslen(lpTitle), pos, &numChars);
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
pos.X = 2; pos.Y = 3; pos.X = 2; pos.Y = 3;
_tcscpy(lpStr, _T("+-------------------------------+-------+-----+-----------+-------------+")); WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars);
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
pos.X = 2; pos.Y = 4; pos.X = 2; pos.Y = 4;
_tcscpy(lpStr, _T("| Image name | PID | CPU | Mem Usage | Page Faults |")); WriteConsoleOutputCharacter(hStdout, lpHeader, _tcslen(lpHeader), pos, &numChars);
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
pos.X = 2; pos.Y = 5; pos.X = 2; pos.Y = 5;
_tcscpy(lpStr, _T("+-------------------------------+-------+-----+-----------+-------------+")); WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars);
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
// Footer // Footer
pos.X = 2; pos.Y = 23; pos.X = 2; pos.Y = ProcPerScreen+6;
_tcscpy(lpStr, _T("+-------------------------------+-------+-----+-----------+-------------+")); WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars);
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
// Menu // Menu
pos.X = 2; pos.Y = 24; pos.X = 2; pos.Y = ProcPerScreen+7;
_tcscpy(lpStr, _T("Press: q - quit, k - kill process ")); WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars);
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); WriteConsoleOutputCharacter(hStdout, lpMenu, _tcslen(lpMenu), pos, &numChars);
first = 1; first = 1;
} }
@ -169,10 +184,13 @@ void DisplayScreen()
TCHAR lpPageFaults[15]; TCHAR lpPageFaults[15];
WORD wColor; WORD wColor;
for (i = 0; i < 80; i++)
lpStr[i] = _T(' ');
// data // data
// image name
if (idx < lines && scrolled + idx < ProcessCount) if (idx < lines && scrolled + idx < ProcessCount)
{ {
// image name
#ifdef _UNICODE #ifdef _UNICODE
len = wcslen(pPerfData[scrolled+idx].ImageName); len = wcslen(pPerfData[scrolled+idx].ImageName);
#else #else
@ -180,77 +198,40 @@ void DisplayScreen()
imgName, MAX_PATH, NULL, NULL); imgName, MAX_PATH, NULL, NULL);
len = strlen(imgName); len = strlen(imgName);
#endif #endif
if (len > 31) if (len > columnRightPositions[0])
{ {
len = 31; len = columnRightPositions[0];
} }
#ifdef _UNICODE #ifdef _UNICODE
wcsncpy(&lpStr[2], pPerfData[scrolled+idx].ImageName, len); wcsncpy(&lpStr[2], pPerfData[scrolled+idx].ImageName, len);
#else #else
strncpy(&lpStr[2], imgName, len); strncpy(&lpStr[2], imgName, len);
#endif #endif
}
else
{
len = 0;
}
if (len < 31)
{
_tcsncpy(&lpStr[2 + len], _T(" "), 31 - len);
}
// PID // PID
if (idx < lines && scrolled + idx < ProcessCount) _stprintf(lpPid, _T("%6ld"), pPerfData[scrolled+idx].ProcessId);
{ _tcsncpy(&lpStr[columnRightPositions[1] - 6], lpPid, 6);
_stprintf(lpPid, _T("%6ld "), pPerfData[scrolled+idx].ProcessId);
_tcsncpy(&lpStr[34], lpPid, 7);
}
else
{
_tcsncpy(&lpStr[34], _T(" "), 7);
}
#ifdef TIMES
// CPU // CPU
if (idx < lines && scrolled + idx < ProcessCount) _stprintf(lpCpu, _T("%3d%%"), pPerfData[scrolled+idx].CPUUsage);
{ _tcsncpy(&lpStr[columnRightPositions[2] - 4], lpCpu, 4);
_stprintf(lpCpu, _T("%3d%% "), pPerfData[scrolled+idx].CPUUsage); #endif
_tcsncpy(&lpStr[42], lpCpu, 5);
}
else
{
_tcsncpy(&lpStr[42], _T(" "), 5);
}
// Mem usage // Mem usage
if (idx < lines && scrolled + idx < ProcessCount) _stprintf(lpMemUsg, _T("%6ld %s"), pPerfData[scrolled+idx].WorkingSetSizeBytes / 1024, lpMemUnit);
{ _tcsncpy(&lpStr[columnRightPositions[3] - 9], lpMemUsg, 9);
_stprintf(lpMemUsg, _T("%6ld "), pPerfData[scrolled+idx].WorkingSetSizeBytes / 1024);
_tcsncpy(&lpStr[48], lpMemUsg, 11);
}
else
{
_tcsncpy(&lpStr[48], _T(" "), 11);
}
// Page Fault // Page Fault
if (idx < lines && scrolled + idx < ProcessCount) _stprintf(lpPageFaults, _T("%12ld"), pPerfData[scrolled+idx].PageFaultCount);
{ _tcsncpy(&lpStr[columnRightPositions[4] - 12], lpPageFaults, 12);
_stprintf(lpPageFaults, _T("%12ld "), pPerfData[scrolled+idx].PageFaultCount);
_tcsncpy(&lpStr[60], lpPageFaults, 13);
}
else
{
_tcsncpy(&lpStr[60], _T(" "), 13);
} }
// columns // columns
lpStr[0] = _T(' '); lpStr[0] = _T(' ');
lpStr[1] = _T('|'); lpStr[1] = _T('|');
lpStr[33] = _T('|'); for (i = 0; i < 5; i++)
lpStr[41] = _T('|'); lpStr[columnRightPositions[i] + 1] = _T('|');
lpStr[47] = _T('|');
lpStr[59] = _T('|');
lpStr[73] = _T('|');
pos.X = 1; pos.Y = 6+idx; pos.X = 1; pos.Y = 6+idx;
WriteConsoleOutputCharacter(hStdout, lpStr, 74, pos, &numChars); WriteConsoleOutputCharacter(hStdout, lpStr, 74, pos, &numChars);
@ -274,7 +255,7 @@ void DisplayScreen()
FillConsoleOutputAttribute( FillConsoleOutputAttribute(
hStdout, // screen buffer handle hStdout, // screen buffer handle
wColor, // color to fill with wColor, // color to fill with
31, // number of cells to fill columnRightPositions[0] - 1, // number of cells to fill
pos, // first cell to write to pos, // first cell to write to
&numChars); // actual number written &numChars); // actual number written
} }
@ -285,13 +266,14 @@ void DisplayScreen()
// returns TRUE if exiting // returns TRUE if exiting
int ProcessKeys(int numEvents) int ProcessKeys(int numEvents)
{ {
DWORD numChars;
if ((ProcessCount-scrolled < 17) && (ProcessCount > 17)) if ((ProcessCount-scrolled < 17) && (ProcessCount > 17))
scrolled = ProcessCount-17; scrolled = ProcessCount-17;
TCHAR key = GetKeyPressed(numEvents); TCHAR key = GetKeyPressed(numEvents);
if (key == VK_Q) if (key == KEY_QUIT)
return TRUE; return TRUE;
else if (key == VK_K) else if (key == KEY_KILL)
{ {
// user wants to kill some process, get his acknowledgement // user wants to kill some process, get his acknowledgement
DWORD pId; DWORD pId;
@ -299,15 +281,15 @@ int ProcessKeys(int numEvents)
TCHAR lpStr[100]; TCHAR lpStr[100];
pos.X = 2; pos.Y = 24; pos.X = 2; pos.Y = 24;
_tcscpy(lpStr, _T("Are you sure you want to kill this process? (y/n)")); if (LoadString(hInst, IDS_KILL_PROCESS, lpStr, 100))
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &pId); WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
do { do {
GetNumberOfConsoleInputEvents(hStdin, &pId); GetNumberOfConsoleInputEvents(hStdin, &pId);
key = GetKeyPressed(pId); key = GetKeyPressed(pId);
} while (key == 0); } while (key == 0);
if (key == VK_Y) if (key == KEY_YES)
{ {
HANDLE hProcess; HANDLE hProcess;
pId = pPerfData[selection+scrolled].ProcessId; pId = pPerfData[selection+scrolled].ProcessId;
@ -317,8 +299,11 @@ int ProcessKeys(int numEvents)
{ {
if (!TerminateProcess(hProcess, 0)) if (!TerminateProcess(hProcess, 0))
{ {
_tcscpy(lpStr, _T("Unable to terminate this process... ")); if (LoadString(hInst, IDS_KILL_PROCESS_ERR1, lpStr, 80))
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &pId); {
WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars);
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
}
Sleep(1000); Sleep(1000);
} }
@ -326,11 +311,17 @@ int ProcessKeys(int numEvents)
} }
else else
{ {
_stprintf(lpStr, _T("Unable to terminate process %3d (unable to OpenProcess) "), pId); if (LoadString(hInst, IDS_KILL_PROCESS_ERR2, lpStr, 80))
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &pId); {
WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars);
_stprintf(lpStr, lpStr, pId);
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
}
Sleep(1000); Sleep(1000);
} }
} }
first = 0;
} }
else if (key == VK_UP) else if (key == VK_UP)
{ {
@ -350,11 +341,6 @@ int ProcessKeys(int numEvents)
return FALSE; return FALSE;
} }
void PerfInit()
{
// NtQuerySystemInformation = //(PROCNTQSI)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), //"NtQuerySystemInformation");
}
void PerfDataRefresh() void PerfDataRefresh()
{ {
LONG status; LONG status;
@ -435,11 +421,9 @@ void PerfDataRefresh()
// Now alloc a new PERFDATA array and fill in the data // Now alloc a new PERFDATA array and fill in the data
if (pPerfDataOld) { if (pPerfDataOld) {
//delete[] pPerfDataOld;
free(pPerfDataOld); free(pPerfDataOld);
} }
pPerfDataOld = pPerfData; pPerfDataOld = pPerfData;
//pPerfData = new PERFDATA[ProcessCount];
pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount); pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount);
pSPI = PsaWalkFirstProcess((PSYSTEM_PROCESSES)pBuffer); pSPI = PsaWalkFirstProcess((PSYSTEM_PROCESSES)pBuffer);
for (Idx=0; Idx<ProcessCount; Idx++) { for (Idx=0; Idx<ProcessCount; Idx++) {
@ -461,7 +445,13 @@ void PerfDataRefresh()
pPerfData[Idx].ImageName[pSPI->ProcessName.Length / sizeof(WCHAR)] = 0; pPerfData[Idx].ImageName[pSPI->ProcessName.Length / sizeof(WCHAR)] = 0;
} }
else else
wcscpy(pPerfData[Idx].ImageName, L"System Idle Process"); {
#ifdef _UNICODE
wcscpy(pPerfData[Idx].ImageName, lpIdleProcess);
#else
MultiByteToWideChar(CP_ACP, 0, lpIdleProcess, strlen(lpIdleProcess), pPerfData[Idx].ImageName, MAX_PATH);
#endif
}
pPerfData[Idx].ProcessId = pSPI->ProcessId; pPerfData[Idx].ProcessId = pSPI->ProcessId;
@ -531,7 +521,6 @@ int MultiByteToWideChar(
#endif #endif
pSPI = PsaWalkNextProcess(pSPI); pSPI = PsaWalkNextProcess(pSPI);
} }
//delete[] pBuffer;
PsaFreeCapture(pBuffer); PsaFreeCapture(pBuffer);
free(SysProcessorTimeInfo); free(SysProcessorTimeInfo);
@ -565,31 +554,96 @@ unsigned int GetKeyPressed(int events)
int main(int *argc, char **argv) int main(int *argc, char **argv)
{ {
int i;
TCHAR lpStr[80];
for (i = 0; i < 80; i++)
lpEmpty[i] = lpHeader[i] = _T(' ');
lpEmpty[79] = _T('\0');
/* Initialize global variables */
hInst = 0 /* FIXME: which value? [used with LoadString(hInst, ..., ..., ...)] */;
if (LoadString(hInst, IDS_COLUMN_IMAGENAME, lpStr, 80))
{
columnRightPositions[0] = _tcslen(lpStr);
_tcsncpy(&lpHeader[2], lpStr, _tcslen(lpStr));
}
if (LoadString(hInst, IDS_COLUMN_PID, lpStr, 80))
{
columnRightPositions[1] = columnRightPositions[0] + _tcslen(lpStr) + 3;
_tcsncpy(&lpHeader[columnRightPositions[0] + 2], lpStr, _tcslen(lpStr));
}
if (LoadString(hInst, IDS_COLUMN_CPU, lpStr, 80))
{
columnRightPositions[2] = columnRightPositions[1] + _tcslen(lpStr) + 3;
_tcsncpy(&lpHeader[columnRightPositions[1] + 2], lpStr, _tcslen(lpStr));
}
if (LoadString(hInst, IDS_COLUMN_MEM, lpStr, 80))
{
columnRightPositions[3] = columnRightPositions[2] + _tcslen(lpStr) + 3;
_tcsncpy(&lpHeader[columnRightPositions[2] + 2], lpStr, _tcslen(lpStr));
}
if (LoadString(hInst, IDS_COLUMN_PF, lpStr, 80))
{
columnRightPositions[4] = columnRightPositions[3] + _tcslen(lpStr) + 3;
_tcsncpy(&lpHeader[columnRightPositions[3] + 2], lpStr, _tcslen(lpStr));
}
for (i = 0; i < columnRightPositions[4]; i++)
lpSeparator[i] = _T('-');
lpHeader[0] = _T('|');
lpSeparator[0] = _T('+');
for (i = 0; i < 5; i++)
{
lpHeader[columnRightPositions[i]] = _T('|');
lpSeparator[columnRightPositions[i]] = _T('+');
}
lpSeparator[columnRightPositions[4] + 1] = _T('\0');
if (!LoadString(hInst, IDS_APP_TITLE, lpTitle, 80))
lpTitle[0] = _T('\0');
if (!LoadString(hInst, IDS_COLUMN_MEM_UNIT, lpMemUnit, 3))
lpMemUnit[0] = _T('\0');
if (!LoadString(hInst, IDS_MENU, lpMenu, 80))
lpMenu[0] = _T('\0');
if (!LoadString(hInst, IDS_IDLE_PROCESS, lpIdleProcess, 80))
lpIdleProcess[0] = _T('\0');
if (LoadString(hInst, IDS_MENU_QUIT, lpStr, 2))
KEY_QUIT = lpStr[0];
if (LoadString(hInst, IDS_MENU_KILL_PROCESS, lpStr, 2))
KEY_KILL = lpStr[0];
if (LoadString(hInst, IDS_YES, lpStr, 2))
KEY_YES = lpStr[0];
if (LoadString(hInst, IDS_NO, lpStr, 2))
KEY_NO = lpStr[0];
GetInputOutputHandles(); GetInputOutputHandles();
if (hStdin == INVALID_HANDLE_VALUE || hStdout == INVALID_HANDLE_VALUE) if (hStdin == INVALID_HANDLE_VALUE || hStdout == INVALID_HANDLE_VALUE)
{ {
printf("ctm: can't use console."); if (LoadString(hInst, IDS_CTM_GENERAL_ERR1, lpStr, 80))
_tprintf(lpStr);
return -1; return -1;
} }
if (GetConsoleMode(hStdin, &inConMode) == 0) if (GetConsoleMode(hStdin, &inConMode) == 0)
{ {
printf("ctm: can't GetConsoleMode() for input console."); if (LoadString(hInst, IDS_CTM_GENERAL_ERR2, lpStr, 80))
_tprintf(lpStr);
return -1; return -1;
} }
if (GetConsoleMode(hStdout, &outConMode) == 0) if (GetConsoleMode(hStdout, &outConMode) == 0)
{ {
printf("ctm: can't GetConsoleMode() for output console."); if (LoadString(hInst, IDS_CTM_GENERAL_ERR3, lpStr, 80))
_tprintf(lpStr);
return -1; return -1;
} }
SetConsoleMode(hStdin, 0); //FIXME: Should check for error! SetConsoleMode(hStdin, 0); //FIXME: Should check for error!
SetConsoleMode(hStdout, 0); //FIXME: Should check for error! SetConsoleMode(hStdout, 0); //FIXME: Should check for error!
PerfInit();
while (1) while (1)
{ {
DWORD numEvents; DWORD numEvents;
@ -598,7 +652,7 @@ int main(int *argc, char **argv)
DisplayScreen(); DisplayScreen();
//WriteConsole(hStdin, " ", 1, &numEvents, NULL); // TODO: Make another way (this is ugly, I know) //WriteConsole(hStdin, " ", 1, &numEvents, NULL); // TODO: Make another way (this is ugly, I know)
#if 1 #if 0
/* WaitForSingleObject for console handles is not implemented in ROS */ /* WaitForSingleObject for console handles is not implemented in ROS */
WaitForSingleObject(hStdin, 1000); WaitForSingleObject(hStdin, 1000);
#endif #endif
@ -610,7 +664,7 @@ int main(int *argc, char **argv)
if (ProcessKeys(numEvents) == TRUE) if (ProcessKeys(numEvents) == TRUE)
break; break;
} }
#if 0 #if 1
else else
{ {
/* Should be removed, if WaitForSingleObject is implemented for console handles */ /* Should be removed, if WaitForSingleObject is implemented for console handles */

View file

@ -1,7 +1,13 @@
/* $Id: ctm.rc,v 1.3 2004/10/16 22:30:18 gvg Exp $ */ /* $Id$ */
#include <defines.h>
#include "resource.h"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Console Task Manager\0" #define REACTOS_STR_FILE_DESCRIPTION "ReactOS Console Task Manager\0"
#define REACTOS_STR_INTERNAL_NAME "ctm\0" #define REACTOS_STR_INTERNAL_NAME "ctm\0"
#define REACTOS_STR_ORIGINAL_FILENAME "ctm.exe\0" #define REACTOS_STR_ORIGINAL_FILENAME "ctm.exe\0"
#define REACTOS_STR_ORIGINAL_COPYRIGHT "2003, Aleksey Bragin\0" #define REACTOS_STR_ORIGINAL_COPYRIGHT "2003, Aleksey Bragin\0"
#include <reactos/version.rc> #include <reactos/version.rc>
#include "En.rc"
#include "Fr.rc"

View file

@ -0,0 +1,44 @@
/*
* CTM resource definitions
*
* Copyright 2004 ReactOS team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define IDS_APP_TITLE 0
#define IDS_COLUMN_IMAGENAME 10
#define IDS_COLUMN_PID 11
#define IDS_COLUMN_CPU 12
#define IDS_COLUMN_MEM 13
#define IDS_COLUMN_MEM_UNIT 14
#define IDS_COLUMN_PF 15
#define IDS_IDLE_PROCESS 100
#define IDS_YES 101
#define IDS_NO 102
#define IDS_MENU 200
#define IDS_MENU_QUIT 201
#define IDS_MENU_KILL_PROCESS 202
#define IDS_KILL_PROCESS 1000
#define IDS_KILL_PROCESS_ERR1 1001
#define IDS_KILL_PROCESS_ERR2 1002
#define IDS_CTM_GENERAL_ERR1 32768
#define IDS_CTM_GENERAL_ERR2 32769
#define IDS_CTM_GENERAL_ERR3 32770