Hervé Poussineau <hpoussineau@fr.st>
authorGé van Geldorp <ge@gse.nl>
Sat, 15 Jan 2005 15:28:51 +0000 (15:28 +0000)
committerGé van Geldorp <ge@gse.nl>
Sat, 15 Jan 2005 15:28:51 +0000 (15:28 +0000)
Add localization to ctm

svn path=/trunk/; revision=13057

rosapps/sysutils/ctm/En.rc [new file with mode: 0644]
rosapps/sysutils/ctm/Fr.rc [new file with mode: 0644]
rosapps/sysutils/ctm/ctm.c
rosapps/sysutils/ctm/ctm.rc
rosapps/sysutils/ctm/resource.h [new file with mode: 0644]

diff --git a/rosapps/sysutils/ctm/En.rc b/rosapps/sysutils/ctm/En.rc
new file mode 100644 (file)
index 0000000..1e7e515
--- /dev/null
@@ -0,0 +1,31 @@
+// English (U.S.) resources\r
+\r
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r
+\r
+STRINGTABLE DISCARDABLE\r
+BEGIN\r
+   IDS_APP_TITLE           "Console TaskManager v0.1 by Aleksey Bragin <aleksey@studiocerebral.com>"\r
+   \r
+   IDS_COLUMN_IMAGENAME    "Image name                      "\r
+   IDS_COLUMN_PID          "PID  "\r
+   IDS_COLUMN_CPU          "CPU"\r
+   IDS_COLUMN_MEM          "Mem Usage"\r
+   IDS_COLUMN_MEM_UNIT         "Kb"\r
+   IDS_COLUMN_PF           "Page Faults"\r
+\r
+   IDS_IDLE_PROCESS        "System Idle Process"\r
+   IDS_YES                 "y"\r
+   IDS_NO                  "n"\r
+   \r
+   IDS_MENU                "Press: q - quit, k - kill process"\r
+   IDS_MENU_QUIT           "q"\r
+   IDS_MENU_KILL_PROCESS   "k"\r
+   \r
+   IDS_KILL_PROCESS        "Are you sure you want to kill this process? (y/n)"\r
+   IDS_KILL_PROCESS_ERR1   "Unable to terminate this process..."\r
+   IDS_KILL_PROCESS_ERR2   "Unable to terminate process %3d (unable to OpenProcess)"\r
+   \r
+   IDS_CTM_GENERAL_ERR1    "ctm: can't use console."\r
+   IDS_CTM_GENERAL_ERR2    "ctm: can't GetConsoleMode() for input console."\r
+   IDS_CTM_GENERAL_ERR3    "ctm: can't GetConsoleMode() for output console."\r
+END\r
diff --git a/rosapps/sysutils/ctm/Fr.rc b/rosapps/sysutils/ctm/Fr.rc
new file mode 100644 (file)
index 0000000..8de81a1
--- /dev/null
@@ -0,0 +1,31 @@
+// French (France) resources\r
+\r
+LANGUAGE LANG_FRENCH, SUBLANG_FRENCH\r
+\r
+STRINGTABLE DISCARDABLE\r
+BEGIN\r
+   IDS_APP_TITLE           "Console TaskManager v0.1 par Aleksey Bragin <aleksey@studiocerebral.com>"\r
+   \r
+   IDS_COLUMN_IMAGENAME    "Processus                   "\r
+   IDS_COLUMN_PID          "PID  "\r
+   IDS_COLUMN_CPU          "CPU"\r
+   IDS_COLUMN_MEM          "Util. mém"\r
+   IDS_COLUMN_MEM_UNIT         "Ko"\r
+   IDS_COLUMN_PF           "Défauts de page"\r
+\r
+   IDS_IDLE_PROCESS        "Processus inactif du système"\r
+   IDS_YES                 "O"\r
+   IDS_NO                  "N"\r
+   \r
+   IDS_MENU                "Menu: Quitter (q), Tuer processus (t)"\r
+   IDS_MENU_QUIT           "Q"\r
+   IDS_MENU_KILL_PROCESS   "T"\r
+   \r
+   IDS_KILL_PROCESS        "Etes-vous sûr de vouloir tuer ce processus (o/n) ?"\r
+   IDS_KILL_PROCESS_ERR1   "Impossible de terminer ce processus..."\r
+   IDS_KILL_PROCESS_ERR2   "Impossible de terminer le processus %3d (erreur lors de OpenProcess)"\r
+   \r
+   IDS_CTM_GENERAL_ERR1    "ctm: impossible d'utiliser la console."\r
+   IDS_CTM_GENERAL_ERR2    "ctm: impossible de récupérer les paramètres de la console d'entrée."\r
+   IDS_CTM_GENERAL_ERR3    "ctm: impossible de récupérer les paramètres de la console de sortie."\r
+END\r
index 5c50340..41cda52 100644 (file)
@@ -1,3 +1,6 @@
+#define UNICODE
+#define _UNICODE
+
 /* Console Task Manager
 
    ctm.c - main program file
@@ -6,8 +9,11 @@
    
    Most of the code dealing with getting system parameters is taken from
    ReactOS Task Manager written by Brian Palmer (brianp@reactos.org)
+   
+   Localization features added by Hervé Poussineau (hpoussineau@fr.st)
 
    History:
+   24 October 2004 - added localization features
        09 April 2003 - v0.1, fixed bugs, added features, ported to mingw
        20 March 2003 - v0.03, works good under ReactOS, and allows process
                        killing
 #include <ntos/zwtypes.h>
 
 #include "ctm.h"
+#include "resource.h"
 
 #define MAX_PROC 17
 #define TIMES
 
 HANDLE hStdin;
 HANDLE hStdout;
+HINSTANCE hInst;
 
 DWORD inConMode;
 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
 ULONG                  ProcessCountOld = 0;
@@ -70,9 +89,11 @@ PPERFDATA            pPerfData = NULL;               // Most recent copy of perf data
 
 int selection=0;
 int scrolled=0;                // offset from which process start showing
+int first = 0;         // first time in DisplayScreen
 
 #define NEW_CONSOLE
 
+// Functions that are needed by epsapi
 void *PsaiMalloc(SIZE_T size) { return malloc(size); }
 void *PsaiRealloc(void *ptr, SIZE_T size) { return realloc(ptr, size); }
 void PsaiFree(void *ptr) { free(ptr); }
@@ -120,39 +141,33 @@ void DisplayScreen()
        int posStr;
        DWORD numChars;
        int lines;
-       int idx;
-       static int first = 0;
+       int idx, i;
 
        if (first == 0)
        {
-          // Header
-          pos.X = 2; pos.Y = 2;
-          _tcscpy(lpStr, _T("Console TaskManager v0.1 by Aleksey Bragin <aleksey@studiocerebral.com>"));
-          WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
-
-          pos.X = 2; pos.Y = 3;
-          _tcscpy(lpStr, _T("+-------------------------------+-------+-----+-----------+-------------+"));
-          WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
-
-          pos.X = 2; pos.Y = 4;
-          _tcscpy(lpStr, _T("| Image name                    | PID   | CPU | Mem Usage | Page Faults |"));
-          WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
-
-          pos.X = 2; pos.Y = 5;
-          _tcscpy(lpStr, _T("+-------------------------------+-------+-----+-----------+-------------+"));
-          WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
-
-          // Footer
-          pos.X = 2; pos.Y = 23;
-          _tcscpy(lpStr, _T("+-------------------------------+-------+-----+-----------+-------------+"));
-          WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
-
-          // Menu
-          pos.X = 2; pos.Y = 24;
-          _tcscpy(lpStr, _T("Press: q - quit, k - kill process                                        "));
-          WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
-
-          first = 1;
+               // Header
+               pos.X = 2; pos.Y = 2;
+               WriteConsoleOutputCharacter(hStdout, lpTitle, _tcslen(lpTitle), pos, &numChars);
+
+               pos.X = 2; pos.Y = 3;
+               WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars);
+
+               pos.X = 2; pos.Y = 4;
+               WriteConsoleOutputCharacter(hStdout, lpHeader, _tcslen(lpHeader), pos, &numChars);
+
+               pos.X = 2; pos.Y = 5;
+               WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars);
+
+               // Footer
+               pos.X = 2; pos.Y = ProcPerScreen+6;
+               WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars);
+               
+               // Menu
+               pos.X = 2; pos.Y = ProcPerScreen+7;
+               WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars);
+               WriteConsoleOutputCharacter(hStdout, lpMenu, _tcslen(lpMenu), pos, &numChars);
+
+               first = 1;
        }
 
        // Processess
@@ -168,11 +183,14 @@ void DisplayScreen()
                TCHAR lpMemUsg[12];
                TCHAR lpPageFaults[15];
                WORD wColor;
+               
+               for (i = 0; i < 80; i++)
+                       lpStr[i] = _T(' ');
 
                // data
-               // image name
                if (idx < lines && scrolled + idx < ProcessCount)
                {
+                       // image name
 #ifdef _UNICODE                
                   len = wcslen(pPerfData[scrolled+idx].ImageName);  
 #else
@@ -180,77 +198,40 @@ void DisplayScreen()
                                       imgName, MAX_PATH, NULL, NULL);
                   len = strlen(imgName);
 #endif
-                  if (len > 31)
-                  {
-                     len = 31;
-                  }
+                       if (len > columnRightPositions[0])
+                       {
+                               len = columnRightPositions[0];
+                       }
 #ifdef _UNICODE
                   wcsncpy(&lpStr[2], pPerfData[scrolled+idx].ImageName, len);
 #else
                   strncpy(&lpStr[2], imgName, len);
 #endif
-               }
-               else
-               {
-                  len = 0;
-               }
-               if (len < 31)
-               {
-                  _tcsncpy(&lpStr[2 + len], _T("                               "), 31 - len);
-               }
 
-               // PID
-               if (idx < lines && scrolled + idx < ProcessCount)
-               {
-                  _stprintf(lpPid, _T("%6ld "), pPerfData[scrolled+idx].ProcessId);
-                   _tcsncpy(&lpStr[34], lpPid, 7);
-               }
-               else
-               {
-                  _tcsncpy(&lpStr[34], _T("       "), 7);
-               }
+                       // PID
+                  _stprintf(lpPid, _T("%6ld"), pPerfData[scrolled+idx].ProcessId);
+                       _tcsncpy(&lpStr[columnRightPositions[1] - 6], lpPid, 6);
 
-               // CPU
-               if (idx < lines && scrolled + idx < ProcessCount)
-               {
-                  _stprintf(lpCpu, _T("%3d%% "), pPerfData[scrolled+idx].CPUUsage);
-                  _tcsncpy(&lpStr[42], lpCpu, 5);
-               }
-               else
-               {
-                  _tcsncpy(&lpStr[42], _T("     "), 5);
-               }
+#ifdef TIMES
+                       // CPU
+                       _stprintf(lpCpu, _T("%3d%%"), pPerfData[scrolled+idx].CPUUsage);
+                       _tcsncpy(&lpStr[columnRightPositions[2] - 4], lpCpu, 4);
+#endif
 
-               // Mem usage
-               if (idx < lines && scrolled + idx < ProcessCount)
-               {
-                   _stprintf(lpMemUsg, _T("%6ld     "), pPerfData[scrolled+idx].WorkingSetSizeBytes / 1024);
-                   _tcsncpy(&lpStr[48], lpMemUsg, 11);
-               }
-               else
-               {   
-                   _tcsncpy(&lpStr[48], _T("           "), 11);
-               }
+                       // Mem usage
+                        _stprintf(lpMemUsg, _T("%6ld %s"), pPerfData[scrolled+idx].WorkingSetSizeBytes / 1024, lpMemUnit);
+                        _tcsncpy(&lpStr[columnRightPositions[3] - 9], lpMemUsg, 9);
 
-               // Page Fault
-               if (idx < lines && scrolled + idx < ProcessCount)
-               {
-                  _stprintf(lpPageFaults, _T("%12ld "), pPerfData[scrolled+idx].PageFaultCount);
-                  _tcsncpy(&lpStr[60], lpPageFaults, 13);
-               }
-               else
-               {
-                  _tcsncpy(&lpStr[60], _T("             "), 13);
+                       // Page Fault
+                       _stprintf(lpPageFaults, _T("%12ld"), pPerfData[scrolled+idx].PageFaultCount);
+                       _tcsncpy(&lpStr[columnRightPositions[4] - 12], lpPageFaults, 12);
                }
 
                // columns
                lpStr[0] = _T(' ');
                lpStr[1] = _T('|');
-               lpStr[33] = _T('|');
-               lpStr[41] = _T('|');
-               lpStr[47] = _T('|');
-               lpStr[59] = _T('|');
-               lpStr[73] = _T('|');
+               for (i = 0; i < 5; i++)
+                       lpStr[columnRightPositions[i] + 1] = _T('|');
                 pos.X = 1; pos.Y = 6+idx;
                WriteConsoleOutputCharacter(hStdout, lpStr, 74, pos, &numChars);
 
@@ -274,7 +255,7 @@ void DisplayScreen()
                FillConsoleOutputAttribute( 
                        hStdout,          // screen buffer handle 
                        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 
                        &numChars);       // actual number written 
        }
@@ -285,13 +266,14 @@ void DisplayScreen()
 // returns TRUE if exiting
 int ProcessKeys(int numEvents)
 {
+       DWORD numChars;
        if ((ProcessCount-scrolled < 17) && (ProcessCount > 17))
                scrolled = ProcessCount-17;
 
        TCHAR key = GetKeyPressed(numEvents);
-       if (key == VK_Q)
+       if (key == KEY_QUIT)
                return TRUE;
-       else if (key == VK_K)
+       else if (key == KEY_KILL)
        {
                // user wants to kill some process, get his acknowledgement
                DWORD pId;
@@ -299,15 +281,15 @@ int ProcessKeys(int numEvents)
                TCHAR lpStr[100];
 
                pos.X = 2; pos.Y = 24;
-               _tcscpy(lpStr, _T("Are you sure you want to kill this process? (y/n)"));
-               WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &pId);
+               if (LoadString(hInst, IDS_KILL_PROCESS, lpStr, 100))
+                       WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
 
                do {
                        GetNumberOfConsoleInputEvents(hStdin, &pId);
                        key = GetKeyPressed(pId);
                } while (key == 0);
-       
-               if (key == VK_Y)
+
+               if (key == KEY_YES)
                {
                        HANDLE hProcess;
                        pId = pPerfData[selection+scrolled].ProcessId;
@@ -317,8 +299,11 @@ int ProcessKeys(int numEvents)
                        {
                                if (!TerminateProcess(hProcess, 0))
                                {
-                                       _tcscpy(lpStr, _T("Unable to terminate this process...                                      "));
-                                       WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &pId);
+                                       if (LoadString(hInst, IDS_KILL_PROCESS_ERR1, lpStr, 80))
+                                       {
+                                               WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars);
+                                               WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
+                                       }
                                        Sleep(1000);
                                }
 
@@ -326,11 +311,17 @@ int ProcessKeys(int numEvents)
                        }
                        else
                        {
-                                       _stprintf(lpStr, _T("Unable to terminate process %3d (unable to OpenProcess)               "), pId);
-                                       WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &pId);
-                                       Sleep(1000);
+                               if (LoadString(hInst, IDS_KILL_PROCESS_ERR2, lpStr, 80))
+                               {
+                                       WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars);
+                                       _stprintf(lpStr, lpStr, pId);
+                                       WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
+                               }
+                               Sleep(1000);
                        }
                }
+               
+               first = 0;
        }
        else if (key == VK_UP)
        {
@@ -350,11 +341,6 @@ int ProcessKeys(int numEvents)
        return FALSE;
 }
 
-void PerfInit()
-{
-//     NtQuerySystemInformation = //(PROCNTQSI)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), //"NtQuerySystemInformation");
-}
-
 void PerfDataRefresh()
 {
        LONG                                                    status;
@@ -435,11 +421,9 @@ void PerfDataRefresh()
 
        // Now alloc a new PERFDATA array and fill in the data
        if (pPerfDataOld) {
-               //delete[] pPerfDataOld;
                free(pPerfDataOld);
        }
        pPerfDataOld = pPerfData;
-       //pPerfData = new PERFDATA[ProcessCount];
        pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount);
         pSPI = PsaWalkFirstProcess((PSYSTEM_PROCESSES)pBuffer);
        for (Idx=0; Idx<ProcessCount; Idx++) {
@@ -461,7 +445,13 @@ void PerfDataRefresh()
                         pPerfData[Idx].ImageName[pSPI->ProcessName.Length / sizeof(WCHAR)] = 0;
                }
                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;
 
@@ -531,7 +521,6 @@ int MultiByteToWideChar(
 #endif
                pSPI = PsaWalkNextProcess(pSPI);
        }
-       //delete[] pBuffer;
        PsaFreeCapture(pBuffer);
 
        free(SysProcessorTimeInfo);
@@ -565,31 +554,96 @@ unsigned int GetKeyPressed(int events)
 
 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();
 
        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;
        }
 
        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;
        }
 
        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;
        }
 
        SetConsoleMode(hStdin, 0); //FIXME: Should check for error!
        SetConsoleMode(hStdout, 0); //FIXME: Should check for error!
 
-       PerfInit();
-
        while (1)
        {
                DWORD numEvents;
@@ -598,7 +652,7 @@ int main(int *argc, char **argv)
                DisplayScreen();
 
                //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(hStdin, 1000);
 #endif
@@ -610,7 +664,7 @@ int main(int *argc, char **argv)
                        if (ProcessKeys(numEvents) == TRUE)
                                break;
                }
-#if 0
+#if 1
                else
                {
                    /* Should be removed, if WaitForSingleObject is implemented for console handles */
index 2887c80..3c650f1 100644 (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_INTERNAL_NAME      "ctm\0"
 #define REACTOS_STR_ORIGINAL_FILENAME  "ctm.exe\0"
 #define REACTOS_STR_ORIGINAL_COPYRIGHT "2003, Aleksey Bragin\0"
 #include <reactos/version.rc>
+
+#include "En.rc"
+#include "Fr.rc"
diff --git a/rosapps/sysutils/ctm/resource.h b/rosapps/sysutils/ctm/resource.h
new file mode 100644 (file)
index 0000000..fc01f17
--- /dev/null
@@ -0,0 +1,44 @@
+/*\r
+ * CTM resource definitions\r
+ *\r
+ * Copyright 2004 ReactOS team\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+ * Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ */\r
+\r
+#define IDS_APP_TITLE            0\r
+\r
+#define IDS_COLUMN_IMAGENAME     10\r
+#define IDS_COLUMN_PID           11\r
+#define IDS_COLUMN_CPU           12\r
+#define IDS_COLUMN_MEM           13\r
+#define IDS_COLUMN_MEM_UNIT            14\r
+#define IDS_COLUMN_PF            15\r
+\r
+#define IDS_IDLE_PROCESS         100\r
+#define IDS_YES                  101\r
+#define IDS_NO                   102\r
+\r
+#define IDS_MENU                 200\r
+#define IDS_MENU_QUIT            201\r
+#define IDS_MENU_KILL_PROCESS    202\r
+\r
+#define IDS_KILL_PROCESS         1000\r
+#define IDS_KILL_PROCESS_ERR1    1001\r
+#define IDS_KILL_PROCESS_ERR2    1002\r
+\r
+#define IDS_CTM_GENERAL_ERR1     32768\r
+#define IDS_CTM_GENERAL_ERR2     32769\r
+#define IDS_CTM_GENERAL_ERR3     32770\r