taskmgr: Converted some functions and variables to Unicode.
This commit is contained in:
parent
098dc7b330
commit
b28a6c1889
|
@ -4,6 +4,7 @@
|
|||
* affinity.c
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
* Copyright (C) 2008 Vladimir Pankratov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -26,21 +27,26 @@
|
|||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <winnt.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "taskmgr.h"
|
||||
#include "perfdata.h"
|
||||
|
||||
HANDLE hProcessAffinityHandle;
|
||||
|
||||
static const WCHAR wszUnable2Access[] = {'U','n','a','b','l','e',' ','t','o',' ',
|
||||
'A','c','c','e','s','s',' ','o','r',' ',
|
||||
'S','e','t',' ','P','r','o','c','e','s','s',' ',
|
||||
'A','f','f','i','n','i','t','y',0};
|
||||
|
||||
static INT_PTR CALLBACK
|
||||
AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
DWORD_PTR dwProcessAffinityMask = 0;
|
||||
DWORD_PTR dwSystemAffinityMask = 0;
|
||||
TCHAR strErrorText[260];
|
||||
WCHAR wstrErrorText[256];
|
||||
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
|
@ -50,9 +56,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
* the number of CPUs present in the system
|
||||
*/
|
||||
if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask, &dwSystemAffinityMask)) {
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
EndDialog(hDlg, 0);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Access or Set Process Affinity"), MB_OK|MB_ICONSTOP);
|
||||
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -129,69 +135,69 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
* has affinity with
|
||||
*/
|
||||
if (dwProcessAffinityMask & 0x00000001)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU0), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU0), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000002)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU1), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU1), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000004)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU2), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU2), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000008)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU3), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU3), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000010)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU4), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU4), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000020)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU5), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU5), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000040)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU6), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU6), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000080)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU7), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU7), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000100)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU8), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU8), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000200)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU9), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU9), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000400)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU10), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU10), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000800)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU11), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU11), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00001000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU12), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU12), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00002000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU13), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU13), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00004000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU14), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU14), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00008000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU15), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU15), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00010000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU16), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU16), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00020000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU17), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU17), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00040000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU18), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU18), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00080000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU19), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU19), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00100000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU20), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU20), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00200000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU21), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU21), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00400000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU22), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU22), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00800000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU23), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU23), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x01000000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU24), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU24), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x02000000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU25), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU25), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x04000000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU26), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU26), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x08000000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU27), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU27), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x10000000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU28), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU28), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x20000000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU29), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU29), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x40000000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU30), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU30), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x80000000)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU31), BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_CPU31), BM_SETCHECK, BST_CHECKED, 0);
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
@ -215,69 +221,69 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
* First we have to create a mask out of each
|
||||
* checkbox that the user checked.
|
||||
*/
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU0), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU0), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000001;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU1), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU1), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000002;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU2), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU2), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000004;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU3), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU3), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000008;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU4), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU4), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000010;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU5), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU5), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000020;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU6), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU6), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000040;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU7), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU7), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000080;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU8), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU8), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000100;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU9), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU9), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000200;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU10), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU10), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000400;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU11), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU11), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000800;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU12), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU12), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00001000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU13), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU13), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00002000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU14), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU14), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00004000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU15), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU15), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00008000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU16), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU16), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00010000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU17), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU17), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00020000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU18), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU18), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00040000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU19), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU19), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00080000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU20), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU20), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00100000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU21), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU21), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00200000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU22), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU22), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00400000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU23), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU23), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00800000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU24), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU24), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x01000000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU25), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU25), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x02000000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU26), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU26), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x04000000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU27), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU27), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x08000000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU28), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU28), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x10000000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU29), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU29), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x20000000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU30), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU30), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x40000000;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU31), BM_GETCHECK, 0, 0))
|
||||
if (SendMessageW(GetDlgItem(hDlg, IDC_CPU31), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x80000000;
|
||||
|
||||
/*
|
||||
|
@ -287,7 +293,13 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
* of it's cpu time.
|
||||
*/
|
||||
if (!dwProcessAffinityMask) {
|
||||
MessageBox(hDlg, _T("The process must have affinity with at least one processor."), _T("Invalid Option"), MB_OK|MB_ICONSTOP);
|
||||
static const WCHAR wszErrorMsg[] = {'T','h','e',' ','p','r','o','c','e','s','s',' ',
|
||||
'm','u','s','t',' ','h','a','v','e',' ',
|
||||
'a','f','f','i','n','i','t','y',' ',
|
||||
'w','i','t','h',' ','a','t',' ','l','e','a','s','t',' ',
|
||||
'o','n','e',' ','p','r','o','c','e','s','s','o','r','.',0};
|
||||
static const WCHAR wszErrorTitle[] = {'I','n','v','a','l','i','d',' ','O','p','t','i','o','n',0};
|
||||
MessageBoxW(hDlg, wszErrorMsg, wszErrorTitle, MB_OK|MB_ICONSTOP);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -295,9 +307,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
* Try to set the process affinity
|
||||
*/
|
||||
if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask)) {
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Access or Set Process Affinity"), MB_OK|MB_ICONSTOP);
|
||||
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
|
||||
}
|
||||
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
|
@ -312,17 +324,17 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
void ProcessPage_OnSetAffinity(void)
|
||||
{
|
||||
LV_ITEM lvitem;
|
||||
LV_ITEMW lvitem;
|
||||
ULONG Index;
|
||||
DWORD dwProcessId;
|
||||
TCHAR strErrorText[260];
|
||||
WCHAR wstrErrorText[256];
|
||||
|
||||
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) {
|
||||
memset(&lvitem, 0, sizeof(LV_ITEM));
|
||||
memset(&lvitem, 0, sizeof(LV_ITEMW));
|
||||
lvitem.mask = LVIF_STATE;
|
||||
lvitem.stateMask = LVIS_SELECTED;
|
||||
lvitem.iItem = Index;
|
||||
SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM) &lvitem);
|
||||
SendMessageW(hProcessPageListCtrl, LVM_GETITEMW, 0, (LPARAM) &lvitem);
|
||||
if (lvitem.state & LVIS_SELECTED)
|
||||
break;
|
||||
}
|
||||
|
@ -331,11 +343,11 @@ void ProcessPage_OnSetAffinity(void)
|
|||
return;
|
||||
hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
|
||||
if (!hProcessAffinityHandle) {
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Access or Set Process Affinity"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
|
||||
return;
|
||||
}
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_AFFINITY_DIALOG), hMainWnd, AffinityDialogWndProc);
|
||||
DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_AFFINITY_DIALOG), hMainWnd, AffinityDialogWndProc);
|
||||
if (hProcessAffinityHandle) {
|
||||
CloseHandle(hProcessAffinityHandle);
|
||||
hProcessAffinityHandle = NULL;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* debug.c
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
* Copyright (C) 2008 Vladimir Pankratov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -26,27 +27,44 @@
|
|||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <winnt.h>
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "taskmgr.h"
|
||||
#include "perfdata.h"
|
||||
|
||||
void ProcessPage_OnDebug(void)
|
||||
{
|
||||
LVITEM lvitem;
|
||||
LVITEMW lvitem;
|
||||
ULONG Index;
|
||||
DWORD dwProcessId;
|
||||
TCHAR strErrorText[260];
|
||||
WCHAR wstrErrorText[256];
|
||||
HKEY hKey;
|
||||
TCHAR strDebugPath[260];
|
||||
TCHAR strDebugger[260];
|
||||
WCHAR wstrDebugPath[256];
|
||||
WCHAR wstrDebugger[256];
|
||||
DWORD dwDebuggerSize;
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si;
|
||||
STARTUPINFOW si;
|
||||
HANDLE hDebugEvent;
|
||||
|
||||
static const WCHAR wszWarnTitle[] = {'T','a','s','k',' ','M','a','n','a','g','e','r',' ',
|
||||
'W','a','r','n','i','n','g',0};
|
||||
static const WCHAR wszUnable2Debug[] = {'U','n','a','b','l','e',' ','t','o',' ','D','e','b','u','g',' ',
|
||||
'P','r','o','c','e','s','s',0};
|
||||
static const WCHAR wszSubKey[] = {'S','o','f','t','w','a','r','e','\\',
|
||||
'M','i','c','r','o','s','o','f','t','\\',
|
||||
'W','i','n','d','o','w','s',' ','N','T','\\',
|
||||
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
||||
'A','e','D','e','b','u','g',0};
|
||||
static const WCHAR wszDebugger[] = {'D','e','b','u','g','g','e','r',0};
|
||||
static const WCHAR wszWarnMsg[] = {'W','A','R','N','I','N','G',':',' ','D','e','b','u','g','g','i','n','g',' ',
|
||||
't','h','i','s',' ','p','r','o','c','e','s','s',' ','m','a','y',' ',
|
||||
'r','e','s','u','l','t',' ','i','n',' ','l','o','s','s',' ','o','f',' ',
|
||||
'd','a','t','a','.','\n','A','r','e',' ','y','o','u',' ','s','u','r','e',' ',
|
||||
'y','o','u',' ','w','i','s','h',' ','t','o',' ','a','t','t','a','c','h',' ',
|
||||
't','h','e',' ','d','e','b','u','g','g','e','r','?',0};
|
||||
|
||||
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
|
||||
{
|
||||
lvitem.mask = LVIF_STATE;
|
||||
|
@ -54,7 +72,7 @@ void ProcessPage_OnDebug(void)
|
|||
lvitem.iItem = Index;
|
||||
lvitem.iSubItem = 0;
|
||||
|
||||
SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM) &lvitem);
|
||||
SendMessageW(hProcessPageListCtrl, LVM_GETITEMW, 0, (LPARAM) &lvitem);
|
||||
|
||||
if (lvitem.state & LVIS_SELECTED)
|
||||
break;
|
||||
|
@ -65,25 +83,25 @@ void ProcessPage_OnDebug(void)
|
|||
if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
|
||||
return;
|
||||
|
||||
if (MessageBox(hMainWnd, _T("WARNING: Debugging this process may result in loss of data.\nAre you sure you wish to attach the debugger?"), _T("Task Manager Warning"), MB_YESNO|MB_ICONWARNING) != IDYES)
|
||||
if (MessageBoxW(hMainWnd, wszWarnMsg, wszWarnTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Debug Process"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
|
||||
return;
|
||||
}
|
||||
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug"), 0, KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszSubKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Debug Process"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
|
||||
return;
|
||||
}
|
||||
|
||||
dwDebuggerSize = 260;
|
||||
if (RegQueryValueEx(hKey, _T("Debugger"), NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) != ERROR_SUCCESS)
|
||||
if (RegQueryValueExW(hKey, wszDebugger, NULL, NULL, (LPBYTE)wstrDebugger, &dwDebuggerSize) != ERROR_SUCCESS)
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Debug Process"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
|
||||
RegCloseKey(hKey);
|
||||
return;
|
||||
}
|
||||
|
@ -93,20 +111,20 @@ void ProcessPage_OnDebug(void)
|
|||
hDebugEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
if (!hDebugEvent)
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Debug Process"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
|
||||
return;
|
||||
}
|
||||
|
||||
wsprintf(strDebugPath, strDebugger, dwProcessId, hDebugEvent);
|
||||
wsprintfW(wstrDebugPath, wstrDebugger, dwProcessId, hDebugEvent);
|
||||
|
||||
memset(&pi, 0, sizeof(PROCESS_INFORMATION));
|
||||
memset(&si, 0, sizeof(STARTUPINFO));
|
||||
si.cb = sizeof(STARTUPINFO);
|
||||
if (!CreateProcess(NULL, strDebugPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
|
||||
memset(&si, 0, sizeof(STARTUPINFOW));
|
||||
si.cb = sizeof(STARTUPINFOW);
|
||||
if (!CreateProcessW(NULL, wstrDebugPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Debug Process"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
|
||||
}
|
||||
|
||||
CloseHandle(hDebugEvent);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* endproc.c
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
* Copyright (C) 2008 Vladimir Pankratov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -26,20 +27,24 @@
|
|||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <winnt.h>
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "taskmgr.h"
|
||||
#include "perfdata.h"
|
||||
|
||||
static const WCHAR wszWarnMsg[] = {'W','A','R','N','I','N','G',':',' ','T','e','r','m','i','n','a','t','i','n','g',' ','a',' ','p','r','o','c','e','s','s',' ','c','a','n',' ','c','a','u','s','e',' ','u','n','d','e','s','i','r','e','d','\n','r','e','s','u','l','t','s',' ','i','n','c','l','u','d','i','n','g',' ','l','o','s','s',' ','o','f',' ','d','a','t','a',' ','a','n','d',' ','s','y','s','t','e','m',' ','i','n','s','t','a','b','i','l','i','t','y','.',' ','T','h','e','\n','p','r','o','c','e','s','s',' ','w','i','l','l',' ','n','o','t',' ','b','e',' ','g','i','v','e','n',' ','t','h','e',' ','c','h','a','n','c','e',' ','t','o',' ','s','a','v','e',' ','i','t','s',' ','s','t','a','t','e',' ','o','r','\n','d','a','t','a',' ','b','e','f','o','r','e',' ','i','t',' ','i','s',' ','t','e','r','m','i','n','a','t','e','d','.',' ','A','r','e',' ','y','o','u',' ','s','u','r','e',' ','y','o','u',' ','w','a','n','t',' ','t','o','\n','t','e','r','m','i','n','a','t','e',' ','t','h','e',' ','p','r','o','c','e','s','s','?',0};
|
||||
static const WCHAR wszWarnTitle[] = {'T','a','s','k',' ','M','a','n','a','g','e','r',' ','W','a','r','n','i','n','g',0};
|
||||
static const WCHAR wszUnable2Terminate[] = {'U','n','a','b','l','e',' ','t','o',' ','T','e','r','m','i','n','a','t','e',' ','P','r','o','c','e','s','s',0};
|
||||
|
||||
void ProcessPage_OnEndProcess(void)
|
||||
{
|
||||
LVITEM lvitem;
|
||||
LVITEMW lvitem;
|
||||
ULONG Index;
|
||||
DWORD dwProcessId;
|
||||
HANDLE hProcess;
|
||||
TCHAR strErrorText[260];
|
||||
WCHAR wstrErrorText[256];
|
||||
|
||||
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
|
||||
{
|
||||
|
@ -48,7 +53,7 @@ void ProcessPage_OnEndProcess(void)
|
|||
lvitem.iItem = Index;
|
||||
lvitem.iSubItem = 0;
|
||||
|
||||
SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM) &lvitem);
|
||||
SendMessageW(hProcessPageListCtrl, LVM_GETITEMW, 0, (LPARAM) &lvitem);
|
||||
|
||||
if (lvitem.state & LVIS_SELECTED)
|
||||
break;
|
||||
|
@ -59,22 +64,22 @@ void ProcessPage_OnEndProcess(void)
|
|||
if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
|
||||
return;
|
||||
|
||||
if (MessageBox(hMainWnd, _T("WARNING: Terminating a process can cause undesired\nresults including loss of data and system instability. The\nprocess will not be given the chance to save its state or\ndata before it is terminated. Are you sure you want to\nterminate the process?"), _T("Task Manager Warning"), MB_YESNO|MB_ICONWARNING) != IDYES)
|
||||
if (MessageBoxW(hMainWnd, wszWarnMsg, wszWarnTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
|
||||
return;
|
||||
|
||||
hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwProcessId);
|
||||
|
||||
if (!hProcess)
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Terminate Process"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TerminateProcess(hProcess, 0))
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Terminate Process"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
|
||||
}
|
||||
|
||||
CloseHandle(hProcess);
|
||||
|
@ -82,11 +87,11 @@ void ProcessPage_OnEndProcess(void)
|
|||
|
||||
void ProcessPage_OnEndProcessTree(void)
|
||||
{
|
||||
LVITEM lvitem;
|
||||
LVITEMW lvitem;
|
||||
ULONG Index;
|
||||
DWORD dwProcessId;
|
||||
HANDLE hProcess;
|
||||
TCHAR strErrorText[260];
|
||||
WCHAR wstrErrorText[256];
|
||||
|
||||
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
|
||||
{
|
||||
|
@ -95,7 +100,7 @@ void ProcessPage_OnEndProcessTree(void)
|
|||
lvitem.iItem = Index;
|
||||
lvitem.iSubItem = 0;
|
||||
|
||||
SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM) &lvitem);
|
||||
SendMessageW(hProcessPageListCtrl, LVM_GETITEMW, 0, (LPARAM) &lvitem);
|
||||
|
||||
if (lvitem.state & LVIS_SELECTED)
|
||||
break;
|
||||
|
@ -106,22 +111,22 @@ void ProcessPage_OnEndProcessTree(void)
|
|||
if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
|
||||
return;
|
||||
|
||||
if (MessageBox(hMainWnd, _T("WARNING: Terminating a process can cause undesired\nresults including loss of data and system instability. The\nprocess will not be given the chance to save its state or\ndata before it is terminated. Are you sure you want to\nterminate the process?"), _T("Task Manager Warning"), MB_YESNO|MB_ICONWARNING) != IDYES)
|
||||
if (MessageBoxW(hMainWnd, wszWarnMsg, wszWarnTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
|
||||
return;
|
||||
|
||||
hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwProcessId);
|
||||
|
||||
if (!hProcess)
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Terminate Process"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TerminateProcess(hProcess, 0))
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Terminate Process"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
|
||||
}
|
||||
|
||||
CloseHandle(hProcess);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* graph.c
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
* Copyright (C) 2008 Vladimir Pankratov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -26,10 +27,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <winnt.h>
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "taskmgr.h"
|
||||
#include "perfdata.h"
|
||||
|
||||
|
@ -45,7 +46,7 @@ static void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
|||
RECT rcClient;
|
||||
RECT rcBarLeft;
|
||||
RECT rcBarRight;
|
||||
TCHAR Text[260];
|
||||
WCHAR Text[256];
|
||||
ULONG CpuUsage;
|
||||
ULONG CpuKernelUsage;
|
||||
int nBars;
|
||||
|
@ -57,6 +58,10 @@ static void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
|||
/* Top bars that are "unused", i.e. are dark green, representing free cpu time */
|
||||
int i;
|
||||
|
||||
static const WCHAR wszFormatI[] = {'%','d','%','%',0};
|
||||
static const WCHAR wszFormatII[] = {' ',' ','%','d','%','%',0};
|
||||
static const WCHAR wszFormatIII[] = {' ','%','d','%','%',0};
|
||||
|
||||
/*
|
||||
* Get the client area rectangle
|
||||
*/
|
||||
|
@ -79,15 +84,15 @@ static void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
|||
*/
|
||||
if (CpuUsage == 100)
|
||||
{
|
||||
_stprintf(Text, _T("%d%%"), (int)CpuUsage);
|
||||
sprintfW(Text, wszFormatI, (int)CpuUsage);
|
||||
}
|
||||
else if (CpuUsage < 10)
|
||||
{
|
||||
_stprintf(Text, _T(" %d%%"), (int)CpuUsage);
|
||||
sprintfW(Text, wszFormatII, (int)CpuUsage);
|
||||
}
|
||||
else
|
||||
{
|
||||
_stprintf(Text, _T(" %d%%"), (int)CpuUsage);
|
||||
sprintfW(Text, wszFormatIII, (int)CpuUsage);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -221,7 +226,7 @@ static void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
|
|||
RECT rcClient;
|
||||
RECT rcBarLeft;
|
||||
RECT rcBarRight;
|
||||
TCHAR Text[260];
|
||||
WCHAR Text[256];
|
||||
ULONGLONG CommitChargeTotal;
|
||||
ULONGLONG CommitChargeLimit;
|
||||
int nBars;
|
||||
|
@ -231,6 +236,8 @@ static void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
|
|||
/* Top bars that are "unused", i.e. are dark green, representing free memory */
|
||||
int i;
|
||||
|
||||
static const WCHAR wszFormat[] = {'%','d','K',0};
|
||||
|
||||
/*
|
||||
* Get the client area rectangle
|
||||
*/
|
||||
|
@ -247,13 +254,13 @@ static void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
|
|||
CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
|
||||
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
|
||||
|
||||
_stprintf(Text, _T("%dK"), (int)CommitChargeTotal);
|
||||
sprintfW(Text, wszFormat, (int)CommitChargeTotal);
|
||||
|
||||
/*
|
||||
* Draw the font text onto the graph
|
||||
* The bottom 20 pixels are reserved for the text
|
||||
*/
|
||||
Font_DrawText(hDC, Text, ((rcClient.right - rcClient.left) - (_tcslen(Text) * 8)) / 2, rcClient.bottom - 11 - 5);
|
||||
Font_DrawText(hDC, Text, ((rcClient.right - rcClient.left) - (strlenW(Text) * 8)) / 2, rcClient.bottom - 11 - 5);
|
||||
|
||||
/*
|
||||
* Now we have to draw the graph
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* priority.c
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
* Copyright (C) 2008 Vladimir Pankratov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -26,20 +27,25 @@
|
|||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <winnt.h>
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "taskmgr.h"
|
||||
#include "perfdata.h"
|
||||
|
||||
static void DoSetPriority(DWORD priority)
|
||||
{
|
||||
LVITEM lvitem;
|
||||
LVITEMW lvitem;
|
||||
ULONG Index;
|
||||
DWORD dwProcessId;
|
||||
HANDLE hProcess;
|
||||
TCHAR strErrorText[260];
|
||||
WCHAR wstrErrorText[256];
|
||||
|
||||
static const WCHAR wszWarnMsg[] = {'W','A','R','N','I','N','G',':',' ','C','h','a','n','g','i','n','g',
|
||||
' ','t','h','e',' ','p','r','i','o','r','i','t','y',' ','c','l','a','s','s',' ','o','f',' ','t','h','i','s',' ','p','r','o','c','e','s','s',' ','m','a','y','\n','c','a','u','s','e',' ','u','n','d','e','s','i','r','e','d',' ','r','e','s','u','l','t','s',' ','i','n','c','l','u','d','i','n','g',' ','s','y','s','t','e','m',' ','i','n','s','t','a','b','i','l','i','t','y','.',' ','A','r','e',' ','y','o','u','\n','s','u','r','e',' ','y','o','u',' ','w','a','n','t',' ','t','o',' ','c','h','a','n','g','e',' ','t','h','e',' ','p','r','i','o','r','i','t','y',' ','c','l','a','s','s','?',0};
|
||||
static const WCHAR wszWarnTitle[] = {'T','a','s','k',' ','M','a','n','a','g','e','r',' ','W','a','r','n','i','n','g',0};
|
||||
static const WCHAR wszUnable2Change[] = {'U','n','a','b','l','e',' ','t','o',' ','C','h','a','n','g','e',' ','P','r','i','o','r','i','t','y',0};
|
||||
|
||||
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
|
||||
{
|
||||
|
@ -48,7 +54,7 @@ static void DoSetPriority(DWORD priority)
|
|||
lvitem.iItem = Index;
|
||||
lvitem.iSubItem = 0;
|
||||
|
||||
SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM)&lvitem);
|
||||
SendMessageW(hProcessPageListCtrl, LVM_GETITEMW, 0, (LPARAM)&lvitem);
|
||||
|
||||
if (lvitem.state & LVIS_SELECTED)
|
||||
break;
|
||||
|
@ -59,22 +65,22 @@ static void DoSetPriority(DWORD priority)
|
|||
if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
|
||||
return;
|
||||
|
||||
if (MessageBox(hMainWnd, _T("WARNING: Changing the priority class of this process may\ncause undesired results including system instability. Are you\nsure you want to change the priority class?"), _T("Task Manager Warning"), MB_YESNO|MB_ICONWARNING) != IDYES)
|
||||
if (MessageBoxW(hMainWnd, wszWarnMsg, wszWarnTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
|
||||
return;
|
||||
|
||||
hProcess = OpenProcess(PROCESS_SET_INFORMATION, FALSE, dwProcessId);
|
||||
|
||||
if (!hProcess)
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Change Priority"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Change, MB_OK|MB_ICONSTOP);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SetPriorityClass(hProcess, priority))
|
||||
{
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Change Priority"), MB_OK|MB_ICONSTOP);
|
||||
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
|
||||
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Change, MB_OK|MB_ICONSTOP);
|
||||
}
|
||||
|
||||
CloseHandle(hProcess);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* taskmgr.c : Defines the entry point for the application.
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
* Copyright (C) 2008 Vladimir Pankratov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -26,10 +27,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <winnt.h>
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "resource.h"
|
||||
#include "taskmgr.h"
|
||||
#include "perfdata.h"
|
||||
|
@ -87,7 +88,7 @@ void Draw3dRect2(HDC hDC, LPRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottom
|
|||
lpRect->bottom - lpRect->top, clrTopLeft, clrBottomRight);
|
||||
}
|
||||
|
||||
void Font_DrawText(HDC hDC, LPCTSTR lpszText, int x, int y)
|
||||
void Font_DrawText(HDC hDC, LPWSTR lpwszText, int x, int y)
|
||||
{
|
||||
HDC hFontDC;
|
||||
HBITMAP hFontBitmap;
|
||||
|
@ -98,15 +99,15 @@ void Font_DrawText(HDC hDC, LPCTSTR lpszText, int x, int y)
|
|||
hFontBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_FONT));
|
||||
hOldBitmap = (HBITMAP)SelectObject(hFontDC, hFontBitmap);
|
||||
|
||||
for (i = 0; i < (int)_tcslen(lpszText); i++) {
|
||||
if ((lpszText[i] >= '0') && (lpszText[i] <= '9')) {
|
||||
BitBlt(hDC, x + (i * 8), y, 8, 11, hFontDC, (lpszText[i] - '0') * 8, 0, SRCCOPY);
|
||||
for (i = 0; lpwszText[i]; i++) {
|
||||
if ((lpwszText[i] >= '0') && (lpwszText[i] <= '9')) {
|
||||
BitBlt(hDC, x + (i * 8), y, 8, 11, hFontDC, (lpwszText[i] - '0') * 8, 0, SRCCOPY);
|
||||
}
|
||||
else if (lpszText[i] == 'K')
|
||||
else if (lpwszText[i] == 'K')
|
||||
{
|
||||
BitBlt(hDC, x + (i * 8), y, 8, 11, hFontDC, 80, 0, SRCCOPY);
|
||||
}
|
||||
else if (lpszText[i] == '%')
|
||||
else if (lpwszText[i] == '%')
|
||||
{
|
||||
BitBlt(hDC, x + (i * 8), y, 8, 11, hFontDC, 88, 0, SRCCOPY);
|
||||
}
|
||||
|
@ -126,10 +127,13 @@ static BOOL OnCreate(HWND hWnd)
|
|||
int nActivePage;
|
||||
int nParts[3];
|
||||
RECT rc;
|
||||
TCHAR szTemp[256];
|
||||
TCITEM item;
|
||||
TCITEMW item;
|
||||
|
||||
SendMessage(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_TASKMANAGER)));
|
||||
static WCHAR wszApplications[] = {'A','p','p','l','i','c','a','t','i','o','n','s',0};
|
||||
static WCHAR wszProcesses[] = {'P','r','o','c','e','s','s','e','s',0};
|
||||
static WCHAR wszPerformance[] = {'P','e','r','f','o','r','m','a','n','c','e',0};
|
||||
|
||||
SendMessageW(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_TASKMANAGER)));
|
||||
|
||||
/* Initialize the Windows Common Controls DLL */
|
||||
InitCommonControls();
|
||||
|
@ -140,7 +144,7 @@ static BOOL OnCreate(HWND hWnd)
|
|||
nMinimumHeight = (rc.bottom - rc.top);
|
||||
|
||||
/* Create the status bar */
|
||||
hStatusWnd = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, _T(""), hWnd, STATUS_WINDOW);
|
||||
hStatusWnd = CreateStatusWindowW(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, NULL, hWnd, STATUS_WINDOW);
|
||||
if(!hStatusWnd)
|
||||
return FALSE;
|
||||
|
||||
|
@ -148,36 +152,33 @@ static BOOL OnCreate(HWND hWnd)
|
|||
nParts[0] = 100;
|
||||
nParts[1] = 210;
|
||||
nParts[2] = 400;
|
||||
SendMessage(hStatusWnd, SB_SETPARTS, 3, (long)nParts);
|
||||
SendMessageW(hStatusWnd, SB_SETPARTS, 3, (long)nParts);
|
||||
|
||||
/* Create tab pages */
|
||||
hTabWnd = GetDlgItem(hWnd, IDC_TAB);
|
||||
#if 1
|
||||
hApplicationPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_APPLICATION_PAGE), hWnd, ApplicationPageWndProc);
|
||||
hProcessPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_PROCESS_PAGE), hWnd, ProcessPageWndProc);
|
||||
hPerformancePage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_PERFORMANCE_PAGE), hWnd, PerformancePageWndProc);
|
||||
hApplicationPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_APPLICATION_PAGE), hWnd, ApplicationPageWndProc);
|
||||
hProcessPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PROCESS_PAGE), hWnd, ProcessPageWndProc);
|
||||
hPerformancePage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PERFORMANCE_PAGE), hWnd, PerformancePageWndProc);
|
||||
#else
|
||||
hApplicationPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_APPLICATION_PAGE), hTabWnd, ApplicationPageWndProc);
|
||||
hProcessPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_PROCESS_PAGE), hTabWnd, ProcessPageWndProc);
|
||||
hPerformancePage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_PERFORMANCE_PAGE), hTabWnd, PerformancePageWndProc);
|
||||
hApplicationPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_APPLICATION_PAGE), hTabWnd, ApplicationPageWndProc);
|
||||
hProcessPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PROCESS_PAGE), hTabWnd, ProcessPageWndProc);
|
||||
hPerformancePage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PERFORMANCE_PAGE), hTabWnd, PerformancePageWndProc);
|
||||
#endif
|
||||
|
||||
/* Insert tabs */
|
||||
_tcscpy(szTemp, _T("Applications"));
|
||||
memset(&item, 0, sizeof(TCITEM));
|
||||
memset(&item, 0, sizeof(TCITEMW));
|
||||
item.mask = TCIF_TEXT;
|
||||
item.pszText = szTemp;
|
||||
SendMessage(hTabWnd, TCM_INSERTITEM, 0, (LPARAM)&item);
|
||||
_tcscpy(szTemp, _T("Processes"));
|
||||
memset(&item, 0, sizeof(TCITEM));
|
||||
item.pszText = wszApplications;
|
||||
SendMessageW(hTabWnd, TCM_INSERTITEMW, 0, (LPARAM)&item);
|
||||
memset(&item, 0, sizeof(TCITEMW));
|
||||
item.mask = TCIF_TEXT;
|
||||
item.pszText = szTemp;
|
||||
SendMessage(hTabWnd, TCM_INSERTITEM, 1, (LPARAM)&item);
|
||||
_tcscpy(szTemp, _T("Performance"));
|
||||
memset(&item, 0, sizeof(TCITEM));
|
||||
item.pszText = wszProcesses;
|
||||
SendMessageW(hTabWnd, TCM_INSERTITEMW, 1, (LPARAM)&item);
|
||||
memset(&item, 0, sizeof(TCITEMW));
|
||||
item.mask = TCIF_TEXT;
|
||||
item.pszText = szTemp;
|
||||
SendMessage(hTabWnd, TCM_INSERTITEM, 2, (LPARAM)&item);
|
||||
item.pszText = wszPerformance;
|
||||
SendMessageW(hTabWnd, TCM_INSERTITEMW, 2, (LPARAM)&item);
|
||||
|
||||
/* Size everything correctly */
|
||||
GetClientRect(hWnd, &rc);
|
||||
|
@ -336,13 +337,13 @@ static void OnSize( UINT nType, int cx, int cy )
|
|||
|
||||
/* Update the status bar size */
|
||||
GetWindowRect(hStatusWnd, &rc);
|
||||
SendMessage(hStatusWnd, WM_SIZE, nType, MAKELPARAM(cx, cy + (rc.bottom - rc.top)));
|
||||
SendMessageW(hStatusWnd, WM_SIZE, nType, MAKELPARAM(cx, cy + (rc.bottom - rc.top)));
|
||||
|
||||
/* Update the status bar pane sizes */
|
||||
nParts[0] = bInMenuLoop ? -1 : 100;
|
||||
nParts[1] = 210;
|
||||
nParts[2] = cx;
|
||||
SendMessage(hStatusWnd, SB_SETPARTS, bInMenuLoop ? 1 : 3, (long)nParts);
|
||||
SendMessageW(hStatusWnd, SB_SETPARTS, bInMenuLoop ? 1 : 3, (LPARAM)nParts);
|
||||
|
||||
/* Resize the tab control */
|
||||
GetWindowRect(hTabWnd, &rc);
|
||||
|
@ -372,10 +373,13 @@ static void OnSize( UINT nType, int cx, int cy )
|
|||
static void LoadSettings(void)
|
||||
{
|
||||
HKEY hKey;
|
||||
TCHAR szSubKey[] = _T("Software\\Wine\\TaskManager");
|
||||
int i;
|
||||
DWORD dwSize;
|
||||
|
||||
static const WCHAR wszSubKey[] = {'S','o','f','t','w','a','r','e','\\',
|
||||
'W','i','n','e','\\','T','a','s','k','M','a','n','a','g','e','r',0};
|
||||
static const WCHAR wszPreferences[] = {'P','r','e','f','e','r','e','n','c','e','s',0};
|
||||
|
||||
/* Window size & position settings */
|
||||
TaskManagerSettings.Maximized = FALSE;
|
||||
TaskManagerSettings.Left = 0;
|
||||
|
@ -466,11 +470,11 @@ static void LoadSettings(void)
|
|||
|
||||
/* Open the key */
|
||||
/* @@ Wine registry key: HKCU\Software\Wine\TaskManager */
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, szSubKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, wszSubKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||
return;
|
||||
/* Read the settings */
|
||||
dwSize = sizeof(TASKMANAGER_SETTINGS);
|
||||
RegQueryValueEx(hKey, _T("Preferences"), NULL, NULL, (LPBYTE)&TaskManagerSettings, &dwSize);
|
||||
RegQueryValueExW(hKey, wszPreferences, NULL, NULL, (LPBYTE)&TaskManagerSettings, &dwSize);
|
||||
|
||||
/* Close the key */
|
||||
RegCloseKey(hKey);
|
||||
|
@ -479,15 +483,18 @@ static void LoadSettings(void)
|
|||
static void SaveSettings(void)
|
||||
{
|
||||
HKEY hKey;
|
||||
TCHAR szSubKey3[] = _T("Software\\Wine\\TaskManager");
|
||||
|
||||
static const WCHAR wszSubKey3[] = {'S','o','f','t','w','a','r','e','\\',
|
||||
'W','i','n','e','\\','T','a','s','k','M','a','n','a','g','e','r',0};
|
||||
static const WCHAR wszPreferences[] = {'P','r','e','f','e','r','e','n','c','e','s',0};
|
||||
|
||||
/* Open (or create) the key */
|
||||
|
||||
/* @@ Wine registry key: HKCU\Software\Wine\TaskManager */
|
||||
if (RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey3, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS)
|
||||
if (RegCreateKeyExW(HKEY_CURRENT_USER, wszSubKey3, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS)
|
||||
return;
|
||||
/* Save the settings */
|
||||
RegSetValueEx(hKey, _T("Preferences"), 0, REG_BINARY, (LPBYTE)&TaskManagerSettings, sizeof(TASKMANAGER_SETTINGS));
|
||||
RegSetValueExW(hKey, wszPreferences, 0, REG_BINARY, (LPBYTE)&TaskManagerSettings, sizeof(TASKMANAGER_SETTINGS));
|
||||
/* Close the key */
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
@ -512,16 +519,19 @@ static void TaskManager_OnEnterMenuLoop(HWND hWnd)
|
|||
|
||||
/* Update the status bar pane sizes */
|
||||
nParts = -1;
|
||||
SendMessage(hStatusWnd, SB_SETPARTS, 1, (long)&nParts);
|
||||
SendMessageW(hStatusWnd, SB_SETPARTS, 1, (long)&nParts);
|
||||
bInMenuLoop = TRUE;
|
||||
SendMessage(hStatusWnd, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
|
||||
SendMessageW(hStatusWnd, SB_SETTEXTW, 0, 0);
|
||||
}
|
||||
|
||||
static void TaskManager_OnExitMenuLoop(HWND hWnd)
|
||||
{
|
||||
RECT rc;
|
||||
int nParts[3];
|
||||
TCHAR text[260];
|
||||
WCHAR text[256];
|
||||
|
||||
static const WCHAR wszCPU_Usage[] = {'C','P','U',' ','U','s','a','g','e',':',' ','%','3','d','%','%',0};
|
||||
static const WCHAR wszProcesses[] = {'P','r','o','c','e','s','s','e','s',':',' ','%','d',0};
|
||||
|
||||
bInMenuLoop = FALSE;
|
||||
/* Update the status bar pane sizes */
|
||||
|
@ -529,28 +539,20 @@ static void TaskManager_OnExitMenuLoop(HWND hWnd)
|
|||
nParts[0] = 100;
|
||||
nParts[1] = 210;
|
||||
nParts[2] = rc.right;
|
||||
SendMessage(hStatusWnd, SB_SETPARTS, 3, (long)nParts);
|
||||
SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)_T(""));
|
||||
wsprintf(text, _T("CPU Usage: %3d%%"), PerfDataGetProcessorUsage());
|
||||
SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text);
|
||||
wsprintf(text, _T("Processes: %d"), PerfDataGetProcessCount());
|
||||
SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)text);
|
||||
SendMessageW(hStatusWnd, SB_SETPARTS, 3, (long)nParts);
|
||||
SendMessageW(hStatusWnd, SB_SETTEXT, 0, 0);
|
||||
wsprintfW(text, wszCPU_Usage, PerfDataGetProcessorUsage());
|
||||
SendMessageW(hStatusWnd, SB_SETTEXTW, 1, (LPARAM)text);
|
||||
wsprintfW(text, wszProcesses, PerfDataGetProcessCount());
|
||||
SendMessageW(hStatusWnd, SB_SETTEXTW, 0, (LPARAM)text);
|
||||
}
|
||||
|
||||
static void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
|
||||
{
|
||||
TCHAR str[100];
|
||||
WCHAR wstr[256] = {0};
|
||||
|
||||
_tcscpy(str, TEXT(""));
|
||||
if (LoadString(hInst, nItemID, str, 100)) {
|
||||
/* load appropriate string */
|
||||
LPTSTR lpsz = str;
|
||||
/* first newline terminates actual string */
|
||||
lpsz = _tcschr(lpsz, '\n');
|
||||
if (lpsz != NULL)
|
||||
*lpsz = '\0';
|
||||
}
|
||||
SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)str);
|
||||
LoadStringW(hInst, nItemID, wstr, sizeof(wstr)/sizeof(WCHAR));
|
||||
SendMessageW(hStatusWnd, SB_SETTEXTW, 0, (LPARAM)wstr);
|
||||
}
|
||||
|
||||
static void TaskManager_OnViewUpdateSpeedHigh(void)
|
||||
|
@ -626,6 +628,22 @@ static void TaskManager_OnTabWndSelChange(void)
|
|||
HMENU hViewMenu;
|
||||
HMENU hSubMenu;
|
||||
|
||||
static const WCHAR wszLargeIcons[] = {'L','a','r','&','g','e',' ','I','c','o','n','s',0};
|
||||
static const WCHAR wszSmallIcons[] = {'S','&','m','a','l','l',' ','I','c','o','n','s',0};
|
||||
static const WCHAR wszDetails[] = {'&','D','e','t','a','i','l','s',0};
|
||||
static const WCHAR wszWindows[] = {'&','W','i','n','d','o','w','s',0};
|
||||
static const WCHAR wszSelectColumns[] = {'&','S','e','l','e','c','t',' ',
|
||||
'C','o','l','u','m','n','s','.','.','.',0};
|
||||
static const WCHAR wszShow16bTasks[] = {'&','S','h','o','w',' ','1','6','-','b','i','t',' ',
|
||||
't','a','s','k','s',0};
|
||||
static const WCHAR wszOneGraphAllCPU[] = {'&','O','n','e',' ','G','r','a','p','h',',',' ',
|
||||
'A','l','l',' ','C','P','U','s',0};
|
||||
static const WCHAR wszOneGraphPerCPU[] = {'O','n','e',' ','G','r','a','p','h',' ',
|
||||
'&','P','e','r',' ','C','P','U',0};
|
||||
static const WCHAR wszCPUHistory[] = {'&','C','P','U',' ','H','i','s','t','o','r','y',0};
|
||||
static const WCHAR wszShowKernelTimes[] = {'&','S','h','o','w',' ','K','e','r','n','e','l',' ',
|
||||
'T','i','m','e','s',0};
|
||||
|
||||
hMenu = GetMenu(hMainWnd);
|
||||
hViewMenu = GetSubMenu(hMenu, 2);
|
||||
hOptionsMenu = GetSubMenu(hMenu, 1);
|
||||
|
@ -643,13 +661,13 @@ static void TaskManager_OnTabWndSelChange(void)
|
|||
ShowWindow(hProcessPage, SW_HIDE);
|
||||
ShowWindow(hPerformancePage, SW_HIDE);
|
||||
BringWindowToTop(hApplicationPage);
|
||||
AppendMenu(hViewMenu, MF_STRING, ID_VIEW_LARGE, _T("Lar&ge Icons"));
|
||||
AppendMenu(hViewMenu, MF_STRING, ID_VIEW_SMALL, _T("S&mall Icons"));
|
||||
AppendMenu(hViewMenu, MF_STRING, ID_VIEW_DETAILS, _T("&Details"));
|
||||
AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_LARGE, wszLargeIcons);
|
||||
AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_SMALL, wszSmallIcons);
|
||||
AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_DETAILS, wszDetails);
|
||||
|
||||
if (GetMenuItemCount(hMenu) <= 4) {
|
||||
hSubMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_WINDOWSMENU));
|
||||
InsertMenu(hMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT_PTR)hSubMenu, _T("&Windows"));
|
||||
hSubMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_WINDOWSMENU));
|
||||
InsertMenuW(hMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT_PTR)hSubMenu, wszWindows);
|
||||
DrawMenuBar(hMainWnd);
|
||||
}
|
||||
if (TaskManagerSettings.View_LargeIcons)
|
||||
|
@ -669,8 +687,8 @@ static void TaskManager_OnTabWndSelChange(void)
|
|||
ShowWindow(hProcessPage, SW_SHOW);
|
||||
ShowWindow(hPerformancePage, SW_HIDE);
|
||||
BringWindowToTop(hProcessPage);
|
||||
AppendMenu(hViewMenu, MF_STRING, ID_VIEW_SELECTCOLUMNS, _T("&Select Columns..."));
|
||||
AppendMenu(hOptionsMenu, MF_STRING, ID_OPTIONS_SHOW16BITTASKS, _T("&Show 16-bit tasks"));
|
||||
AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_SELECTCOLUMNS, wszSelectColumns);
|
||||
AppendMenuW(hOptionsMenu, MF_STRING, ID_OPTIONS_SHOW16BITTASKS, wszShow16bTasks);
|
||||
if (TaskManagerSettings.Show16BitTasks)
|
||||
CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_CHECKED);
|
||||
if (GetMenuItemCount(hMenu) > 4)
|
||||
|
@ -694,10 +712,10 @@ static void TaskManager_OnTabWndSelChange(void)
|
|||
DrawMenuBar(hMainWnd);
|
||||
}
|
||||
hSubMenu = CreatePopupMenu();
|
||||
AppendMenu(hSubMenu, MF_STRING, ID_VIEW_CPUHISTORY_ONEGRAPHALL, _T("&One Graph, All CPUs"));
|
||||
AppendMenu(hSubMenu, MF_STRING, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, _T("One Graph &Per CPU"));
|
||||
AppendMenu(hViewMenu, MF_STRING|MF_POPUP, (UINT_PTR)hSubMenu, _T("&CPU History"));
|
||||
AppendMenu(hViewMenu, MF_STRING, ID_VIEW_SHOWKERNELTIMES, _T("&Show Kernel Times"));
|
||||
AppendMenuW(hSubMenu, MF_STRING, ID_VIEW_CPUHISTORY_ONEGRAPHALL, wszOneGraphAllCPU);
|
||||
AppendMenuW(hSubMenu, MF_STRING, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, wszOneGraphPerCPU);
|
||||
AppendMenuW(hViewMenu, MF_STRING|MF_POPUP, (UINT_PTR)hSubMenu, wszCPUHistory);
|
||||
AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_SHOWKERNELTIMES, wszShowKernelTimes);
|
||||
if (TaskManagerSettings.ShowKernelTimes)
|
||||
CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED);
|
||||
else
|
||||
|
@ -714,30 +732,31 @@ static void TaskManager_OnTabWndSelChange(void)
|
|||
}
|
||||
}
|
||||
|
||||
LPTSTR GetLastErrorText(LPTSTR lpszBuf, DWORD dwSize)
|
||||
LPWSTR GetLastErrorText(LPWSTR lpwszBuf, DWORD dwSize)
|
||||
{
|
||||
DWORD dwRet;
|
||||
LPTSTR lpszTemp = NULL;
|
||||
LPWSTR lpwszTemp = NULL;
|
||||
static const WCHAR wszFormat[] = {'%','s',' ','(','%','u',')',0};
|
||||
|
||||
dwRet = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
||||
dwRet = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
LANG_NEUTRAL,
|
||||
(LPTSTR)&lpszTemp,
|
||||
(LPWSTR)&lpwszTemp,
|
||||
0,
|
||||
NULL );
|
||||
|
||||
/* supplied buffer is not long enough */
|
||||
if (!dwRet || ( (long)dwSize < (long)dwRet+14)) {
|
||||
lpszBuf[0] = TEXT('\0');
|
||||
lpwszBuf[0] = '\0';
|
||||
} else {
|
||||
lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); /* remove cr and newline character */
|
||||
_stprintf(lpszBuf, TEXT("%s (%u)"), lpszTemp, GetLastError());
|
||||
lpwszTemp[strlenW(lpwszTemp)-2] = '\0'; /* remove cr and newline character */
|
||||
sprintfW(lpwszBuf, wszFormat, lpwszTemp, GetLastError());
|
||||
}
|
||||
if (lpszTemp) {
|
||||
LocalFree((HLOCAL)lpszTemp);
|
||||
if (lpwszTemp) {
|
||||
LocalFree((HLOCAL)lpwszTemp);
|
||||
}
|
||||
return lpszBuf;
|
||||
return lpwszBuf;
|
||||
}
|
||||
|
||||
/* Message handler for dialog box. */
|
||||
|
@ -901,7 +920,7 @@ TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
OnTop = ((GetWindowLong(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0);
|
||||
|
||||
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TRAY_POPUP));
|
||||
hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_TRAY_POPUP));
|
||||
hPopupMenu = GetSubMenu(hMenu, 0);
|
||||
|
||||
if(IsWindowVisible(hMainWnd))
|
||||
|
@ -1068,7 +1087,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
return -1;
|
||||
}
|
||||
|
||||
DialogBox(hInst, (LPCTSTR)IDD_TASKMGR_DIALOG, NULL, TaskManagerWndProc);
|
||||
DialogBoxW(hInst, (LPWSTR)IDD_TASKMGR_DIALOG, NULL, TaskManagerWndProc);
|
||||
|
||||
/* Save our settings to the registry */
|
||||
SaveSettings();
|
||||
|
|
|
@ -146,7 +146,7 @@ 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 Font_DrawText(HDC hDC, LPCTSTR lpszText, int x, int y);
|
||||
void Font_DrawText(HDC hDC, LPWSTR lpwszText, int x, int y);
|
||||
|
||||
#define OPTIONS_MENU_INDEX 1
|
||||
|
||||
|
@ -156,7 +156,7 @@ void TaskManager_OnOptionsHideWhenMinimized(void);
|
|||
void TaskManager_OnOptionsShow16BitTasks(void);
|
||||
void TaskManager_OnFileNew(void);
|
||||
|
||||
LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize );
|
||||
LPWSTR GetLastErrorText( LPWSTR lpwszBuf, DWORD dwSize );
|
||||
|
||||
void OnAbout(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue