- Add an #error, when UNICODE is not defined.

Task-Manager makes use of NDK API's, which forces the application to be compiled Unicode-only.
- To make this obvious, change all TCHAR variables and functions to their Unicode counterparts and get rid of the "tchar.h" include.
- Use a Unicode entry-point and 'unicode="yes"' instead of UNICODE and _UNICODE definitions in the rbuild file
- Many indentation fixes

svn path=/trunk/; revision=30031
This commit is contained in:
Colin Finck 2007-10-31 23:26:27 +00:00
parent 16ca3d0bfa
commit a14b40e394
20 changed files with 776 additions and 809 deletions

View file

@ -32,8 +32,8 @@ void OnAbout(void)
INT_PTR CALLBACK
AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hLicenseEditWnd;
TCHAR strLicense[0x1000];
HWND hLicenseEditWnd;
WCHAR strLicense[0x1000];
switch (message)
{

View file

@ -24,8 +24,8 @@
#include <precomp.h>
HANDLE hProcessAffinityHandle;
TCHAR szTemp[256];
TCHAR szTempA[256];
WCHAR szTemp[256];
WCHAR szTempA[256];
static const DWORD dwCpuTable[] = {
IDC_CPU0, IDC_CPU1, IDC_CPU2, IDC_CPU3,
@ -42,10 +42,10 @@ static INT_PTR CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wP
void ProcessPage_OnSetAffinity(void)
{
LV_ITEM lvitem;
ULONG Index;
DWORD dwProcessId;
TCHAR strErrorText[260];
LV_ITEM lvitem;
ULONG Index;
DWORD dwProcessId;
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) {
memset(&lvitem, 0, sizeof(LV_ITEM));
@ -61,8 +61,8 @@ void ProcessPage_OnSetAffinity(void)
return;
hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
if (!hProcessAffinityHandle) {
GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(TCHAR));
LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(TCHAR));
GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR));
LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(WCHAR));
MessageBox(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP);
return;
}
@ -76,10 +76,10 @@ void ProcessPage_OnSetAffinity(void)
INT_PTR CALLBACK
AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
DWORD dwProcessAffinityMask = 0;
DWORD dwSystemAffinityMask = 0;
TCHAR strErrorText[260];
BYTE nCpu;
DWORD dwProcessAffinityMask = 0;
DWORD dwSystemAffinityMask = 0;
WCHAR strErrorText[260];
BYTE nCpu;
switch (message) {
case WM_INITDIALOG:
@ -89,9 +89,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, sizeof(strErrorText) / sizeof(TCHAR));
GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR));
EndDialog(hDlg, 0);
LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(TCHAR));
LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(WCHAR));
MessageBox(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP);
}
@ -143,8 +143,8 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
* of it's cpu time.
*/
if (!dwProcessAffinityMask) {
LoadString(hInst, IDS_MSG_PROCESSONEPRO, szTemp, sizeof(szTemp) / sizeof(TCHAR));
LoadString(hInst, IDS_MSG_INVALIDOPTION, szTempA, sizeof(szTempA) / sizeof(TCHAR));
LoadString(hInst, IDS_MSG_PROCESSONEPRO, szTemp, sizeof(szTemp) / sizeof(WCHAR));
LoadString(hInst, IDS_MSG_INVALIDOPTION, szTempA, sizeof(szTempA) / sizeof(WCHAR));
MessageBox(hDlg, szTemp, szTempA, MB_OK|MB_ICONSTOP);
return TRUE;
}
@ -153,9 +153,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
* Try to set the process affinity
*/
if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask)) {
GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(TCHAR));
GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR));
EndDialog(hDlg, LOWORD(wParam));
LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(TCHAR));
LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(WCHAR));
MessageBox(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP);
}

View file

@ -26,7 +26,7 @@
typedef struct
{
HWND hWnd;
TCHAR szTitle[260];
WCHAR szTitle[260];
HICON hIcon;
BOOL bHung;
} APPLICATION_PAGE_LIST_ITEM, *LPAPPLICATION_PAGE_LIST_ITEM;
@ -42,7 +42,7 @@ static HANDLE hApplicationPageEvent = NULL; /* When this event becomes signa
static BOOL bSortAscending = TRUE;
DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter);
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung);
void AddOrUpdateHwnd(HWND hWnd, WCHAR *szTitle, HICON hIcon, BOOL bHung);
void ApplicationPageUpdate(void);
void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam);
void ApplicationPageShowContextMenu1(void);
@ -60,13 +60,13 @@ BOOL bRestore /* Restore the window if it is minimized */
INT_PTR CALLBACK
ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
RECT rc;
int nXDifference;
int nYDifference;
LV_COLUMN column;
TCHAR szTemp[256];
int cx, cy;
HANDLE hRefreshThread = NULL;
RECT rc;
int nXDifference;
int nYDifference;
LV_COLUMN column;
WCHAR szTemp[256];
int cx, cy;
HANDLE hRefreshThread = NULL;
switch (message) {
case WM_INITDIALOG:
@ -85,7 +85,7 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
hApplicationPageSwitchToButton = GetDlgItem(hDlg, IDC_SWITCHTO);
hApplicationPageNewTaskButton = GetDlgItem(hDlg, IDC_NEWTASK);
SetWindowText(hApplicationPageListCtrl, _T("Tasks"));
SetWindowText(hApplicationPageListCtrl, L"Tasks");
/* Initialize the application page's controls */
column.mask = LVCF_TEXT|LVCF_WIDTH;
@ -194,7 +194,7 @@ void RefreshApplicationPage(void)
void UpdateApplicationListControlViewSetting(void)
{
DWORD dwStyle = GetWindowLong(hApplicationPageListCtrl, GWL_STYLE);
DWORD dwStyle = GetWindowLong(hApplicationPageListCtrl, GWL_STYLE);
dwStyle &= ~LVS_REPORT;
dwStyle &= ~LVS_ICON;
@ -251,11 +251,11 @@ DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter)
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
HICON hIcon;
TCHAR szText[260];
BOOL bLargeIcon;
BOOL bHung = FALSE;
HICON* xhIcon = (HICON*)&hIcon;
HICON hIcon;
WCHAR szText[260];
BOOL bLargeIcon;
BOOL bHung = FALSE;
HICON* xhIcon = (HICON*)&hIcon;
typedef int (FAR __stdcall *IsHungAppWindowProc)(HWND);
IsHungAppWindowProc IsHungAppWindow;
@ -270,7 +270,7 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
GetWindowText(hWnd, szText, 260); /* Get the window text */
/* Check and see if this is a top-level app window */
if ((_tcslen(szText) <= 0) ||
if ((wcslen(szText) <= 0) ||
!IsWindowVisible(hWnd) ||
(GetParent(hWnd) != NULL) ||
(GetWindow(hWnd, GW_OWNER) != NULL) ||
@ -296,7 +296,7 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
bHung = FALSE;
IsHungAppWindow = (IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle(_T("USER32.DLL")), "IsHungAppWindow");
IsHungAppWindow = (IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle(L"USER32.DLL"), "IsHungAppWindow");
if (IsHungAppWindow)
bHung = IsHungAppWindow(hWnd);
@ -306,15 +306,15 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
return TRUE;
}
void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
void AddOrUpdateHwnd(HWND hWnd, WCHAR *szTitle, HICON hIcon, BOOL bHung)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
HIMAGELIST hImageListLarge;
HIMAGELIST hImageListSmall;
LV_ITEM item;
int i;
BOOL bAlreadyInList = FALSE;
BOOL bItemRemoved = FALSE;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
HIMAGELIST hImageListLarge;
HIMAGELIST hImageListSmall;
LV_ITEM item;
int i;
BOOL bAlreadyInList = FALSE;
BOOL bItemRemoved = FALSE;
memset(&item, 0, sizeof(LV_ITEM));
@ -343,13 +343,13 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
{
/* Check to see if anything needs updating */
if ((pAPLI->hIcon != hIcon) ||
(_tcsicmp(pAPLI->szTitle, szTitle) != 0) ||
(wcsicmp(pAPLI->szTitle, szTitle) != 0) ||
(pAPLI->bHung != bHung))
{
/* Update the structure */
pAPLI->hIcon = hIcon;
pAPLI->bHung = bHung;
_tcscpy(pAPLI->szTitle, szTitle);
wcscpy(pAPLI->szTitle, szTitle);
/* Update the image list */
ImageList_ReplaceIcon(hImageListLarge, item.iItem, hIcon);
@ -369,7 +369,7 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
pAPLI->hWnd = hWnd;
pAPLI->hIcon = hIcon;
pAPLI->bHung = bHung;
_tcscpy(pAPLI->szTitle, szTitle);
wcscpy(pAPLI->szTitle, szTitle);
/* Add the item to the list */
memset(&item, 0, sizeof(LV_ITEM));
@ -393,7 +393,7 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;
if (!IsWindow(pAPLI->hWnd)||
(_tcslen(pAPLI->szTitle) <= 0) ||
(wcslen(pAPLI->szTitle) <= 0) ||
!IsWindowVisible(pAPLI->hWnd) ||
(GetParent(pAPLI->hWnd) != NULL) ||
(GetWindow(pAPLI->hWnd, GW_OWNER) != NULL) ||
@ -446,8 +446,8 @@ void ApplicationPageUpdate(void)
/* be present on the menu bar so enable & disable the menu items */
if (TabCtrl_GetCurSel(hTabWnd) == 0)
{
HMENU hMenu;
HMENU hWindowsMenu;
HMENU hMenu;
HMENU hWindowsMenu;
hMenu = GetMenu(hMainWnd);
hWindowsMenu = GetSubMenu(hMenu, 3);
@ -487,12 +487,12 @@ void ApplicationPageUpdate(void)
void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
{
int idctrl;
LPNMHDR pnmh;
LPNM_LISTVIEW pnmv;
LV_DISPINFO* pnmdi;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI;
TCHAR szMsg[256];
int idctrl;
LPNMHDR pnmh;
LPNM_LISTVIEW pnmv;
LV_DISPINFO* pnmdi;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI;
WCHAR szMsg[256];
idctrl = (int) wParam;
@ -512,7 +512,7 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
/* Update the item text */
if (pnmdi->item.iSubItem == 0)
{
_tcsncpy(pnmdi->item.pszText, pAPLI->szTitle, pnmdi->item.cchTextMax);
wcsncpy(pnmdi->item.pszText, pAPLI->szTitle, pnmdi->item.cchTextMax);
}
/* Update the item status */
@ -521,12 +521,12 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
if (pAPLI->bHung)
{
LoadString( GetModuleHandle(NULL), IDS_Not_Responding , szMsg, sizeof(szMsg) / sizeof(szMsg[0]));
_tcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
wcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
}
else
{
LoadString( GetModuleHandle(NULL), IDS_Running, (LPTSTR) szMsg, sizeof(szMsg) / sizeof(szMsg[0]));
_tcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
wcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
}
}
@ -582,9 +582,9 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
void ApplicationPageShowContextMenu1(void)
{
HMENU hMenu;
HMENU hSubMenu;
POINT pt;
HMENU hMenu;
HMENU hSubMenu;
POINT pt;
GetCursorPos(&pt);
@ -605,9 +605,9 @@ void ApplicationPageShowContextMenu1(void)
void ApplicationPageShowContextMenu2(void)
{
HMENU hMenu;
HMENU hSubMenu;
POINT pt;
HMENU hMenu;
HMENU hSubMenu;
POINT pt;
GetCursorPos(&pt);
@ -651,8 +651,8 @@ void ApplicationPageShowContextMenu2(void)
void ApplicationPage_OnViewLargeIcons(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hMenu;
HMENU hViewMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
@ -667,8 +667,8 @@ void ApplicationPage_OnViewLargeIcons(void)
void ApplicationPage_OnViewSmallIcons(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hMenu;
HMENU hViewMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
@ -683,8 +683,8 @@ void ApplicationPage_OnViewSmallIcons(void)
void ApplicationPage_OnViewDetails(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hMenu;
HMENU hViewMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
@ -699,11 +699,11 @@ void ApplicationPage_OnViewDetails(void)
void ApplicationPage_OnWindowsTileHorizontally(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
HWND* hWndArray;
int nWndCount;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
HWND* hWndArray;
int nWndCount;
hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
nWndCount = 0;
@ -730,11 +730,11 @@ void ApplicationPage_OnWindowsTileHorizontally(void)
void ApplicationPage_OnWindowsTileVertically(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
HWND* hWndArray;
int nWndCount;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
HWND* hWndArray;
int nWndCount;
hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
nWndCount = 0;
@ -761,9 +761,9 @@ void ApplicationPage_OnWindowsTileVertically(void)
void ApplicationPage_OnWindowsMinimize(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM));
@ -782,9 +782,9 @@ void ApplicationPage_OnWindowsMinimize(void)
void ApplicationPage_OnWindowsMaximize(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM));
@ -803,11 +803,11 @@ void ApplicationPage_OnWindowsMaximize(void)
void ApplicationPage_OnWindowsCascade(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
HWND* hWndArray;
int nWndCount;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
HWND* hWndArray;
int nWndCount;
hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
nWndCount = 0;
@ -832,9 +832,9 @@ void ApplicationPage_OnWindowsCascade(void)
void ApplicationPage_OnWindowsBringToFront(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM));
@ -856,9 +856,9 @@ void ApplicationPage_OnWindowsBringToFront(void)
void ApplicationPage_OnSwitchTo(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM));
@ -876,7 +876,7 @@ void ApplicationPage_OnSwitchTo(void)
typedef void (WINAPI *PROCSWITCHTOTHISWINDOW) (HWND, BOOL);
PROCSWITCHTOTHISWINDOW SwitchToThisWindow;
HMODULE hUser32 = GetModuleHandle(_T("USER32"));
HMODULE hUser32 = GetModuleHandle(L"USER32");
SwitchToThisWindow = (PROCSWITCHTOTHISWINDOW)GetProcAddress(hUser32, "SwitchToThisWindow");
if (SwitchToThisWindow) {
SwitchToThisWindow(pAPLI->hWnd, TRUE);
@ -893,9 +893,9 @@ void ApplicationPage_OnSwitchTo(void)
void ApplicationPage_OnEndTask(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM));
@ -914,9 +914,9 @@ void ApplicationPage_OnEndTask(void)
void ApplicationPage_OnGotoProcess(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
int i;
/* NMHDR nmhdr; */
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
@ -957,8 +957,8 @@ void ApplicationPage_OnGotoProcess(void)
int CALLBACK ApplicationPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
LPAPPLICATION_PAGE_LIST_ITEM Param1;
LPAPPLICATION_PAGE_LIST_ITEM Param2;
LPAPPLICATION_PAGE_LIST_ITEM Param1;
LPAPPLICATION_PAGE_LIST_ITEM Param2;
if (bSortAscending) {
Param1 = (LPAPPLICATION_PAGE_LIST_ITEM)lParam1;
@ -967,5 +967,5 @@ int CALLBACK ApplicationPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM l
Param1 = (LPAPPLICATION_PAGE_LIST_ITEM)lParam2;
Param2 = (LPAPPLICATION_PAGE_LIST_ITEM)lParam1;
}
return _tcscmp(Param1->szTitle, Param2->szTitle);
return wcscmp(Param1->szTitle, Param2->szTitle);
}

View file

@ -24,7 +24,7 @@
#include <precomp.h>
UINT ColumnDataHints[COLUMN_NMAX];
TCHAR szTemp[256];
WCHAR szTemp[256];
#define DECLARE_COLUMN_PRESET(_name, _size, _state) \
{ IDS_TAB_##_name, IDC_##_name, _size, _state },
@ -62,13 +62,13 @@ INT_PTR CALLBACK ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam,
void AddColumns(void)
{
LRESULT size;
TCHAR szTemp[256];
unsigned int n;
LRESULT size;
WCHAR szTemp[256];
unsigned int n;
for (n=0; n<COLUMN_NMAX; n++) {
if (TaskManagerSettings.Columns[n]) {
LoadString(hInst, ColumnPresets[n].dwIdsName, szTemp, sizeof(szTemp)/sizeof(TCHAR));
LoadString(hInst, ColumnPresets[n].dwIdsName, szTemp, sizeof(szTemp)/sizeof(WCHAR));
InsertColumn(n, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[n], -1);
}
}
@ -81,7 +81,7 @@ void AddColumns(void)
int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem)
{
LVCOLUMN column;
LVCOLUMN column;
column.mask = LVCF_TEXT|LVCF_FMT;
column.pszText = (LPTSTR)lpszColumnHeading;
@ -104,10 +104,10 @@ int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat, int nWidth, i
void SaveColumnSettings(void)
{
HDITEM hditem;
unsigned int i, n;
TCHAR text[260];
LRESULT size;
HDITEM hditem;
unsigned int i, n;
WCHAR text[260];
LRESULT size;
/* Reset column data */
for (i=0; i<COLUMN_NMAX; i++) {
@ -131,8 +131,8 @@ void SaveColumnSettings(void)
SendMessage(hProcessPageHeaderCtrl, HDM_GETITEM, i, (LPARAM) &hditem);
for (n=0; n<COLUMN_NMAX; n++) {
LoadString(hInst, ColumnPresets[n].dwIdsName, szTemp, sizeof(szTemp)/sizeof(TCHAR));
if (_tcsicmp(text, szTemp) == 0)
LoadString(hInst, ColumnPresets[n].dwIdsName, szTemp, sizeof(szTemp)/sizeof(WCHAR));
if (wcsicmp(text, szTemp) == 0)
{
TaskManagerSettings.Columns[n] = TRUE;
TaskManagerSettings.ColumnSizeArray[n] = hditem.cxy;
@ -143,7 +143,7 @@ void SaveColumnSettings(void)
void ProcessPage_OnViewSelectColumns(void)
{
int i;
int i;
if (DialogBox(hInst, MAKEINTRESOURCE(IDD_COLUMNS_DIALOG), hMainWnd, ColumnsDialogWndProc) == IDOK)
{
@ -164,7 +164,7 @@ void ProcessPage_OnViewSelectColumns(void)
INT_PTR CALLBACK
ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
unsigned int i;
unsigned int i;
switch (message)
{
@ -201,11 +201,11 @@ ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
void UpdateColumnDataHints(void)
{
HDITEM hditem;
TCHAR text[260];
ULONG Index;
TCHAR szTemp[256];
unsigned int i;
HDITEM hditem;
WCHAR text[260];
ULONG Index;
WCHAR szTemp[256];
unsigned int i;
for (Index=0; Index<(ULONG)SendMessage(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0); Index++)
{
@ -218,8 +218,8 @@ void UpdateColumnDataHints(void)
SendMessage(hProcessPageHeaderCtrl, HDM_GETITEM, Index, (LPARAM) &hditem);
for (i=0; i<COLUMN_NMAX; i++) {
LoadString(hInst, ColumnPresets[i].dwIdsName, szTemp, sizeof(szTemp)/sizeof(TCHAR));
if (_tcsicmp(text, szTemp) == 0)
LoadString(hInst, ColumnPresets[i].dwIdsName, szTemp, sizeof(szTemp)/sizeof(WCHAR));
if (wcsicmp(text, szTemp) == 0)
ColumnDataHints[Index] = i;
}
}

View file

@ -44,9 +44,9 @@ BOOL DebugChannelsAreSupported(void)
static DWORD get_selected_pid(void)
{
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{
@ -69,13 +69,13 @@ static DWORD get_selected_pid(void)
return dwProcessId;
}
static int list_channel_CB(HANDLE hProcess, void* addr, TCHAR* buffer, void* user)
static int list_channel_CB(HANDLE hProcess, void* addr, WCHAR* buffer, void* user)
{
int j;
TCHAR val[2];
LVITEM lvi;
int index;
HWND hChannelLV = (HWND)user;
int j;
WCHAR val[2];
LVITEM lvi;
int index;
HWND hChannelLV = (HWND)user;
memset(&lvi, 0, sizeof(lvi));
@ -85,10 +85,10 @@ static int list_channel_CB(HANDLE hProcess, void* addr, TCHAR* buffer, void*
index = ListView_InsertItem(hChannelLV, &lvi);
if (index == -1) return 0;
val[1] = TEXT('\0');
val[1] = L'\0';
for (j = 0; j < 4; j++)
{
val[0] = (buffer[0] & (1 << j)) ? TEXT('x') : TEXT(' ');
val[0] = (buffer[0] & (1 << j)) ? L'x' : L' ';
ListView_SetItemText(hChannelLV, index, j + 1, val);
}
return 1;
@ -96,10 +96,10 @@ static int list_channel_CB(HANDLE hProcess, void* addr, TCHAR* buffer, void*
struct cce_user
{
LPCTSTR name; /* channel to look for */
unsigned value, mask; /* how to change channel */
unsigned done; /* number of successful changes */
unsigned notdone; /* number of unsuccessful changes */
LPCTSTR name; /* channel to look for */
unsigned value, mask; /* how to change channel */
unsigned done; /* number of successful changes */
unsigned notdone; /* number of unsuccessful changes */
};
/******************************************************************
@ -107,11 +107,11 @@ struct cce_user
*
* Callback used for changing a given channel attributes
*/
static int change_channel_CB(HANDLE hProcess, void* addr, TCHAR* buffer, void* pmt)
static int change_channel_CB(HANDLE hProcess, void* addr, WCHAR* buffer, void* pmt)
{
struct cce_user* user = (struct cce_user*)pmt;
struct cce_user* user = (struct cce_user*)pmt;
if (!user->name || !_tcscmp(buffer + 1, user->name))
if (!user->name || !wcscmp(buffer + 1, user->name))
{
buffer[0] = (buffer[0] & ~user->mask) | (user->value & user->mask);
if (WriteProcessMemory(hProcess, addr, buffer, 1, NULL))
@ -161,7 +161,7 @@ void* get_symbol(HANDLE hProcess, const char* name, const char* lib)
if (!(h = wine_dlopen(lib, RTLD_LAZY, buffer, sizeof(buffer))))
{
printf("Couldn't load %s (%s)\n", lib, buffer);
return NULL;
return NULL;
}
env = getenv("LD_LIBRARY_PATH");
@ -182,14 +182,14 @@ void* get_symbol(HANDLE hProcess, const char* name, const char* lib)
free(env);
if (!ptr)
{
printf("Couldn't find %s in LD_LIBRARY_PATH\n", lib);
return NULL;
}
printf("Couldn't find %s in LD_LIBRARY_PATH\n", lib);
return NULL;
}
}
if (!(f = popen(buffer, "r")))
{
printf("Cannot execute '%s'\n", buffer);
return NULL;
return NULL;
}
while (fgets(buffer, sizeof(buffer), f))
@ -216,13 +216,13 @@ void* get_symbol(HANDLE hProcess, const char* name, const char* lib)
struct dll_option_layout
{
void* next;
void* prev;
char* const* channels;
unsigned int nb_channels;
void* next;
void* prev;
char* const* channels;
unsigned int nb_channels;
};
typedef int (*EnumChannelCB)(HANDLE, void*, TCHAR*, void*);
typedef int (*EnumChannelCB)(HANDLE, void*, WCHAR*, void*);
/******************************************************************
* enum_channel
@ -232,18 +232,18 @@ typedef int (*EnumChannelCB)(HANDLE, void*, TCHAR*, void*);
*/
static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned unique)
{
struct dll_option_layout dol;
int ret = 1;
void* buf_addr;
TCHAR buffer[32];
void* addr;
const TCHAR** cache = NULL;
unsigned i, j, num_cache, used_cache;
struct dll_option_layout dol;
int ret = 1;
void* buf_addr;
WCHAR buffer[32];
void* addr;
const WCHAR** cache = NULL;
unsigned i, j, num_cache, used_cache;
addr = get_symbol(hProcess, "first_dll", "libwine.so");
if (!addr) return -1;
if (unique)
cache = HeapAlloc(GetProcessHeap(), 0, (num_cache = 32) * sizeof(TCHAR*));
cache = HeapAlloc(GetProcessHeap(), 0, (num_cache = 32) * sizeof(WCHAR*));
else
num_cache = 0;
used_cache = 0;
@ -265,11 +265,11 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned
* them again
*/
for (j = 0; j < used_cache; j++)
if (!_tcscmp(cache[j], buffer + 1)) break;
if (!wcscmp(cache[j], buffer + 1)) break;
if (j != used_cache) continue;
if (used_cache == num_cache)
cache = HeapReAlloc(GetProcessHeap(), 0, cache, (num_cache *= 2) * sizeof(TCHAR*));
cache[used_cache++] = _tcscpy(HeapAlloc(GetProcessHeap(), 0, (_tcslen(buffer + 1) + 1) * sizeof(TCHAR)),
cache = HeapReAlloc(GetProcessHeap(), 0, cache, (num_cache *= 2) * sizeof(WCHAR*));
cache[used_cache++] = wcscpy(HeapAlloc(GetProcessHeap(), 0, (wcslen(buffer + 1) + 1) * sizeof(WCHAR)),
buffer + 1);
}
ret = ce(hProcess, buf_addr, buffer, user);
@ -278,7 +278,7 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned
}
if (unique)
{
for (j = 0; j < used_cache; j++) HeapFree(GetProcessHeap(), 0, (TCHAR*)cache[j]);
for (j = 0; j < used_cache; j++) HeapFree(GetProcessHeap(), 0, (WCHAR*)cache[j]);
HeapFree(GetProcessHeap(), 0, cache);
}
return 0;
@ -286,7 +286,7 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned
static void DebugChannels_FillList(HWND hChannelLV)
{
HANDLE hProcess;
HANDLE hProcess;
(void)ListView_DeleteAllItems(hChannelLV);
@ -300,36 +300,36 @@ static void DebugChannels_FillList(HWND hChannelLV)
static void DebugChannels_OnCreate(HWND hwndDlg)
{
HWND hLV = GetDlgItem(hwndDlg, IDC_DEBUG_CHANNELS_LIST);
LVCOLUMN lvc;
HWND hLV = GetDlgItem(hwndDlg, IDC_DEBUG_CHANNELS_LIST);
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT;
lvc.pszText = _T("Debug Channel");
lvc.pszText = L"Debug Channel";
lvc.cx = 100;
(void)ListView_InsertColumn(hLV, 0, &lvc);
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_CENTER;
lvc.pszText = _T("Fixme");
lvc.pszText = L"Fixme";
lvc.cx = 55;
(void)ListView_InsertColumn(hLV, 1, &lvc);
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_CENTER;
lvc.pszText = _T("Err");
lvc.pszText = L"Err";
lvc.cx = 55;
(void)ListView_InsertColumn(hLV, 2, &lvc);
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_CENTER;
lvc.pszText = _T("Warn");
lvc.pszText = L"Warn";
lvc.cx = 55;
(void)ListView_InsertColumn(hLV, 3, &lvc);
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_CENTER;
lvc.pszText = _T("Trace");
lvc.pszText = L"Trace";
lvc.cx = 55;
(void)ListView_InsertColumn(hLV, 4, &lvc);
@ -338,17 +338,17 @@ static void DebugChannels_OnCreate(HWND hwndDlg)
static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam)
{
NMHDR* nmh = (NMHDR*)lParam;
NMHDR* nmh = (NMHDR*)lParam;
switch (nmh->code)
{
case NM_CLICK:
if (nmh->idFrom == IDC_DEBUG_CHANNELS_LIST)
{
LVHITTESTINFO lhti;
HWND hChannelLV;
HANDLE hProcess;
NMITEMACTIVATE* nmia = (NMITEMACTIVATE*)lParam;
LVHITTESTINFO lhti;
HWND hChannelLV;
HANDLE hProcess;
NMITEMACTIVATE* nmia = (NMITEMACTIVATE*)lParam;
hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, get_selected_pid());
if (!hProcess) return; /* FIXME message box */
@ -357,21 +357,21 @@ static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam)
SendMessage(hChannelLV, LVM_SUBITEMHITTEST, 0, (LPARAM)&lhti);
if (nmia->iSubItem >= 1 && nmia->iSubItem <= 4)
{
TCHAR val[2];
TCHAR name[32];
unsigned bitmask = 1 << (lhti.iSubItem - 1);
struct cce_user user;
WCHAR val[2];
WCHAR name[32];
unsigned bitmask = 1 << (lhti.iSubItem - 1);
struct cce_user user;
ListView_GetItemText(hChannelLV, lhti.iItem, 0, name, sizeof(name) / sizeof(name[0]));
ListView_GetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val, sizeof(val) / sizeof(val[0]));
user.name = name;
user.value = (val[0] == TEXT('x')) ? 0 : bitmask;
user.value = (val[0] == L'x') ? 0 : bitmask;
user.mask = bitmask;
user.done = user.notdone = 0;
enum_channel(hProcess, change_channel_CB, &user, FALSE);
if (user.done)
{
val[0] ^= (TEXT('x') ^ TEXT(' '));
val[0] ^= (L'x' ^ L' ');
ListView_SetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val);
}
if (user.notdone)

View file

@ -28,16 +28,16 @@ void ProcessPage_OnDebug(void)
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
TCHAR strErrorText[260];
WCHAR strErrorText[260];
HKEY hKey;
TCHAR strDebugPath[260];
TCHAR strDebugger[260];
WCHAR strDebugPath[260];
WCHAR strDebugger[260];
DWORD dwDebuggerSize;
PROCESS_INFORMATION pi;
STARTUPINFO si;
HANDLE hDebugEvent;
TCHAR szTemp[256];
TCHAR szTempA[256];
WCHAR szTemp[256];
WCHAR szTempA[256];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
@ -70,7 +70,7 @@ void ProcessPage_OnDebug(void)
return;
}
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug"), 0, KEY_READ, &hKey) != ERROR_SUCCESS)
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
{
GetLastErrorText(strErrorText, 260);
LoadString(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256);
@ -79,7 +79,7 @@ void ProcessPage_OnDebug(void)
}
dwDebuggerSize = 260;
if (RegQueryValueEx(hKey, _T("Debugger"), NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) != ERROR_SUCCESS)
if (RegQueryValueEx(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) != ERROR_SUCCESS)
{
GetLastErrorText(strErrorText, 260);
LoadString(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256);

View file

@ -23,16 +23,16 @@
#include <precomp.h>
TCHAR szTemp[256];
TCHAR szTempA[256];
WCHAR szTemp[256];
WCHAR szTempA[256];
void ProcessPage_OnEndProcess(void)
{
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
TCHAR strErrorText[260];
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{
@ -80,11 +80,11 @@ void ProcessPage_OnEndProcess(void)
void ProcessPage_OnEndProcessTree(void)
{
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
TCHAR strErrorText[260];
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{

View file

@ -22,20 +22,20 @@
#include <precomp.h>
int nlastBarsUsed = 0;
int nlastBarsUsed = 0;
WNDPROC OldGraphWndProc;
WNDPROC OldGraphWndProc;
void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd);
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd);
void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd);
void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd);
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd);
void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd);
INT_PTR CALLBACK
Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
LONG WindowId;
HDC hdc;
PAINTSTRUCT ps;
LONG WindowId;
switch (message)
{
@ -131,23 +131,23 @@ Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
{
RECT rcClient;
RECT rcBarLeft;
RECT rcBarRight;
RECT rcText;
COLORREF crPrevForeground;
TCHAR Text[260];
HFONT hOldFont;
ULONG CpuUsage;
ULONG CpuKernelUsage;
int nBars;
int nBarsUsed;
RECT rcClient;
RECT rcBarLeft;
RECT rcBarRight;
RECT rcText;
COLORREF crPrevForeground;
WCHAR Text[260];
HFONT hOldFont;
ULONG CpuUsage;
ULONG CpuKernelUsage;
int nBars;
int nBarsUsed;
/* Bottom bars that are "used", i.e. are bright green, representing used cpu time */
int nBarsUsedKernel;
int nBarsUsedKernel;
/* Bottom bars that are "used", i.e. are bright green, representing used cpu kernel time */
int nBarsFree;
int nBarsFree;
/* Top bars that are "unused", i.e. are dark green, representing free cpu time */
int i;
int i;
/*
* Get the client area rectangle
@ -163,10 +163,10 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
* Get the CPU usage
*/
CpuUsage = PerfDataGetProcessorUsage();
if (CpuUsage <= 0) CpuUsage = 0;
if (CpuUsage > 100) CpuUsage = 100;
if (CpuUsage <= 0) CpuUsage = 0;
if (CpuUsage > 100) CpuUsage = 100;
_stprintf(Text, _T("%d%%"), (int)CpuUsage);
wsprintf(Text, L"%d%%", (int)CpuUsage);
/*
* Draw the font text onto the graph
@ -240,22 +240,22 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
/*
* Draw the last "used" bars
*/
if ((nlastBarsUsed - nBarsUsed) > 0) {
for (i=0; i< (nlastBarsUsed - nBarsUsed); i++)
{
if (nlastBarsUsed > 5000) nlastBarsUsed = 5000;
if ((nlastBarsUsed - nBarsUsed) > 0) {
for (i=0; i< (nlastBarsUsed - nBarsUsed); i++)
{
if (nlastBarsUsed > 5000) nlastBarsUsed = 5000;
FillSolidRect(hDC, &rcBarLeft, MEDIUM_GREEN);
FillSolidRect(hDC, &rcBarRight, MEDIUM_GREEN);
FillSolidRect(hDC, &rcBarLeft, MEDIUM_GREEN);
FillSolidRect(hDC, &rcBarRight, MEDIUM_GREEN);
rcBarLeft.top += 3;
rcBarLeft.bottom += 3;
rcBarLeft.top += 3;
rcBarLeft.bottom += 3;
rcBarRight.top += 3;
rcBarRight.bottom += 3;
}
}
nlastBarsUsed = nBarsUsed;
rcBarRight.top += 3;
rcBarRight.bottom += 3;
}
}
nlastBarsUsed = nBarsUsed;
/*
* Draw the "used" bars
*/
@ -302,21 +302,21 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
{
RECT rcClient;
RECT rcBarLeft;
RECT rcBarRight;
RECT rcText;
COLORREF crPrevForeground;
TCHAR Text[260];
HFONT hOldFont;
ULONGLONG CommitChargeTotal;
ULONGLONG CommitChargeLimit;
int nBars;
int nBarsUsed = 0;
RECT rcClient;
RECT rcBarLeft;
RECT rcBarRight;
RECT rcText;
COLORREF crPrevForeground;
WCHAR Text[260];
HFONT hOldFont;
ULONGLONG CommitChargeTotal;
ULONGLONG CommitChargeLimit;
int nBars;
int nBarsUsed = 0;
/* Bottom bars that are "used", i.e. are bright green, representing used memory */
int nBarsFree;
int nBarsFree;
/* Top bars that are "unused", i.e. are dark green, representing free memory */
int i;
int i;
/*
* Get the client area rectangle
@ -335,9 +335,9 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
if (CommitChargeTotal > 1024)
_stprintf(Text, _T("%d MB"), (int)(CommitChargeTotal / 1024));
else
_stprintf(Text, _T("%d K"), (int)CommitChargeTotal);
wsprintf(Text, L"%d MB", (int)(CommitChargeTotal / 1024));
else
wsprintf(Text, L"%d K", (int)CommitChargeTotal);
/*
* Draw the font text onto the graph
*/
@ -409,10 +409,10 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd)
{
RECT rcClient;
ULONGLONG CommitChargeLimit;
int i;
static int offset = 0;
RECT rcClient;
ULONGLONG CommitChargeLimit;
int i;
static int offset = 0;
if (offset++ >= 10)
offset = 0;

View file

@ -301,12 +301,12 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this, BOOL bResize)
SetTextColor(m_dcGrid, m_crGridColor);
SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP);
sprintf(strTemp, "%.*lf", m_nYDecimals, m_dUpperLimit);
TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.top, strTemp, _tcslen(strTemp));
TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.top, strTemp, wcslen(strTemp));
/* y min */
SetTextAlign(m_dcGrid, TA_RIGHT|TA_BASELINE);
sprintf(strTemp, "%.*lf", m_nYDecimals, m_dLowerLimit);
TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.bottom, strTemp, _tcslen(strTemp));
TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.bottom, strTemp, wcslen(strTemp));
/* x min */
SetTextAlign(m_dcGrid, TA_LEFT|TA_TOP);
@ -315,12 +315,12 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this, BOOL bResize)
/* x max */
SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP);
sprintf(strTemp, "%d", m_nPlotWidth/m_nShiftPixels);
TextOut(m_dcGrid, m_rectPlot.right, m_rectPlot.bottom+4, strTemp, _tcslen(strTemp));
TextOut(m_dcGrid, m_rectPlot.right, m_rectPlot.bottom+4, strTemp, wcslen(strTemp));
/* x units */
SetTextAlign(m_dcGrid, TA_CENTER|TA_TOP);
TextOut(m_dcGrid, (m_rectPlot.left+m_rectPlot.right)/2,
m_rectPlot.bottom+4, m_strXUnitsString, _tcslen(m_strXUnitsString));
m_rectPlot.bottom+4, m_strXUnitsString, wcslen(m_strXUnitsString));
/* restore the font */
SelectObject(m_dcGrid, oldFont);
@ -329,7 +329,7 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this, BOOL bResize)
oldFont = (HFONT)SelectObject(m_dcGrid, yUnitFont);
SetTextAlign(m_dcGrid, TA_CENTER|TA_BASELINE);
TextOut(m_dcGrid, (m_rectClient.left+m_rectPlot.left)/2,
(m_rectPlot.bottom+m_rectPlot.top)/2, m_strYUnitsString, _tcslen(m_strYUnitsString));
(m_rectPlot.bottom+m_rectPlot.top)/2, m_strYUnitsString, wcslen(m_strYUnitsString));
SelectObject(m_dcGrid, oldFont);
#endif
/* at this point we are done filling the the grid bitmap, */

View file

@ -30,8 +30,8 @@
void TaskManager_OnOptionsAlwaysOnTop(void)
{
HMENU hMenu;
HMENU hOptionsMenu;
HMENU hMenu;
HMENU hOptionsMenu;
hMenu = GetMenu(hMainWnd);
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
@ -56,8 +56,8 @@ void TaskManager_OnOptionsAlwaysOnTop(void)
void TaskManager_OnOptionsMinimizeOnUse(void)
{
HMENU hMenu;
HMENU hOptionsMenu;
HMENU hMenu;
HMENU hOptionsMenu;
hMenu = GetMenu(hMainWnd);
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
@ -79,8 +79,8 @@ void TaskManager_OnOptionsMinimizeOnUse(void)
void TaskManager_OnOptionsHideWhenMinimized(void)
{
HMENU hMenu;
HMENU hOptionsMenu;
HMENU hMenu;
HMENU hOptionsMenu;
hMenu = GetMenu(hMainWnd);
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
@ -102,8 +102,8 @@ void TaskManager_OnOptionsHideWhenMinimized(void)
void TaskManager_OnOptionsShow16BitTasks(void)
{
HMENU hMenu;
HMENU hOptionsMenu;
HMENU hMenu;
HMENU hOptionsMenu;
hMenu = GetMenu(hMainWnd);
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);

View file

@ -22,23 +22,23 @@
#include <precomp.h>
CRITICAL_SECTION PerfDataCriticalSection;
PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */
PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */
ULONG ProcessCountOld = 0;
ULONG ProcessCount = 0;
double dbIdleTime;
double dbKernelTime;
double dbSystemTime;
LARGE_INTEGER liOldIdleTime = {{0,0}};
double OldKernelTime = 0;
LARGE_INTEGER liOldSystemTime = {{0,0}};
SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo;
SYSTEM_BASIC_INFORMATION SystemBasicInfo;
SYSTEM_FILECACHE_INFORMATION SystemCacheInfo;
SYSTEM_HANDLE_INFORMATION SystemHandleInfo;
PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo = NULL;
PSID SystemUserSid = NULL;
CRITICAL_SECTION PerfDataCriticalSection;
PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */
PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */
ULONG ProcessCountOld = 0;
ULONG ProcessCount = 0;
double dbIdleTime;
double dbKernelTime;
double dbSystemTime;
LARGE_INTEGER liOldIdleTime = {{0,0}};
double OldKernelTime = 0;
LARGE_INTEGER liOldSystemTime = {{0,0}};
SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo;
SYSTEM_BASIC_INFORMATION SystemBasicInfo;
SYSTEM_FILECACHE_INFORMATION SystemCacheInfo;
SYSTEM_HANDLE_INFORMATION SystemHandleInfo;
PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo = NULL;
PSID SystemUserSid = NULL;
BOOL PerfDataInitialize(void)
{
@ -78,7 +78,7 @@ void PerfDataUninitialize(void)
static void SidToUserName(PSID Sid, LPTSTR szBuffer, DWORD BufferSize)
{
static TCHAR szDomainNameUnused[255];
static WCHAR szDomainNameUnused[255];
DWORD DomainNameLen = sizeof(szDomainNameUnused) / sizeof(szDomainNameUnused[0]);
SID_NAME_USE Use;
@ -88,24 +88,24 @@ static void SidToUserName(PSID Sid, LPTSTR szBuffer, DWORD BufferSize)
void PerfDataRefresh(void)
{
SIZE_T ulSize;
NTSTATUS status;
LPBYTE pBuffer;
ULONG BufferSize;
PSYSTEM_PROCESS_INFORMATION pSPI;
PPERFDATA pPDOld;
ULONG Idx, Idx2;
HANDLE hProcess;
HANDLE hProcessToken;
SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo;
SYSTEM_TIMEOFDAY_INFORMATION SysTimeInfo;
SYSTEM_FILECACHE_INFORMATION SysCacheInfo;
LPBYTE SysHandleInfoData;
PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcessorTimeInfo;
double CurrentKernelTime;
PSECURITY_DESCRIPTOR ProcessSD;
PSID ProcessUser;
ULONG Buffer[64]; /* must be 4 bytes aligned! */
SIZE_T ulSize;
NTSTATUS status;
LPBYTE pBuffer;
ULONG BufferSize;
PSYSTEM_PROCESS_INFORMATION pSPI;
PPERFDATA pPDOld;
ULONG Idx, Idx2;
HANDLE hProcess;
HANDLE hProcessToken;
SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo;
SYSTEM_TIMEOFDAY_INFORMATION SysTimeInfo;
SYSTEM_FILECACHE_INFORMATION SysCacheInfo;
LPBYTE SysHandleInfoData;
PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcessorTimeInfo;
double CurrentKernelTime;
PSECURITY_DESCRIPTOR ProcessSD;
PSID ProcessUser;
ULONG Buffer[64]; /* must be 4 bytes aligned! */
/* Get new system time */
status = NtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0);
@ -260,8 +260,8 @@ void PerfDataRefresh(void)
if (pSPI->ImageName.Buffer)
wcscpy(pPerfData[Idx].ImageName, pSPI->ImageName.Buffer);
else
LoadStringW(hInst, IDS_IDLE_PROCESS, pPerfData[Idx].ImageName,
sizeof(pPerfData[Idx].ImageName) / sizeof(pPerfData[Idx].ImageName[0]));
LoadString(hInst, IDS_IDLE_PROCESS, pPerfData[Idx].ImageName,
sizeof(pPerfData[Idx].ImageName) / sizeof(pPerfData[Idx].ImageName[0]));
pPerfData[Idx].ProcessId = pSPI->UniqueProcessId;
@ -291,7 +291,7 @@ void PerfDataRefresh(void)
pPerfData[Idx].HandleCount = pSPI->HandleCount;
pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads;
pPerfData[Idx].SessionId = pSPI->SessionId;
pPerfData[Idx].UserName[0] = _T('\0');
pPerfData[Idx].UserName[0] = L'\0';
pPerfData[Idx].USERObjectCount = 0;
pPerfData[Idx].GDIObjectCount = 0;
ProcessUser = SystemUserSid;
@ -370,17 +370,12 @@ ULONG PerfDataGetProcessorSystemUsage(void)
BOOL PerfDataGetImageName(ULONG Index, LPTSTR lpImageName, int nMaxCount)
{
BOOL bSuccessful;
BOOL bSuccessful;
EnterCriticalSection(&PerfDataCriticalSection);
if (Index < ProcessCount) {
#ifdef _UNICODE
wcsncpy(lpImageName, pPerfData[Index].ImageName, nMaxCount);
#else
WideCharToMultiByte(CP_ACP, 0, pPerfData[Index].ImageName, -1, lpImageName, nMaxCount, NULL, NULL);
#endif
wcsncpy(lpImageName, pPerfData[Index].ImageName, nMaxCount);
bSuccessful = TRUE;
} else {
bSuccessful = FALSE;
@ -411,7 +406,7 @@ int PerfGetIndexByProcessId(DWORD dwProcessId)
ULONG PerfDataGetProcessId(ULONG Index)
{
ULONG ProcessId;
ULONG ProcessId;
EnterCriticalSection(&PerfDataCriticalSection);
@ -427,17 +422,12 @@ ULONG PerfDataGetProcessId(ULONG Index)
BOOL PerfDataGetUserName(ULONG Index, LPTSTR lpUserName, int nMaxCount)
{
BOOL bSuccessful;
BOOL bSuccessful;
EnterCriticalSection(&PerfDataCriticalSection);
if (Index < ProcessCount) {
#ifdef _UNICODE
wcsncpy(lpUserName, pPerfData[Index].UserName, nMaxCount);
#else
WideCharToMultiByte(CP_ACP, 0, pPerfData[Index].UserName, -1, lpUserName, nMaxCount, NULL, NULL);
#endif
wcsncpy(lpUserName, pPerfData[Index].UserName, nMaxCount);
bSuccessful = TRUE;
} else {
bSuccessful = FALSE;
@ -450,7 +440,7 @@ BOOL PerfDataGetUserName(ULONG Index, LPTSTR lpUserName, int nMaxCount)
ULONG PerfDataGetSessionId(ULONG Index)
{
ULONG SessionId;
ULONG SessionId;
EnterCriticalSection(&PerfDataCriticalSection);
@ -466,7 +456,7 @@ ULONG PerfDataGetSessionId(ULONG Index)
ULONG PerfDataGetCPUUsage(ULONG Index)
{
ULONG CpuUsage;
ULONG CpuUsage;
EnterCriticalSection(&PerfDataCriticalSection);
@ -482,7 +472,7 @@ ULONG PerfDataGetCPUUsage(ULONG Index)
LARGE_INTEGER PerfDataGetCPUTime(ULONG Index)
{
LARGE_INTEGER CpuTime = {{0,0}};
LARGE_INTEGER CpuTime = {{0,0}};
EnterCriticalSection(&PerfDataCriticalSection);
@ -496,7 +486,7 @@ LARGE_INTEGER PerfDataGetCPUTime(ULONG Index)
ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index)
{
ULONG WorkingSetSizeBytes;
ULONG WorkingSetSizeBytes;
EnterCriticalSection(&PerfDataCriticalSection);
@ -512,7 +502,7 @@ ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index)
ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index)
{
ULONG PeakWorkingSetSizeBytes;
ULONG PeakWorkingSetSizeBytes;
EnterCriticalSection(&PerfDataCriticalSection);
@ -528,7 +518,7 @@ ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index)
ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index)
{
ULONG WorkingSetSizeDelta;
ULONG WorkingSetSizeDelta;
EnterCriticalSection(&PerfDataCriticalSection);
@ -544,7 +534,7 @@ ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index)
ULONG PerfDataGetPageFaultCount(ULONG Index)
{
ULONG PageFaultCount;
ULONG PageFaultCount;
EnterCriticalSection(&PerfDataCriticalSection);
@ -560,7 +550,7 @@ ULONG PerfDataGetPageFaultCount(ULONG Index)
ULONG PerfDataGetPageFaultCountDelta(ULONG Index)
{
ULONG PageFaultCountDelta;
ULONG PageFaultCountDelta;
EnterCriticalSection(&PerfDataCriticalSection);
@ -576,7 +566,7 @@ ULONG PerfDataGetPageFaultCountDelta(ULONG Index)
ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index)
{
ULONG VirtualMemorySizeBytes;
ULONG VirtualMemorySizeBytes;
EnterCriticalSection(&PerfDataCriticalSection);
@ -592,7 +582,7 @@ ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index)
ULONG PerfDataGetPagedPoolUsagePages(ULONG Index)
{
ULONG PagedPoolUsage;
ULONG PagedPoolUsage;
EnterCriticalSection(&PerfDataCriticalSection);
@ -608,7 +598,7 @@ ULONG PerfDataGetPagedPoolUsagePages(ULONG Index)
ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index)
{
ULONG NonPagedPoolUsage;
ULONG NonPagedPoolUsage;
EnterCriticalSection(&PerfDataCriticalSection);
@ -624,7 +614,7 @@ ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index)
ULONG PerfDataGetBasePriority(ULONG Index)
{
ULONG BasePriority;
ULONG BasePriority;
EnterCriticalSection(&PerfDataCriticalSection);
@ -640,7 +630,7 @@ ULONG PerfDataGetBasePriority(ULONG Index)
ULONG PerfDataGetHandleCount(ULONG Index)
{
ULONG HandleCount;
ULONG HandleCount;
EnterCriticalSection(&PerfDataCriticalSection);
@ -656,7 +646,7 @@ ULONG PerfDataGetHandleCount(ULONG Index)
ULONG PerfDataGetThreadCount(ULONG Index)
{
ULONG ThreadCount;
ULONG ThreadCount;
EnterCriticalSection(&PerfDataCriticalSection);
@ -672,7 +662,7 @@ ULONG PerfDataGetThreadCount(ULONG Index)
ULONG PerfDataGetUSERObjectCount(ULONG Index)
{
ULONG USERObjectCount;
ULONG USERObjectCount;
EnterCriticalSection(&PerfDataCriticalSection);
@ -688,7 +678,7 @@ ULONG PerfDataGetUSERObjectCount(ULONG Index)
ULONG PerfDataGetGDIObjectCount(ULONG Index)
{
ULONG GDIObjectCount;
ULONG GDIObjectCount;
EnterCriticalSection(&PerfDataCriticalSection);
@ -704,7 +694,7 @@ ULONG PerfDataGetGDIObjectCount(ULONG Index)
BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters)
{
BOOL bSuccessful;
BOOL bSuccessful;
EnterCriticalSection(&PerfDataCriticalSection);
@ -723,8 +713,8 @@ BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters)
ULONG PerfDataGetCommitChargeTotalK(void)
{
ULONG Total;
ULONG PageSize;
ULONG Total;
ULONG PageSize;
EnterCriticalSection(&PerfDataCriticalSection);
@ -740,8 +730,8 @@ ULONG PerfDataGetCommitChargeTotalK(void)
ULONG PerfDataGetCommitChargeLimitK(void)
{
ULONG Limit;
ULONG PageSize;
ULONG Limit;
ULONG PageSize;
EnterCriticalSection(&PerfDataCriticalSection);
@ -757,8 +747,8 @@ ULONG PerfDataGetCommitChargeLimitK(void)
ULONG PerfDataGetCommitChargePeakK(void)
{
ULONG Peak;
ULONG PageSize;
ULONG Peak;
ULONG PageSize;
EnterCriticalSection(&PerfDataCriticalSection);
@ -774,10 +764,10 @@ ULONG PerfDataGetCommitChargePeakK(void)
ULONG PerfDataGetKernelMemoryTotalK(void)
{
ULONG Total;
ULONG Paged;
ULONG NonPaged;
ULONG PageSize;
ULONG Total;
ULONG Paged;
ULONG NonPaged;
ULONG PageSize;
EnterCriticalSection(&PerfDataCriticalSection);
@ -797,8 +787,8 @@ ULONG PerfDataGetKernelMemoryTotalK(void)
ULONG PerfDataGetKernelMemoryPagedK(void)
{
ULONG Paged;
ULONG PageSize;
ULONG Paged;
ULONG PageSize;
EnterCriticalSection(&PerfDataCriticalSection);
@ -814,8 +804,8 @@ ULONG PerfDataGetKernelMemoryPagedK(void)
ULONG PerfDataGetKernelMemoryNonPagedK(void)
{
ULONG NonPaged;
ULONG PageSize;
ULONG NonPaged;
ULONG PageSize;
EnterCriticalSection(&PerfDataCriticalSection);
@ -831,8 +821,8 @@ ULONG PerfDataGetKernelMemoryNonPagedK(void)
ULONG PerfDataGetPhysicalMemoryTotalK(void)
{
ULONG Total;
ULONG PageSize;
ULONG Total;
ULONG PageSize;
EnterCriticalSection(&PerfDataCriticalSection);
@ -848,8 +838,8 @@ ULONG PerfDataGetPhysicalMemoryTotalK(void)
ULONG PerfDataGetPhysicalMemoryAvailableK(void)
{
ULONG Available;
ULONG PageSize;
ULONG Available;
ULONG PageSize;
EnterCriticalSection(&PerfDataCriticalSection);
@ -865,8 +855,8 @@ ULONG PerfDataGetPhysicalMemoryAvailableK(void)
ULONG PerfDataGetPhysicalMemorySystemCacheK(void)
{
ULONG SystemCache;
ULONG PageSize;
ULONG SystemCache;
ULONG PageSize;
EnterCriticalSection(&PerfDataCriticalSection);
@ -880,7 +870,7 @@ ULONG PerfDataGetPhysicalMemorySystemCacheK(void)
ULONG PerfDataGetSystemHandleCount(void)
{
ULONG HandleCount;
ULONG HandleCount;
EnterCriticalSection(&PerfDataCriticalSection);
@ -893,8 +883,8 @@ ULONG PerfDataGetSystemHandleCount(void)
ULONG PerfDataGetTotalThreadCount(void)
{
ULONG ThreadCount = 0;
ULONG i;
ULONG ThreadCount = 0;
ULONG i;
EnterCriticalSection(&PerfDataCriticalSection);

View file

@ -25,43 +25,43 @@
TGraphCtrl PerformancePageCpuUsageHistoryGraph;
TGraphCtrl PerformancePageMemUsageHistoryGraph;
HWND hPerformancePage; /* Performance Property Page */
HWND hPerformancePageCpuUsageGraph; /* CPU Usage Graph */
HWND hPerformancePageMemUsageGraph; /* MEM Usage Graph */
HWND hPerformancePageCpuUsageHistoryGraph; /* CPU Usage History Graph */
HWND hPerformancePageMemUsageHistoryGraph; /* Memory Usage History Graph */
HWND hPerformancePageTotalsFrame; /* Totals Frame */
HWND hPerformancePageCommitChargeFrame; /* Commit Charge Frame */
HWND hPerformancePageKernelMemoryFrame; /* Kernel Memory Frame */
HWND hPerformancePagePhysicalMemoryFrame; /* Physical Memory Frame */
HWND hPerformancePageCpuUsageFrame;
HWND hPerformancePageMemUsageFrame;
HWND hPerformancePageCpuUsageHistoryFrame;
HWND hPerformancePageMemUsageHistoryFrame;
HWND hPerformancePageCommitChargeTotalEdit; /* Commit Charge Total Edit Control */
HWND hPerformancePageCommitChargeLimitEdit; /* Commit Charge Limit Edit Control */
HWND hPerformancePageCommitChargePeakEdit; /* Commit Charge Peak Edit Control */
HWND hPerformancePageKernelMemoryTotalEdit; /* Kernel Memory Total Edit Control */
HWND hPerformancePageKernelMemoryPagedEdit; /* Kernel Memory Paged Edit Control */
HWND hPerformancePageKernelMemoryNonPagedEdit; /* Kernel Memory NonPaged Edit Control */
HWND hPerformancePagePhysicalMemoryTotalEdit; /* Physical Memory Total Edit Control */
HWND hPerformancePagePhysicalMemoryAvailableEdit; /* Physical Memory Available Edit Control */
HWND hPerformancePagePhysicalMemorySystemCacheEdit; /* Physical Memory System Cache Edit Control */
HWND hPerformancePageTotalsHandleCountEdit; /* Total Handles Edit Control */
HWND hPerformancePageTotalsProcessCountEdit; /* Total Processes Edit Control */
HWND hPerformancePageTotalsThreadCountEdit; /* Total Threads Edit Control */
HWND hPerformancePage; /* Performance Property Page */
HWND hPerformancePageCpuUsageGraph; /* CPU Usage Graph */
HWND hPerformancePageMemUsageGraph; /* MEM Usage Graph */
HWND hPerformancePageCpuUsageHistoryGraph; /* CPU Usage History Graph */
HWND hPerformancePageMemUsageHistoryGraph; /* Memory Usage History Graph */
HWND hPerformancePageTotalsFrame; /* Totals Frame */
HWND hPerformancePageCommitChargeFrame; /* Commit Charge Frame */
HWND hPerformancePageKernelMemoryFrame; /* Kernel Memory Frame */
HWND hPerformancePagePhysicalMemoryFrame; /* Physical Memory Frame */
HWND hPerformancePageCpuUsageFrame;
HWND hPerformancePageMemUsageFrame;
HWND hPerformancePageCpuUsageHistoryFrame;
HWND hPerformancePageMemUsageHistoryFrame;
HWND hPerformancePageCommitChargeTotalEdit; /* Commit Charge Total Edit Control */
HWND hPerformancePageCommitChargeLimitEdit; /* Commit Charge Limit Edit Control */
HWND hPerformancePageCommitChargePeakEdit; /* Commit Charge Peak Edit Control */
HWND hPerformancePageKernelMemoryTotalEdit; /* Kernel Memory Total Edit Control */
HWND hPerformancePageKernelMemoryPagedEdit; /* Kernel Memory Paged Edit Control */
HWND hPerformancePageKernelMemoryNonPagedEdit; /* Kernel Memory NonPaged Edit Control */
HWND hPerformancePagePhysicalMemoryTotalEdit; /* Physical Memory Total Edit Control */
HWND hPerformancePagePhysicalMemoryAvailableEdit; /* Physical Memory Available Edit Control */
HWND hPerformancePagePhysicalMemorySystemCacheEdit; /* Physical Memory System Cache Edit Control */
HWND hPerformancePageTotalsHandleCountEdit; /* Total Handles Edit Control */
HWND hPerformancePageTotalsProcessCountEdit; /* Total Processes Edit Control */
HWND hPerformancePageTotalsThreadCountEdit; /* Total Threads Edit Control */
static int nPerformancePageWidth;
static int nPerformancePageHeight;
static int lastX, lastY;
static HANDLE hPerformancePageEvent = NULL; /* When this event becomes signaled then we refresh the performance page */
DWORD WINAPI PerformancePageRefreshThread(void *lpParameter);
static int nPerformancePageWidth;
static int nPerformancePageHeight;
static int lastX, lastY;
static HANDLE hPerformancePageEvent = NULL; /* When this event becomes signaled then we refresh the performance page */
DWORD WINAPI PerformancePageRefreshThread(void *lpParameter);
void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
{
RECT rc;
int cx, cy, sx, sy;
RECT rc;
int cx, cy, sx, sy;
GetClientRect(hCntrl, &rc);
MapWindowPoints(hCntrl, hDlg, (LPPOINT)(PRECT)(&rc), (sizeof(RECT)/sizeof(POINT)));
@ -107,11 +107,11 @@ void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
INT_PTR CALLBACK
PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
RECT rc;
int nXDifference;
int nYDifference;
RECT rc;
int nXDifference;
int nYDifference;
#ifdef RUN_PERF_PAGE
HANDLE hRefreshThread = NULL;
HANDLE hRefreshThread = NULL;
#endif
/* HDC hdc; */
/* PAINTSTRUCT ps; */
@ -121,7 +121,7 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph);
GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph);
#ifdef RUN_PERF_PAGE
CloseHandle(hRefreshThread);
CloseHandle(hRefreshThread);
#endif
break;
@ -204,8 +204,8 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
SetWindowLongPtr(hPerformancePageCpuUsageHistoryGraph, GWL_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
return TRUE;
case WM_COMMAND:
break;
case WM_COMMAND:
break;
#if 0
case WM_NCPAINT:
hdc = GetDC(hDlg);
@ -221,22 +221,22 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
EndPaint(hDlg, &ps);
break;
#endif
case WM_SIZE:
case WM_SIZE:
do {
int cx, cy;
int cx, cy;
if (wParam == SIZE_MINIMIZED)
return 0;
if (wParam == SIZE_MINIMIZED)
return 0;
cx = LOWORD(lParam);
cy = HIWORD(lParam);
nXDifference = cx - nPerformancePageWidth;
nYDifference = cy - nPerformancePageHeight;
nPerformancePageWidth = cx;
nPerformancePageHeight = cy;
cx = LOWORD(lParam);
cy = HIWORD(lParam);
nXDifference = cx - nPerformancePageWidth;
nYDifference = cy - nPerformancePageHeight;
nPerformancePageWidth = cx;
nPerformancePageHeight = cy;
} while (0);
/* Reposition the performance page's controls */
/* Reposition the performance page's controls */
AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0);
@ -274,20 +274,20 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
if (nXDifference > 0) {
nXDifference--;
lastX++;
} else {
} else {
nXDifference++;
lastX--;
}
}
}
}
if (nYDifference % 2) {
if (nYDifference > 0) {
nYDifference--;
lastY++;
} else {
} else {
nYDifference++;
lastY--;
}
}
}
}
AdjustFrameSize(hPerformancePageCpuUsageFrame, hDlg, nXDifference, nYDifference, 1);
AdjustFrameSize(hPerformancePageMemUsageFrame, hDlg, nXDifference, nYDifference, 2);
AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3);
@ -296,148 +296,148 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
AdjustFrameSize(hPerformancePageMemUsageGraph, hDlg, nXDifference, nYDifference, 2);
AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3);
AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4);
break;
}
break;
}
return 0;
}
void RefreshPerformancePage(void)
{
/* Signal the event so that our refresh thread */
/* will wake up and refresh the performance page */
SetEvent(hPerformancePageEvent);
/* Signal the event so that our refresh thread */
/* will wake up and refresh the performance page */
SetEvent(hPerformancePageEvent);
}
DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
{
ULONG CommitChargeTotal;
ULONG CommitChargeLimit;
ULONG CommitChargePeak;
ULONG CommitChargeTotal;
ULONG CommitChargeLimit;
ULONG CommitChargePeak;
ULONG CpuUsage;
ULONG CpuKernelUsage;
ULONG CpuUsage;
ULONG CpuKernelUsage;
ULONG KernelMemoryTotal;
ULONG KernelMemoryPaged;
ULONG KernelMemoryNonPaged;
ULONG KernelMemoryTotal;
ULONG KernelMemoryPaged;
ULONG KernelMemoryNonPaged;
ULONG PhysicalMemoryTotal;
ULONG PhysicalMemoryAvailable;
ULONG PhysicalMemorySystemCache;
ULONG PhysicalMemoryTotal;
ULONG PhysicalMemoryAvailable;
ULONG PhysicalMemorySystemCache;
ULONG TotalHandles;
ULONG TotalThreads;
ULONG TotalProcesses;
ULONG TotalHandles;
ULONG TotalThreads;
ULONG TotalProcesses;
TCHAR Text[260];
TCHAR szMemUsage[256];
WCHAR Text[260];
WCHAR szMemUsage[256];
/* Create the event */
hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
/* Create the event */
hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
/* If we couldn't create the event then exit the thread */
if (!hPerformancePageEvent)
return 0;
/* If we couldn't create the event then exit the thread */
if (!hPerformancePageEvent)
return 0;
LoadString(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, 256);
LoadString(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, 256);
while (1)
{
DWORD dwWaitVal;
while (1)
{
DWORD dwWaitVal;
int nBarsUsed1;
int nBarsUsed2;
int nBarsUsed1;
int nBarsUsed2;
/* Wait on the event */
dwWaitVal = WaitForSingleObject(hPerformancePageEvent, INFINITE);
/* Wait on the event */
dwWaitVal = WaitForSingleObject(hPerformancePageEvent, INFINITE);
/* If the wait failed then the event object must have been */
/* closed and the task manager is exiting so exit this thread */
if (dwWaitVal == WAIT_FAILED)
return 0;
/* If the wait failed then the event object must have been */
/* closed and the task manager is exiting so exit this thread */
if (dwWaitVal == WAIT_FAILED)
return 0;
if (dwWaitVal == WAIT_OBJECT_0)
{
/* Reset our event */
ResetEvent(hPerformancePageEvent);
if (dwWaitVal == WAIT_OBJECT_0)
{
/* Reset our event */
ResetEvent(hPerformancePageEvent);
/*
* Update the commit charge info
*/
CommitChargeTotal = PerfDataGetCommitChargeTotalK();
CommitChargeLimit = PerfDataGetCommitChargeLimitK();
CommitChargePeak = PerfDataGetCommitChargePeakK();
_ultot(CommitChargeTotal, Text, 10);
SetWindowText(hPerformancePageCommitChargeTotalEdit, Text);
_ultot(CommitChargeLimit, Text, 10);
SetWindowText(hPerformancePageCommitChargeLimitEdit, Text);
_ultot(CommitChargePeak, Text, 10);
SetWindowText(hPerformancePageCommitChargePeakEdit, Text);
wsprintf(Text, szMemUsage, CommitChargeTotal, CommitChargeLimit);
SendMessage(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text);
/*
* Update the commit charge info
*/
CommitChargeTotal = PerfDataGetCommitChargeTotalK();
CommitChargeLimit = PerfDataGetCommitChargeLimitK();
CommitChargePeak = PerfDataGetCommitChargePeakK();
_ultow(CommitChargeTotal, Text, 10);
SetWindowText(hPerformancePageCommitChargeTotalEdit, Text);
_ultow(CommitChargeLimit, Text, 10);
SetWindowText(hPerformancePageCommitChargeLimitEdit, Text);
_ultow(CommitChargePeak, Text, 10);
SetWindowText(hPerformancePageCommitChargePeakEdit, Text);
wsprintf(Text, szMemUsage, CommitChargeTotal, CommitChargeLimit);
SendMessage(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text);
/*
* Update the kernel memory info
*/
KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
_ultot(KernelMemoryTotal, Text, 10);
SetWindowText(hPerformancePageKernelMemoryTotalEdit, Text);
_ultot(KernelMemoryPaged, Text, 10);
SetWindowText(hPerformancePageKernelMemoryPagedEdit, Text);
_ultot(KernelMemoryNonPaged, Text, 10);
SetWindowText(hPerformancePageKernelMemoryNonPagedEdit, Text);
/*
* Update the kernel memory info
*/
KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
_ultow(KernelMemoryTotal, Text, 10);
SetWindowText(hPerformancePageKernelMemoryTotalEdit, Text);
_ultow(KernelMemoryPaged, Text, 10);
SetWindowText(hPerformancePageKernelMemoryPagedEdit, Text);
_ultow(KernelMemoryNonPaged, Text, 10);
SetWindowText(hPerformancePageKernelMemoryNonPagedEdit, Text);
/*
* Update the physical memory info
*/
PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
_ultot(PhysicalMemoryTotal, Text, 10);
SetWindowText(hPerformancePagePhysicalMemoryTotalEdit, Text);
_ultot(PhysicalMemoryAvailable, Text, 10);
SetWindowText(hPerformancePagePhysicalMemoryAvailableEdit, Text);
_ultot(PhysicalMemorySystemCache, Text, 10);
SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit, Text);
/*
* Update the physical memory info
*/
PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
_ultow(PhysicalMemoryTotal, Text, 10);
SetWindowText(hPerformancePagePhysicalMemoryTotalEdit, Text);
_ultow(PhysicalMemoryAvailable, Text, 10);
SetWindowText(hPerformancePagePhysicalMemoryAvailableEdit, Text);
_ultow(PhysicalMemorySystemCache, Text, 10);
SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit, Text);
/*
* Update the totals info
*/
TotalHandles = PerfDataGetSystemHandleCount();
TotalThreads = PerfDataGetTotalThreadCount();
TotalProcesses = PerfDataGetProcessCount();
_ultot(TotalHandles, Text, 10);
SetWindowText(hPerformancePageTotalsHandleCountEdit, Text);
_ultot(TotalThreads, Text, 10);
SetWindowText(hPerformancePageTotalsThreadCountEdit, Text);
_ultot(TotalProcesses, Text, 10);
SetWindowText(hPerformancePageTotalsProcessCountEdit, Text);
/*
* Update the totals info
*/
TotalHandles = PerfDataGetSystemHandleCount();
TotalThreads = PerfDataGetTotalThreadCount();
TotalProcesses = PerfDataGetProcessCount();
_ultow(TotalHandles, Text, 10);
SetWindowText(hPerformancePageTotalsHandleCountEdit, Text);
_ultow(TotalThreads, Text, 10);
SetWindowText(hPerformancePageTotalsThreadCountEdit, Text);
_ultow(TotalProcesses, Text, 10);
SetWindowText(hPerformancePageTotalsProcessCountEdit, Text);
/*
* Redraw the graphs
*/
InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE);
InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE);
/*
* Redraw the graphs
*/
InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE);
InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE);
/*
* Get the CPU usage
*/
CpuUsage = PerfDataGetProcessorUsage();
if (CpuUsage <= 0 ) CpuUsage = 0;
if (CpuUsage > 100) CpuUsage = 100;
/*
* Get the CPU usage
*/
CpuUsage = PerfDataGetProcessorUsage();
if (CpuUsage <= 0 ) CpuUsage = 0;
if (CpuUsage > 100) CpuUsage = 100;
if (TaskManagerSettings.ShowKernelTimes)
{
CpuKernelUsage = PerfDataGetProcessorSystemUsage();
if (CpuKernelUsage <= 0) CpuKernelUsage = 0;
if (CpuKernelUsage > 100) CpuKernelUsage = 100;
}
else
{
CpuKernelUsage = 0;
}
if (TaskManagerSettings.ShowKernelTimes)
{
CpuKernelUsage = PerfDataGetProcessorSystemUsage();
if (CpuKernelUsage <= 0) CpuKernelUsage = 0;
if (CpuKernelUsage > 100) CpuKernelUsage = 100;
}
else
{
CpuKernelUsage = 0;
}
/*
* Get the memory usage
*/
@ -445,8 +445,8 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0;
PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
nBarsUsed2 = PhysicalMemoryTotal ? ((PhysicalMemoryAvailable * 100) / PhysicalMemoryTotal) : 0;
@ -454,61 +454,61 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
GraphCtrl_AppendPoint(&PerformancePageCpuUsageHistoryGraph, CpuUsage, CpuKernelUsage, 0.0, 0.0);
GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph, nBarsUsed1, nBarsUsed2, 0.0, 0.0);
/* PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ; */
InvalidateRect(hPerformancePageMemUsageHistoryGraph, NULL, FALSE);
InvalidateRect(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE);
}
}
InvalidateRect(hPerformancePageMemUsageHistoryGraph, NULL, FALSE);
InvalidateRect(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE);
}
}
return 0;
}
void PerformancePage_OnViewShowKernelTimes(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hMenu;
HMENU hViewMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
/* Check or uncheck the show 16-bit tasks menu item */
if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & MF_CHECKED)
{
CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED);
TaskManagerSettings.ShowKernelTimes = FALSE;
}
else
{
CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED);
TaskManagerSettings.ShowKernelTimes = TRUE;
}
/* Check or uncheck the show 16-bit tasks menu item */
if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & MF_CHECKED)
{
CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED);
TaskManagerSettings.ShowKernelTimes = FALSE;
}
else
{
CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED);
TaskManagerSettings.ShowKernelTimes = TRUE;
}
RefreshPerformancePage();
RefreshPerformancePage();
}
void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hCPUHistoryMenu;
HMENU hMenu;
HMENU hViewMenu;
HMENU hCPUHistoryMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
TaskManagerSettings.CPUHistory_OneGraphPerCPU = FALSE;
CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND);
TaskManagerSettings.CPUHistory_OneGraphPerCPU = FALSE;
CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND);
}
void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hCPUHistoryMenu;
HMENU hMenu;
HMENU hViewMenu;
HMENU hCPUHistoryMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
hCPUHistoryMenu = GetSubMenu(hViewMenu, 3);
TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE;
CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND);
TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE;
CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND);
}

View file

@ -1,6 +1,10 @@
#ifndef __PRECOMP_H
#define __PRECOMP_H
#ifndef UNICODE
#error Task-Manager uses NDK functions, so it can only be compiled with Unicode support enabled!
#endif
#define WIN32_NO_STATUS
#include <windows.h>
#define NTOS_MODE_USER
@ -10,7 +14,6 @@
#include <aclapi.h>
#include <stdlib.h>
#include <math.h>
#include <tchar.h>
#include <stdio.h>
#include <ctype.h>

View file

@ -23,16 +23,16 @@
#include <precomp.h>
TCHAR szTemp[256];
TCHAR szTempA[256];
WCHAR szTemp[256];
WCHAR szTempA[256];
void ProcessPage_OnSetPriorityRealTime(void)
{
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
TCHAR strErrorText[260];
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{
@ -80,11 +80,11 @@ void ProcessPage_OnSetPriorityRealTime(void)
void ProcessPage_OnSetPriorityHigh(void)
{
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
TCHAR strErrorText[260];
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{
@ -132,11 +132,11 @@ void ProcessPage_OnSetPriorityHigh(void)
void ProcessPage_OnSetPriorityAboveNormal(void)
{
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
TCHAR strErrorText[260];
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{
@ -184,11 +184,11 @@ void ProcessPage_OnSetPriorityAboveNormal(void)
void ProcessPage_OnSetPriorityNormal(void)
{
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
TCHAR strErrorText[260];
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{
@ -236,11 +236,11 @@ void ProcessPage_OnSetPriorityNormal(void)
void ProcessPage_OnSetPriorityBelowNormal(void)
{
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
TCHAR strErrorText[260];
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{
@ -288,11 +288,11 @@ void ProcessPage_OnSetPriorityBelowNormal(void)
void ProcessPage_OnSetPriorityLow(void)
{
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
TCHAR strErrorText[260];
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{

View file

@ -31,11 +31,11 @@ WNDPROC OldProcessListWndProc;
INT_PTR CALLBACK
ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HBRUSH hbrBackground;
HBRUSH hbrBackground;
RECT rcItem;
RECT rcClip;
HDC hDC;
int DcSave;
HDC hDC;
int DcSave;
switch (message)
{
@ -72,13 +72,13 @@ ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
* subtract it from our clip rect because we don't
* use icons in this list control.
*/
rcClip.left = LVIR_BOUNDS;
SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcClip);
rcClip.left = LVIR_BOUNDS;
SendMessage(hWnd, LVM_GETITEMRECT, ListView_GetItemCount(hWnd) - 1, (LPARAM)&rcItem);
rcClip.bottom = rcItem.bottom;
rcClip.left = LVIR_ICON;
SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcItem);
rcClip.left = LVIR_BOUNDS;
SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcClip);
rcClip.left = LVIR_BOUNDS;
SendMessage(hWnd, LVM_GETITEMRECT, ListView_GetItemCount(hWnd) - 1, (LPARAM)&rcItem);
rcClip.bottom = rcItem.bottom;
rcClip.left = LVIR_ICON;
SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcItem);
rcClip.left = rcItem.right;
/*

View file

@ -29,10 +29,10 @@ HWND hProcessPageHeaderCtrl; /* Process Header Control */
HWND hProcessPageEndProcessButton; /* Process End Process button */
HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */
static int nProcessPageWidth;
static int nProcessPageHeight;
static int nProcessPageWidth;
static int nProcessPageHeight;
static HANDLE hProcessPageEvent = NULL; /* When this event becomes signaled then we refresh the process list */
static HANDLE hProcessPageEvent = NULL; /* When this event becomes signaled then we refresh the process list */
void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam);
void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount);
@ -42,11 +42,11 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter);
INT_PTR CALLBACK
ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
RECT rc;
int nXDifference;
int nYDifference;
int cx, cy;
HANDLE hRefreshThread = NULL;
RECT rc;
int nXDifference;
int nYDifference;
int cx, cy;
HANDLE hRefreshThread = NULL;
switch (message) {
case WM_INITDIALOG:
@ -72,7 +72,7 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
* Set the font, title, and extended window styles for the list control
*/
SendMessage(hProcessPageListCtrl, WM_SETFONT, SendMessage(hProcessPage, WM_GETFONT, 0, 0), TRUE);
SetWindowText(hProcessPageListCtrl, _T("Processes"));
SetWindowText(hProcessPageListCtrl, L"Processes");
(void)ListView_SetExtendedListViewStyle(hProcessPageListCtrl, ListView_GetExtendedListViewStyle(hProcessPageListCtrl) | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
AddColumns();
@ -151,16 +151,16 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
{
int idctrl;
LPNMHDR pnmh;
LPNMLISTVIEW pnmv;
NMLVDISPINFO* pnmdi;
LPNMHEADER pnmhdr;
LVITEM lvitem;
ULONG Index;
ULONG ColumnIndex;
IO_COUNTERS iocounters;
LARGE_INTEGER time;
int idctrl;
LPNMHDR pnmh;
LPNMLISTVIEW pnmv;
NMLVDISPINFO* pnmdi;
LPNMHEADER pnmhdr;
LVITEM lvitem;
ULONG Index;
ULONG ColumnIndex;
IO_COUNTERS iocounters;
LARGE_INTEGER time;
idctrl = (int) wParam;
pnmh = (LPNMHDR) lParam;
@ -189,13 +189,13 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME)
PerfDataGetImageName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
if (ColumnDataHints[ColumnIndex] == COLUMN_PID)
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetProcessId(Index));
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetProcessId(Index));
if (ColumnDataHints[ColumnIndex] == COLUMN_USERNAME)
PerfDataGetUserName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
if (ColumnDataHints[ColumnIndex] == COLUMN_SESSIONID)
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetSessionId(Index));
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetSessionId(Index));
if (ColumnDataHints[ColumnIndex] == COLUMN_CPUUSAGE)
wsprintf(pnmdi->item.pszText, _T("%02d"), PerfDataGetCPUUsage(Index));
wsprintf(pnmdi->item.pszText, L"%02d", PerfDataGetCPUUsage(Index));
if (ColumnDataHints[ColumnIndex] == COLUMN_CPUTIME)
{
DWORD dwHours;
@ -212,120 +212,116 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
dwMinutes = (DWORD)((time.QuadPart % 36000000000LL) / 600000000LL);
dwSeconds = (DWORD)(((time.QuadPart % 36000000000LL) % 600000000LL) / 10000000LL);
#endif
wsprintf(pnmdi->item.pszText, _T("%d:%02d:%02d"), dwHours, dwMinutes, dwSeconds);
wsprintf(pnmdi->item.pszText, L"%d:%02d:%02d", dwHours, dwMinutes, dwSeconds);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGE)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetWorkingSetSizeBytes(Index) / 1024);
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetWorkingSetSizeBytes(Index) / 1024);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K"));
wcscat(pnmdi->item.pszText, L" K");
}
if (ColumnDataHints[ColumnIndex] == COLUMN_PEAKMEMORYUSAGE)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024);
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K"));
wcscat(pnmdi->item.pszText, L" K");
}
if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGEDELTA)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetWorkingSetSizeDelta(Index) / 1024);
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetWorkingSetSizeDelta(Index) / 1024);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K"));
wcscat(pnmdi->item.pszText, L" K");
}
if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTS)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPageFaultCount(Index));
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetPageFaultCount(Index));
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTSDELTA)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPageFaultCountDelta(Index));
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetPageFaultCountDelta(Index));
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_VIRTUALMEMORYSIZE)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetVirtualMemorySizeBytes(Index) / 1024);
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetVirtualMemorySizeBytes(Index) / 1024);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K"));
wcscat(pnmdi->item.pszText, L" K");
}
if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEDPOOL)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPagedPoolUsagePages(Index) / 1024);
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetPagedPoolUsagePages(Index) / 1024);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K"));
wcscat(pnmdi->item.pszText, L" K");
}
if (ColumnDataHints[ColumnIndex] == COLUMN_NONPAGEDPOOL)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetNonPagedPoolUsagePages(Index) / 1024);
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetNonPagedPoolUsagePages(Index) / 1024);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K"));
wcscat(pnmdi->item.pszText, L" K");
}
if (ColumnDataHints[ColumnIndex] == COLUMN_BASEPRIORITY)
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetBasePriority(Index));
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetBasePriority(Index));
if (ColumnDataHints[ColumnIndex] == COLUMN_HANDLECOUNT)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetHandleCount(Index));
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetHandleCount(Index));
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_THREADCOUNT)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetThreadCount(Index));
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetThreadCount(Index));
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_USEROBJECTS)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetUSERObjectCount(Index));
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetUSERObjectCount(Index));
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_GDIOBJECTS)
{
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetGDIObjectCount(Index));
wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetGDIObjectCount(Index));
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS)
{
PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadOperationCount); */
#ifdef UNICODE
#define _ui64toa _ui64tow
#else
#endif
_ui64toa(iocounters.ReadOperationCount, pnmdi->item.pszText, 10);
/* wsprintf(pnmdi->item.pszText, L"%d", iocounters.ReadOperationCount); */
_ui64tow(iocounters.ReadOperationCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES)
{
PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteOperationCount); */
_ui64toa(iocounters.WriteOperationCount, pnmdi->item.pszText, 10);
/* wsprintf(pnmdi->item.pszText, L"%d", iocounters.WriteOperationCount); */
_ui64tow(iocounters.WriteOperationCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER)
{
PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherOperationCount); */
_ui64toa(iocounters.OtherOperationCount, pnmdi->item.pszText, 10);
/* wsprintf(pnmdi->item.pszText, L"%d", iocounters.OtherOperationCount); */
_ui64tow(iocounters.OtherOperationCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES)
{
PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadTransferCount); */
_ui64toa(iocounters.ReadTransferCount, pnmdi->item.pszText, 10);
/* wsprintf(pnmdi->item.pszText, L"%d", iocounters.ReadTransferCount); */
_ui64tow(iocounters.ReadTransferCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES)
{
PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteTransferCount); */
_ui64toa(iocounters.WriteTransferCount, pnmdi->item.pszText, 10);
/* wsprintf(pnmdi->item.pszText, L"%d", iocounters.WriteTransferCount); */
_ui64tow(iocounters.WriteTransferCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES)
{
PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherTransferCount); */
_ui64toa(iocounters.OtherTransferCount, pnmdi->item.pszText, 10);
/* wsprintf(pnmdi->item.pszText, L"%d", iocounters.OtherTransferCount); */
_ui64tow(iocounters.OtherTransferCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
}
@ -391,18 +387,18 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount)
{
TCHAR temp[260];
UINT i, j, k;
WCHAR temp[260];
UINT i, j, k;
for (i=0,j=0; i<(_tcslen(strNumber) % 3); i++, j++)
for (i=0,j=0; i<(wcslen(strNumber) % 3); i++, j++)
temp[j] = strNumber[i];
for (k=0; i<_tcslen(strNumber); i++,j++,k++) {
for (k=0; i<wcslen(strNumber); i++,j++,k++) {
if ((k % 3 == 0) && (j > 0))
temp[j++] = _T(',');
temp[j++] = L',';
temp[j] = strNumber[i];
}
temp[j] = _T('\0');
_tcsncpy(strNumber, temp, nMaxCount);
temp[j] = L'\0';
wcsncpy(strNumber, temp, nMaxCount);
}
void ProcessPageShowContextMenu(DWORD dwProcessId)
@ -411,13 +407,13 @@ void ProcessPageShowContextMenu(DWORD dwProcessId)
HMENU hSubMenu;
HMENU hPriorityMenu;
POINT pt;
SYSTEM_INFO si;
HANDLE hProcess;
SYSTEM_INFO si;
HANDLE hProcess;
DWORD dwProcessPriorityClass;
TCHAR strDebugger[260];
WCHAR strDebugger[260];
DWORD dwDebuggerSize;
HKEY hKey;
UINT Idx;
HKEY hKey;
UINT Idx;
memset(&si, 0, sizeof(SYSTEM_INFO));
@ -459,15 +455,15 @@ void ProcessPageShowContextMenu(DWORD dwProcessId)
break;
}
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug"), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
dwDebuggerSize = 260;
if (RegQueryValueEx(hKey, _T("Debugger"), NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
if (RegQueryValueEx(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
{
for (Idx=0; Idx<_tcslen(strDebugger); Idx++)
for (Idx=0; Idx<wcslen(strDebugger); Idx++)
strDebugger[Idx] = toupper(strDebugger[Idx]);
if (_tcsstr(strDebugger, _T("DRWTSN32")))
if (wcsstr(strDebugger, L"DRWTSN32"))
EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
}
else
@ -492,7 +488,7 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
{
ULONG OldProcessorUsage = 0;
ULONG OldProcessCount = 0;
TCHAR szCpuUsage[256], szProcesses[256];
WCHAR szCpuUsage[256], szProcesses[256];
/* Create the event */
hProcessPageEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
@ -516,7 +512,7 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
return 0;
if (dwWaitVal == WAIT_OBJECT_0) {
TCHAR text[260];
WCHAR text[260];
/* Reset our event */
ResetEvent(hProcessPageEvent);
@ -539,5 +535,5 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
}
}
}
return 0;
return 0;
}

View file

@ -25,45 +25,25 @@
void TaskManager_OnFileNew(void)
{
HMODULE hShell32;
RUNFILEDLG RunFileDlg;
TCHAR szTitle[40];
TCHAR szText[256];
HMODULE hShell32;
RUNFILEDLG RunFileDlg;
WCHAR szTitle[40];
WCHAR szText[256];
/* Load language strings from resource file */
LoadString(hInst, IDS_CREATENEWTASK, szTitle, sizeof(szTitle) / sizeof(szTitle[0]));
LoadString(hInst, IDS_CREATENEWTASK_DESC, szText, sizeof(szText) / sizeof(szText[0]));
hShell32 = LoadLibrary(_T("SHELL32.DLL"));
hShell32 = LoadLibrary(L"SHELL32.DLL");
RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (LPCSTR)0x3D);
/* Show "Run..." dialog */
if (RunFileDlg)
{
#ifndef UNICODE
if (GetVersion() < 0x80000000)
{
WCHAR wTitle[40];
WCHAR wText[256];
/* RunFileDlg is always unicode on NT systems, convert the ansi
strings to unicode */
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTitle, -1, wTitle, sizeof(szTitle) / sizeof(szTitle[0]));
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szText, -1, wText, sizeof(szText) / sizeof(szText[0]));
RunFileDlg(hMainWnd, 0, NULL, wTitle, wText, RFF_CALCDIRECTORY);
}
else
{
/* RunFileDlg is ansi on win 9x systems */
RunFileDlg(hMainWnd, 0, NULL, (LPCWSTR)szTitle, (LPCWSTR)szText, RFF_CALCDIRECTORY);
}
#else
/* NOTE - don't check whether running on win 9x or NT, let's just
assume that a unicode build only runs on NT */
RunFileDlg(hMainWnd, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY);
#endif
}
FreeLibrary(hShell32);

View file

@ -43,10 +43,10 @@ BOOL bInMenuLoop = FALSE; /* Tells us if we are in the menu loop */
TASKMANAGER_SETTINGS TaskManagerSettings;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
int APIENTRY wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int nCmdShow)
{
HANDLE hProcess;
HANDLE hToken;
@ -97,13 +97,13 @@ int APIENTRY WinMain(HINSTANCE hInstance,
INT_PTR CALLBACK
TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
LPRECT pRC;
RECT rc;
int idctrl;
LPNMHDR pnmh;
WINDOWPLACEMENT wp;
HDC hdc;
PAINTSTRUCT ps;
LPRECT pRC;
RECT rc;
int idctrl;
LPNMHDR pnmh;
WINDOWPLACEMENT wp;
switch (message) {
case WM_INITDIALOG:
@ -423,7 +423,7 @@ BOOL OnCreate(HWND hWnd)
int nActivePage;
int nParts[3];
RECT rc;
TCHAR szTemp[256];
WCHAR szTemp[256];
TCITEM item;
SendMessage(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_TASKMANAGER)));
@ -437,7 +437,7 @@ 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 = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, L"", hWnd, STATUS_WINDOW);
if(!hStatusWnd)
return FALSE;
@ -612,10 +612,10 @@ void OnMove( WPARAM nType, int cx, int cy )
*/
void OnSize( WPARAM nType, int cx, int cy )
{
int nParts[3];
int nXDifference;
int nYDifference;
RECT rc;
int nParts[3];
int nXDifference;
int nYDifference;
RECT rc;
if (nType == SIZE_MINIMIZED)
{
@ -668,10 +668,10 @@ void OnSize( WPARAM nType, int cx, int cy )
void LoadSettings(void)
{
HKEY hKey;
TCHAR szSubKey[] = _T("Software\\ReactWare\\TaskManager");
int i;
DWORD dwSize;
HKEY hKey;
WCHAR szSubKey[] = L"Software\\ReactWare\\TaskManager";
int i;
DWORD dwSize;
/* Window size & position settings */
TaskManagerSettings.Maximized = FALSE;
@ -718,7 +718,7 @@ void LoadSettings(void)
return;
/* Read the settings */
dwSize = sizeof(TASKMANAGER_SETTINGS);
RegQueryValueEx(hKey, _T("Preferences"), NULL, NULL, (LPBYTE)&TaskManagerSettings, &dwSize);
RegQueryValueEx(hKey, L"Preferences", NULL, NULL, (LPBYTE)&TaskManagerSettings, &dwSize);
/*
* ATM, the 'ImageName' column is always visible
@ -734,9 +734,9 @@ void LoadSettings(void)
void SaveSettings(void)
{
HKEY hKey;
TCHAR szSubKey1[] = _T("Software");
TCHAR szSubKey2[] = _T("Software\\ReactWare");
TCHAR szSubKey3[] = _T("Software\\ReactWare\\TaskManager");
WCHAR szSubKey1[] = L"Software";
WCHAR szSubKey2[] = L"Software\\ReactWare";
WCHAR szSubKey3[] = L"Software\\ReactWare\\TaskManager";
/* Open (or create) the key */
hKey = NULL;
@ -749,23 +749,23 @@ void SaveSettings(void)
if (RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey3, 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));
RegSetValueEx(hKey, L"Preferences", 0, REG_BINARY, (LPBYTE)&TaskManagerSettings, sizeof(TASKMANAGER_SETTINGS));
/* Close the key */
RegCloseKey(hKey);
}
void TaskManager_OnRestoreMainWindow(void)
{
HMENU hMenu, hOptionsMenu;
BOOL OnTop;
HMENU hMenu, hOptionsMenu;
BOOL OnTop;
hMenu = GetMenu(hMainWnd);
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
OnTop = ((GetWindowLong(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0);
hMenu = GetMenu(hMainWnd);
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
OnTop = ((GetWindowLong(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0);
OpenIcon(hMainWnd);
SetForegroundWindow(hMainWnd);
SetWindowPos(hMainWnd, (OnTop ? HWND_TOPMOST : HWND_TOP), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
OpenIcon(hMainWnd);
SetForegroundWindow(hMainWnd);
SetWindowPos(hMainWnd, (OnTop ? HWND_TOPMOST : HWND_TOP), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
}
void TaskManager_OnEnterMenuLoop(HWND hWnd)
@ -776,15 +776,15 @@ void TaskManager_OnEnterMenuLoop(HWND hWnd)
nParts = -1;
SendMessage(hStatusWnd, SB_SETPARTS, 1, (LPARAM) (LPINT)&nParts);
bInMenuLoop = TRUE;
SendMessage(hStatusWnd, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
SendMessage(hStatusWnd, SB_SETTEXT, (WPARAM)0, (LPARAM)L"");
}
void TaskManager_OnExitMenuLoop(HWND hWnd)
{
RECT rc;
int nParts[3];
TCHAR text[260];
TCHAR szCpuUsage[256], szProcesses[256];
RECT rc;
int nParts[3];
WCHAR text[260];
WCHAR szCpuUsage[256], szProcesses[256];
LoadString(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, 256);
LoadString(hInst, IDS_STATUS_PROCESSES, szProcesses, 256);
@ -796,7 +796,7 @@ void TaskManager_OnExitMenuLoop(HWND hWnd)
nParts[1] = 210;
nParts[2] = rc.right;
SendMessage(hStatusWnd, SB_SETPARTS, 3, (LPARAM) (LPINT) nParts);
SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)_T(""));
SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)L"");
wsprintf(text, szCpuUsage, PerfDataGetProcessorUsage());
SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text);
wsprintf(text, szProcesses, PerfDataGetProcessCount());
@ -805,14 +805,14 @@ void TaskManager_OnExitMenuLoop(HWND hWnd)
void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
{
TCHAR str[100];
WCHAR str[100];
_tcscpy(str, TEXT(""));
wcscpy(str, L"");
if (LoadString(hInst, nItemID, str, 100)) {
/* load appropriate string */
LPTSTR lpsz = str;
/* first newline terminates actual string */
lpsz = _tcschr(lpsz, '\n');
lpsz = wcschr(lpsz, '\n');
if (lpsz != NULL)
*lpsz = '\0';
}
@ -821,9 +821,9 @@ void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMe
void TaskManager_OnViewUpdateSpeedHigh(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hUpdateSpeedMenu;
HMENU hMenu;
HMENU hViewMenu;
HMENU hUpdateSpeedMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
@ -838,9 +838,9 @@ void TaskManager_OnViewUpdateSpeedHigh(void)
void TaskManager_OnViewUpdateSpeedNormal(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hUpdateSpeedMenu;
HMENU hMenu;
HMENU hViewMenu;
HMENU hUpdateSpeedMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
@ -855,9 +855,9 @@ void TaskManager_OnViewUpdateSpeedNormal(void)
void TaskManager_OnViewUpdateSpeedLow(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hUpdateSpeedMenu;
HMENU hMenu;
HMENU hViewMenu;
HMENU hUpdateSpeedMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
@ -877,9 +877,9 @@ void TaskManager_OnViewRefresh(void)
void TaskManager_OnViewUpdateSpeedPaused(void)
{
HMENU hMenu;
HMENU hViewMenu;
HMENU hUpdateSpeedMenu;
HMENU hMenu;
HMENU hViewMenu;
HMENU hUpdateSpeedMenu;
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
@ -891,12 +891,12 @@ void TaskManager_OnViewUpdateSpeedPaused(void)
void TaskManager_OnTabWndSelChange(void)
{
int i;
HMENU hMenu;
HMENU hOptionsMenu;
HMENU hViewMenu;
HMENU hSubMenu;
TCHAR szTemp[256];
int i;
HMENU hMenu;
HMENU hOptionsMenu;
HMENU hViewMenu;
HMENU hSubMenu;
WCHAR szTemp[256];
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
@ -1024,10 +1024,10 @@ LPTSTR GetLastErrorText(LPTSTR lpszBuf, DWORD dwSize)
/* supplied buffer is not long enough */
if (!dwRet || ( (long)dwSize < (long)dwRet+14)) {
lpszBuf[0] = TEXT('\0');
lpszBuf[0] = L'\0';
} else {
lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); /*remove cr and newline character */
_stprintf(lpszBuf, TEXT("%s (0x%x)"), lpszTemp, (int)GetLastError());
lpszTemp[lstrlen(lpszTemp)-2] = L'\0'; /*remove cr and newline character */
wsprintf(lpszBuf, L"%s (0x%x)", lpszTemp, (int)GetLastError());
}
if (lpszTemp) {
LocalFree((HLOCAL)lpszTemp);

View file

@ -1,11 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="taskmgr" type="win32gui" installbase="system32" installname="taskmgr.exe">
<module name="taskmgr" type="win32gui" installbase="system32" installname="taskmgr.exe" unicode="yes">
<include base="taskmgr">.</include>
<define name="_WIN32_IE">0x0501</define>
<define name="_WIN32_WINNT">0x0501</define>
<define name="UNICODE" />
<define name="_UNICODE" />
<library>msvcrt</library>
<library>ntdll</library>
<library>kernel32</library>

View file

@ -25,17 +25,17 @@
HICON TrayIcon_GetProcessorUsageIcon(void)
{
HICON hTrayIcon = NULL;
HDC hScreenDC = NULL;
HDC hDC = NULL;
HBITMAP hBitmap = NULL;
HBITMAP hOldBitmap = NULL;
HBITMAP hBitmapMask = NULL;
ICONINFO iconInfo;
ULONG ProcessorUsage;
int nLinesToDraw;
HBRUSH hBitmapBrush = NULL;
RECT rc;
HICON hTrayIcon = NULL;
HDC hScreenDC = NULL;
HDC hDC = NULL;
HBITMAP hBitmap = NULL;
HBITMAP hOldBitmap = NULL;
HBITMAP hBitmapMask = NULL;
ICONINFO iconInfo;
ULONG ProcessorUsage;
int nLinesToDraw;
HBRUSH hBitmapBrush = NULL;
RECT rc;
/*
* Get a handle to the screen DC
@ -132,10 +132,10 @@ done:
BOOL TrayIcon_ShellAddTrayIcon(void)
{
NOTIFYICONDATA nid;
HICON hIcon = NULL;
NOTIFYICONDATA nid;
HICON hIcon = NULL;
BOOL bRetVal;
TCHAR szMsg[256];
WCHAR szMsg[256];
memset(&nid, 0, sizeof(NOTIFYICONDATA));
@ -162,7 +162,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
BOOL TrayIcon_ShellRemoveTrayIcon(void)
{
NOTIFYICONDATA nid;
NOTIFYICONDATA nid;
BOOL bRetVal;
memset(&nid, 0, sizeof(NOTIFYICONDATA));
@ -183,7 +183,7 @@ BOOL TrayIcon_ShellUpdateTrayIcon(void)
NOTIFYICONDATA nid;
HICON hIcon = NULL;
BOOL bRetVal;
TCHAR szTemp[256];
WCHAR szTemp[256];
memset(&nid, 0, sizeof(NOTIFYICONDATA));