- 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

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

View file

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

View file

@ -26,7 +26,7 @@
typedef struct typedef struct
{ {
HWND hWnd; HWND hWnd;
TCHAR szTitle[260]; WCHAR szTitle[260];
HICON hIcon; HICON hIcon;
BOOL bHung; BOOL bHung;
} APPLICATION_PAGE_LIST_ITEM, *LPAPPLICATION_PAGE_LIST_ITEM; } 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; static BOOL bSortAscending = TRUE;
DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter); DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter);
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam); 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 ApplicationPageUpdate(void);
void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam); void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam);
void ApplicationPageShowContextMenu1(void); void ApplicationPageShowContextMenu1(void);
@ -64,7 +64,7 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
int nXDifference; int nXDifference;
int nYDifference; int nYDifference;
LV_COLUMN column; LV_COLUMN column;
TCHAR szTemp[256]; WCHAR szTemp[256];
int cx, cy; int cx, cy;
HANDLE hRefreshThread = NULL; HANDLE hRefreshThread = NULL;
@ -85,7 +85,7 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
hApplicationPageSwitchToButton = GetDlgItem(hDlg, IDC_SWITCHTO); hApplicationPageSwitchToButton = GetDlgItem(hDlg, IDC_SWITCHTO);
hApplicationPageNewTaskButton = GetDlgItem(hDlg, IDC_NEWTASK); hApplicationPageNewTaskButton = GetDlgItem(hDlg, IDC_NEWTASK);
SetWindowText(hApplicationPageListCtrl, _T("Tasks")); SetWindowText(hApplicationPageListCtrl, L"Tasks");
/* Initialize the application page's controls */ /* Initialize the application page's controls */
column.mask = LVCF_TEXT|LVCF_WIDTH; column.mask = LVCF_TEXT|LVCF_WIDTH;
@ -252,7 +252,7 @@ DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter)
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
{ {
HICON hIcon; HICON hIcon;
TCHAR szText[260]; WCHAR szText[260];
BOOL bLargeIcon; BOOL bLargeIcon;
BOOL bHung = FALSE; BOOL bHung = FALSE;
HICON* xhIcon = (HICON*)&hIcon; HICON* xhIcon = (HICON*)&hIcon;
@ -270,7 +270,7 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
GetWindowText(hWnd, szText, 260); /* Get the window text */ GetWindowText(hWnd, szText, 260); /* Get the window text */
/* Check and see if this is a top-level app window */ /* Check and see if this is a top-level app window */
if ((_tcslen(szText) <= 0) || if ((wcslen(szText) <= 0) ||
!IsWindowVisible(hWnd) || !IsWindowVisible(hWnd) ||
(GetParent(hWnd) != NULL) || (GetParent(hWnd) != NULL) ||
(GetWindow(hWnd, GW_OWNER) != NULL) || (GetWindow(hWnd, GW_OWNER) != NULL) ||
@ -296,7 +296,7 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
bHung = FALSE; bHung = FALSE;
IsHungAppWindow = (IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle(_T("USER32.DLL")), "IsHungAppWindow"); IsHungAppWindow = (IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle(L"USER32.DLL"), "IsHungAppWindow");
if (IsHungAppWindow) if (IsHungAppWindow)
bHung = IsHungAppWindow(hWnd); bHung = IsHungAppWindow(hWnd);
@ -306,7 +306,7 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
return TRUE; 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; LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
HIMAGELIST hImageListLarge; HIMAGELIST hImageListLarge;
@ -343,13 +343,13 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
{ {
/* Check to see if anything needs updating */ /* Check to see if anything needs updating */
if ((pAPLI->hIcon != hIcon) || if ((pAPLI->hIcon != hIcon) ||
(_tcsicmp(pAPLI->szTitle, szTitle) != 0) || (wcsicmp(pAPLI->szTitle, szTitle) != 0) ||
(pAPLI->bHung != bHung)) (pAPLI->bHung != bHung))
{ {
/* Update the structure */ /* Update the structure */
pAPLI->hIcon = hIcon; pAPLI->hIcon = hIcon;
pAPLI->bHung = bHung; pAPLI->bHung = bHung;
_tcscpy(pAPLI->szTitle, szTitle); wcscpy(pAPLI->szTitle, szTitle);
/* Update the image list */ /* Update the image list */
ImageList_ReplaceIcon(hImageListLarge, item.iItem, hIcon); ImageList_ReplaceIcon(hImageListLarge, item.iItem, hIcon);
@ -369,7 +369,7 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
pAPLI->hWnd = hWnd; pAPLI->hWnd = hWnd;
pAPLI->hIcon = hIcon; pAPLI->hIcon = hIcon;
pAPLI->bHung = bHung; pAPLI->bHung = bHung;
_tcscpy(pAPLI->szTitle, szTitle); wcscpy(pAPLI->szTitle, szTitle);
/* Add the item to the list */ /* Add the item to the list */
memset(&item, 0, sizeof(LV_ITEM)); 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; pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;
if (!IsWindow(pAPLI->hWnd)|| if (!IsWindow(pAPLI->hWnd)||
(_tcslen(pAPLI->szTitle) <= 0) || (wcslen(pAPLI->szTitle) <= 0) ||
!IsWindowVisible(pAPLI->hWnd) || !IsWindowVisible(pAPLI->hWnd) ||
(GetParent(pAPLI->hWnd) != NULL) || (GetParent(pAPLI->hWnd) != NULL) ||
(GetWindow(pAPLI->hWnd, GW_OWNER) != NULL) || (GetWindow(pAPLI->hWnd, GW_OWNER) != NULL) ||
@ -492,7 +492,7 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
LPNM_LISTVIEW pnmv; LPNM_LISTVIEW pnmv;
LV_DISPINFO* pnmdi; LV_DISPINFO* pnmdi;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI; LPAPPLICATION_PAGE_LIST_ITEM pAPLI;
TCHAR szMsg[256]; WCHAR szMsg[256];
idctrl = (int) wParam; idctrl = (int) wParam;
@ -512,7 +512,7 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
/* Update the item text */ /* Update the item text */
if (pnmdi->item.iSubItem == 0) 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 */ /* Update the item status */
@ -521,12 +521,12 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
if (pAPLI->bHung) if (pAPLI->bHung)
{ {
LoadString( GetModuleHandle(NULL), IDS_Not_Responding , szMsg, sizeof(szMsg) / sizeof(szMsg[0])); 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 else
{ {
LoadString( GetModuleHandle(NULL), IDS_Running, (LPTSTR) szMsg, sizeof(szMsg) / sizeof(szMsg[0])); 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);
} }
} }
@ -876,7 +876,7 @@ void ApplicationPage_OnSwitchTo(void)
typedef void (WINAPI *PROCSWITCHTOTHISWINDOW) (HWND, BOOL); typedef void (WINAPI *PROCSWITCHTOTHISWINDOW) (HWND, BOOL);
PROCSWITCHTOTHISWINDOW SwitchToThisWindow; PROCSWITCHTOTHISWINDOW SwitchToThisWindow;
HMODULE hUser32 = GetModuleHandle(_T("USER32")); HMODULE hUser32 = GetModuleHandle(L"USER32");
SwitchToThisWindow = (PROCSWITCHTOTHISWINDOW)GetProcAddress(hUser32, "SwitchToThisWindow"); SwitchToThisWindow = (PROCSWITCHTOTHISWINDOW)GetProcAddress(hUser32, "SwitchToThisWindow");
if (SwitchToThisWindow) { if (SwitchToThisWindow) {
SwitchToThisWindow(pAPLI->hWnd, TRUE); SwitchToThisWindow(pAPLI->hWnd, TRUE);
@ -967,5 +967,5 @@ int CALLBACK ApplicationPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM l
Param1 = (LPAPPLICATION_PAGE_LIST_ITEM)lParam2; Param1 = (LPAPPLICATION_PAGE_LIST_ITEM)lParam2;
Param2 = (LPAPPLICATION_PAGE_LIST_ITEM)lParam1; 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> #include <precomp.h>
UINT ColumnDataHints[COLUMN_NMAX]; UINT ColumnDataHints[COLUMN_NMAX];
TCHAR szTemp[256]; WCHAR szTemp[256];
#define DECLARE_COLUMN_PRESET(_name, _size, _state) \ #define DECLARE_COLUMN_PRESET(_name, _size, _state) \
{ IDS_TAB_##_name, IDC_##_name, _size, _state }, { IDS_TAB_##_name, IDC_##_name, _size, _state },
@ -63,12 +63,12 @@ INT_PTR CALLBACK ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam,
void AddColumns(void) void AddColumns(void)
{ {
LRESULT size; LRESULT size;
TCHAR szTemp[256]; WCHAR szTemp[256];
unsigned int n; unsigned int n;
for (n=0; n<COLUMN_NMAX; n++) { for (n=0; n<COLUMN_NMAX; n++) {
if (TaskManagerSettings.Columns[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); InsertColumn(n, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[n], -1);
} }
} }
@ -106,7 +106,7 @@ void SaveColumnSettings(void)
{ {
HDITEM hditem; HDITEM hditem;
unsigned int i, n; unsigned int i, n;
TCHAR text[260]; WCHAR text[260];
LRESULT size; LRESULT size;
/* Reset column data */ /* Reset column data */
@ -131,8 +131,8 @@ void SaveColumnSettings(void)
SendMessage(hProcessPageHeaderCtrl, HDM_GETITEM, i, (LPARAM) &hditem); SendMessage(hProcessPageHeaderCtrl, HDM_GETITEM, i, (LPARAM) &hditem);
for (n=0; n<COLUMN_NMAX; n++) { for (n=0; n<COLUMN_NMAX; n++) {
LoadString(hInst, ColumnPresets[n].dwIdsName, szTemp, sizeof(szTemp)/sizeof(TCHAR)); LoadString(hInst, ColumnPresets[n].dwIdsName, szTemp, sizeof(szTemp)/sizeof(WCHAR));
if (_tcsicmp(text, szTemp) == 0) if (wcsicmp(text, szTemp) == 0)
{ {
TaskManagerSettings.Columns[n] = TRUE; TaskManagerSettings.Columns[n] = TRUE;
TaskManagerSettings.ColumnSizeArray[n] = hditem.cxy; TaskManagerSettings.ColumnSizeArray[n] = hditem.cxy;
@ -202,9 +202,9 @@ ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
void UpdateColumnDataHints(void) void UpdateColumnDataHints(void)
{ {
HDITEM hditem; HDITEM hditem;
TCHAR text[260]; WCHAR text[260];
ULONG Index; ULONG Index;
TCHAR szTemp[256]; WCHAR szTemp[256];
unsigned int i; unsigned int i;
for (Index=0; Index<(ULONG)SendMessage(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0); Index++) 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); SendMessage(hProcessPageHeaderCtrl, HDM_GETITEM, Index, (LPARAM) &hditem);
for (i=0; i<COLUMN_NMAX; i++) { for (i=0; i<COLUMN_NMAX; i++) {
LoadString(hInst, ColumnPresets[i].dwIdsName, szTemp, sizeof(szTemp)/sizeof(TCHAR)); LoadString(hInst, ColumnPresets[i].dwIdsName, szTemp, sizeof(szTemp)/sizeof(WCHAR));
if (_tcsicmp(text, szTemp) == 0) if (wcsicmp(text, szTemp) == 0)
ColumnDataHints[Index] = i; ColumnDataHints[Index] = i;
} }
} }

View file

@ -69,10 +69,10 @@ static DWORD get_selected_pid(void)
return dwProcessId; 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; int j;
TCHAR val[2]; WCHAR val[2];
LVITEM lvi; LVITEM lvi;
int index; int index;
HWND hChannelLV = (HWND)user; HWND hChannelLV = (HWND)user;
@ -85,10 +85,10 @@ static int list_channel_CB(HANDLE hProcess, void* addr, TCHAR* buffer, void*
index = ListView_InsertItem(hChannelLV, &lvi); index = ListView_InsertItem(hChannelLV, &lvi);
if (index == -1) return 0; if (index == -1) return 0;
val[1] = TEXT('\0'); val[1] = L'\0';
for (j = 0; j < 4; j++) 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); ListView_SetItemText(hChannelLV, index, j + 1, val);
} }
return 1; return 1;
@ -107,11 +107,11 @@ struct cce_user
* *
* Callback used for changing a given channel attributes * 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); buffer[0] = (buffer[0] & ~user->mask) | (user->value & user->mask);
if (WriteProcessMemory(hProcess, addr, buffer, 1, NULL)) if (WriteProcessMemory(hProcess, addr, buffer, 1, NULL))
@ -222,7 +222,7 @@ struct dll_option_layout
unsigned int nb_channels; unsigned int nb_channels;
}; };
typedef int (*EnumChannelCB)(HANDLE, void*, TCHAR*, void*); typedef int (*EnumChannelCB)(HANDLE, void*, WCHAR*, void*);
/****************************************************************** /******************************************************************
* enum_channel * enum_channel
@ -235,15 +235,15 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned
struct dll_option_layout dol; struct dll_option_layout dol;
int ret = 1; int ret = 1;
void* buf_addr; void* buf_addr;
TCHAR buffer[32]; WCHAR buffer[32];
void* addr; void* addr;
const TCHAR** cache = NULL; const WCHAR** cache = NULL;
unsigned i, j, num_cache, used_cache; unsigned i, j, num_cache, used_cache;
addr = get_symbol(hProcess, "first_dll", "libwine.so"); addr = get_symbol(hProcess, "first_dll", "libwine.so");
if (!addr) return -1; if (!addr) return -1;
if (unique) if (unique)
cache = HeapAlloc(GetProcessHeap(), 0, (num_cache = 32) * sizeof(TCHAR*)); cache = HeapAlloc(GetProcessHeap(), 0, (num_cache = 32) * sizeof(WCHAR*));
else else
num_cache = 0; num_cache = 0;
used_cache = 0; used_cache = 0;
@ -265,11 +265,11 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned
* them again * them again
*/ */
for (j = 0; j < used_cache; j++) 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 (j != used_cache) continue;
if (used_cache == num_cache) if (used_cache == num_cache)
cache = HeapReAlloc(GetProcessHeap(), 0, cache, (num_cache *= 2) * sizeof(TCHAR*)); cache = HeapReAlloc(GetProcessHeap(), 0, cache, (num_cache *= 2) * sizeof(WCHAR*));
cache[used_cache++] = _tcscpy(HeapAlloc(GetProcessHeap(), 0, (_tcslen(buffer + 1) + 1) * sizeof(TCHAR)), cache[used_cache++] = wcscpy(HeapAlloc(GetProcessHeap(), 0, (wcslen(buffer + 1) + 1) * sizeof(WCHAR)),
buffer + 1); buffer + 1);
} }
ret = ce(hProcess, buf_addr, buffer, user); ret = ce(hProcess, buf_addr, buffer, user);
@ -278,7 +278,7 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned
} }
if (unique) 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); HeapFree(GetProcessHeap(), 0, cache);
} }
return 0; return 0;
@ -305,31 +305,31 @@ static void DebugChannels_OnCreate(HWND hwndDlg)
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT; lvc.fmt = LVCFMT_LEFT;
lvc.pszText = _T("Debug Channel"); lvc.pszText = L"Debug Channel";
lvc.cx = 100; lvc.cx = 100;
(void)ListView_InsertColumn(hLV, 0, &lvc); (void)ListView_InsertColumn(hLV, 0, &lvc);
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_CENTER; lvc.fmt = LVCFMT_CENTER;
lvc.pszText = _T("Fixme"); lvc.pszText = L"Fixme";
lvc.cx = 55; lvc.cx = 55;
(void)ListView_InsertColumn(hLV, 1, &lvc); (void)ListView_InsertColumn(hLV, 1, &lvc);
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_CENTER; lvc.fmt = LVCFMT_CENTER;
lvc.pszText = _T("Err"); lvc.pszText = L"Err";
lvc.cx = 55; lvc.cx = 55;
(void)ListView_InsertColumn(hLV, 2, &lvc); (void)ListView_InsertColumn(hLV, 2, &lvc);
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_CENTER; lvc.fmt = LVCFMT_CENTER;
lvc.pszText = _T("Warn"); lvc.pszText = L"Warn";
lvc.cx = 55; lvc.cx = 55;
(void)ListView_InsertColumn(hLV, 3, &lvc); (void)ListView_InsertColumn(hLV, 3, &lvc);
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_CENTER; lvc.fmt = LVCFMT_CENTER;
lvc.pszText = _T("Trace"); lvc.pszText = L"Trace";
lvc.cx = 55; lvc.cx = 55;
(void)ListView_InsertColumn(hLV, 4, &lvc); (void)ListView_InsertColumn(hLV, 4, &lvc);
@ -357,21 +357,21 @@ static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam)
SendMessage(hChannelLV, LVM_SUBITEMHITTEST, 0, (LPARAM)&lhti); SendMessage(hChannelLV, LVM_SUBITEMHITTEST, 0, (LPARAM)&lhti);
if (nmia->iSubItem >= 1 && nmia->iSubItem <= 4) if (nmia->iSubItem >= 1 && nmia->iSubItem <= 4)
{ {
TCHAR val[2]; WCHAR val[2];
TCHAR name[32]; WCHAR name[32];
unsigned bitmask = 1 << (lhti.iSubItem - 1); unsigned bitmask = 1 << (lhti.iSubItem - 1);
struct cce_user user; struct cce_user user;
ListView_GetItemText(hChannelLV, lhti.iItem, 0, name, sizeof(name) / sizeof(name[0])); 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])); ListView_GetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val, sizeof(val) / sizeof(val[0]));
user.name = name; user.name = name;
user.value = (val[0] == TEXT('x')) ? 0 : bitmask; user.value = (val[0] == L'x') ? 0 : bitmask;
user.mask = bitmask; user.mask = bitmask;
user.done = user.notdone = 0; user.done = user.notdone = 0;
enum_channel(hProcess, change_channel_CB, &user, FALSE); enum_channel(hProcess, change_channel_CB, &user, FALSE);
if (user.done) if (user.done)
{ {
val[0] ^= (TEXT('x') ^ TEXT(' ')); val[0] ^= (L'x' ^ L' ');
ListView_SetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val); ListView_SetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val);
} }
if (user.notdone) if (user.notdone)

View file

@ -28,16 +28,16 @@ void ProcessPage_OnDebug(void)
LVITEM lvitem; LVITEM lvitem;
ULONG Index; ULONG Index;
DWORD dwProcessId; DWORD dwProcessId;
TCHAR strErrorText[260]; WCHAR strErrorText[260];
HKEY hKey; HKEY hKey;
TCHAR strDebugPath[260]; WCHAR strDebugPath[260];
TCHAR strDebugger[260]; WCHAR strDebugger[260];
DWORD dwDebuggerSize; DWORD dwDebuggerSize;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
STARTUPINFO si; STARTUPINFO si;
HANDLE hDebugEvent; HANDLE hDebugEvent;
TCHAR szTemp[256]; WCHAR szTemp[256];
TCHAR szTempA[256]; WCHAR szTempA[256];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
@ -70,7 +70,7 @@ void ProcessPage_OnDebug(void)
return; 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); GetLastErrorText(strErrorText, 260);
LoadString(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256); LoadString(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256);
@ -79,7 +79,7 @@ void ProcessPage_OnDebug(void)
} }
dwDebuggerSize = 260; 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); GetLastErrorText(strErrorText, 260);
LoadString(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256); LoadString(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256);

View file

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

View file

@ -136,7 +136,7 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
RECT rcBarRight; RECT rcBarRight;
RECT rcText; RECT rcText;
COLORREF crPrevForeground; COLORREF crPrevForeground;
TCHAR Text[260]; WCHAR Text[260];
HFONT hOldFont; HFONT hOldFont;
ULONG CpuUsage; ULONG CpuUsage;
ULONG CpuKernelUsage; ULONG CpuKernelUsage;
@ -166,7 +166,7 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
if (CpuUsage <= 0) CpuUsage = 0; if (CpuUsage <= 0) CpuUsage = 0;
if (CpuUsage > 100) CpuUsage = 100; if (CpuUsage > 100) CpuUsage = 100;
_stprintf(Text, _T("%d%%"), (int)CpuUsage); wsprintf(Text, L"%d%%", (int)CpuUsage);
/* /*
* Draw the font text onto the graph * Draw the font text onto the graph
@ -307,7 +307,7 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
RECT rcBarRight; RECT rcBarRight;
RECT rcText; RECT rcText;
COLORREF crPrevForeground; COLORREF crPrevForeground;
TCHAR Text[260]; WCHAR Text[260];
HFONT hOldFont; HFONT hOldFont;
ULONGLONG CommitChargeTotal; ULONGLONG CommitChargeTotal;
ULONGLONG CommitChargeLimit; ULONGLONG CommitChargeLimit;
@ -335,9 +335,9 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK(); CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
if (CommitChargeTotal > 1024) if (CommitChargeTotal > 1024)
_stprintf(Text, _T("%d MB"), (int)(CommitChargeTotal / 1024)); wsprintf(Text, L"%d MB", (int)(CommitChargeTotal / 1024));
else else
_stprintf(Text, _T("%d K"), (int)CommitChargeTotal); wsprintf(Text, L"%d K", (int)CommitChargeTotal);
/* /*
* Draw the font text onto the graph * Draw the font text onto the graph
*/ */

View file

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

View file

@ -78,7 +78,7 @@ void PerfDataUninitialize(void)
static void SidToUserName(PSID Sid, LPTSTR szBuffer, DWORD BufferSize) static void SidToUserName(PSID Sid, LPTSTR szBuffer, DWORD BufferSize)
{ {
static TCHAR szDomainNameUnused[255]; static WCHAR szDomainNameUnused[255];
DWORD DomainNameLen = sizeof(szDomainNameUnused) / sizeof(szDomainNameUnused[0]); DWORD DomainNameLen = sizeof(szDomainNameUnused) / sizeof(szDomainNameUnused[0]);
SID_NAME_USE Use; SID_NAME_USE Use;
@ -260,7 +260,7 @@ void PerfDataRefresh(void)
if (pSPI->ImageName.Buffer) if (pSPI->ImageName.Buffer)
wcscpy(pPerfData[Idx].ImageName, pSPI->ImageName.Buffer); wcscpy(pPerfData[Idx].ImageName, pSPI->ImageName.Buffer);
else else
LoadStringW(hInst, IDS_IDLE_PROCESS, pPerfData[Idx].ImageName, LoadString(hInst, IDS_IDLE_PROCESS, pPerfData[Idx].ImageName,
sizeof(pPerfData[Idx].ImageName) / sizeof(pPerfData[Idx].ImageName[0])); sizeof(pPerfData[Idx].ImageName) / sizeof(pPerfData[Idx].ImageName[0]));
pPerfData[Idx].ProcessId = pSPI->UniqueProcessId; pPerfData[Idx].ProcessId = pSPI->UniqueProcessId;
@ -291,7 +291,7 @@ void PerfDataRefresh(void)
pPerfData[Idx].HandleCount = pSPI->HandleCount; pPerfData[Idx].HandleCount = pSPI->HandleCount;
pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads; pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads;
pPerfData[Idx].SessionId = pSPI->SessionId; pPerfData[Idx].SessionId = pSPI->SessionId;
pPerfData[Idx].UserName[0] = _T('\0'); pPerfData[Idx].UserName[0] = L'\0';
pPerfData[Idx].USERObjectCount = 0; pPerfData[Idx].USERObjectCount = 0;
pPerfData[Idx].GDIObjectCount = 0; pPerfData[Idx].GDIObjectCount = 0;
ProcessUser = SystemUserSid; ProcessUser = SystemUserSid;
@ -375,12 +375,7 @@ BOOL PerfDataGetImageName(ULONG Index, LPTSTR lpImageName, int nMaxCount)
EnterCriticalSection(&PerfDataCriticalSection); EnterCriticalSection(&PerfDataCriticalSection);
if (Index < ProcessCount) { if (Index < ProcessCount) {
#ifdef _UNICODE
wcsncpy(lpImageName, pPerfData[Index].ImageName, nMaxCount); wcsncpy(lpImageName, pPerfData[Index].ImageName, nMaxCount);
#else
WideCharToMultiByte(CP_ACP, 0, pPerfData[Index].ImageName, -1, lpImageName, nMaxCount, NULL, NULL);
#endif
bSuccessful = TRUE; bSuccessful = TRUE;
} else { } else {
bSuccessful = FALSE; bSuccessful = FALSE;
@ -432,12 +427,7 @@ BOOL PerfDataGetUserName(ULONG Index, LPTSTR lpUserName, int nMaxCount)
EnterCriticalSection(&PerfDataCriticalSection); EnterCriticalSection(&PerfDataCriticalSection);
if (Index < ProcessCount) { if (Index < ProcessCount) {
#ifdef _UNICODE
wcsncpy(lpUserName, pPerfData[Index].UserName, nMaxCount); wcsncpy(lpUserName, pPerfData[Index].UserName, nMaxCount);
#else
WideCharToMultiByte(CP_ACP, 0, pPerfData[Index].UserName, -1, lpUserName, nMaxCount, NULL, NULL);
#endif
bSuccessful = TRUE; bSuccessful = TRUE;
} else { } else {
bSuccessful = FALSE; bSuccessful = FALSE;

View file

@ -329,8 +329,8 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
ULONG TotalThreads; ULONG TotalThreads;
ULONG TotalProcesses; ULONG TotalProcesses;
TCHAR Text[260]; WCHAR Text[260];
TCHAR szMemUsage[256]; WCHAR szMemUsage[256];
/* Create the event */ /* Create the event */
hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, NULL); hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
@ -367,11 +367,11 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
CommitChargeTotal = PerfDataGetCommitChargeTotalK(); CommitChargeTotal = PerfDataGetCommitChargeTotalK();
CommitChargeLimit = PerfDataGetCommitChargeLimitK(); CommitChargeLimit = PerfDataGetCommitChargeLimitK();
CommitChargePeak = PerfDataGetCommitChargePeakK(); CommitChargePeak = PerfDataGetCommitChargePeakK();
_ultot(CommitChargeTotal, Text, 10); _ultow(CommitChargeTotal, Text, 10);
SetWindowText(hPerformancePageCommitChargeTotalEdit, Text); SetWindowText(hPerformancePageCommitChargeTotalEdit, Text);
_ultot(CommitChargeLimit, Text, 10); _ultow(CommitChargeLimit, Text, 10);
SetWindowText(hPerformancePageCommitChargeLimitEdit, Text); SetWindowText(hPerformancePageCommitChargeLimitEdit, Text);
_ultot(CommitChargePeak, Text, 10); _ultow(CommitChargePeak, Text, 10);
SetWindowText(hPerformancePageCommitChargePeakEdit, Text); SetWindowText(hPerformancePageCommitChargePeakEdit, Text);
wsprintf(Text, szMemUsage, CommitChargeTotal, CommitChargeLimit); wsprintf(Text, szMemUsage, CommitChargeTotal, CommitChargeLimit);
SendMessage(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text); SendMessage(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text);
@ -382,11 +382,11 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
KernelMemoryTotal = PerfDataGetKernelMemoryTotalK(); KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
KernelMemoryPaged = PerfDataGetKernelMemoryPagedK(); KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK(); KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
_ultot(KernelMemoryTotal, Text, 10); _ultow(KernelMemoryTotal, Text, 10);
SetWindowText(hPerformancePageKernelMemoryTotalEdit, Text); SetWindowText(hPerformancePageKernelMemoryTotalEdit, Text);
_ultot(KernelMemoryPaged, Text, 10); _ultow(KernelMemoryPaged, Text, 10);
SetWindowText(hPerformancePageKernelMemoryPagedEdit, Text); SetWindowText(hPerformancePageKernelMemoryPagedEdit, Text);
_ultot(KernelMemoryNonPaged, Text, 10); _ultow(KernelMemoryNonPaged, Text, 10);
SetWindowText(hPerformancePageKernelMemoryNonPagedEdit, Text); SetWindowText(hPerformancePageKernelMemoryNonPagedEdit, Text);
/* /*
@ -395,11 +395,11 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK(); PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK(); PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK(); PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
_ultot(PhysicalMemoryTotal, Text, 10); _ultow(PhysicalMemoryTotal, Text, 10);
SetWindowText(hPerformancePagePhysicalMemoryTotalEdit, Text); SetWindowText(hPerformancePagePhysicalMemoryTotalEdit, Text);
_ultot(PhysicalMemoryAvailable, Text, 10); _ultow(PhysicalMemoryAvailable, Text, 10);
SetWindowText(hPerformancePagePhysicalMemoryAvailableEdit, Text); SetWindowText(hPerformancePagePhysicalMemoryAvailableEdit, Text);
_ultot(PhysicalMemorySystemCache, Text, 10); _ultow(PhysicalMemorySystemCache, Text, 10);
SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit, Text); SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit, Text);
/* /*
@ -408,11 +408,11 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
TotalHandles = PerfDataGetSystemHandleCount(); TotalHandles = PerfDataGetSystemHandleCount();
TotalThreads = PerfDataGetTotalThreadCount(); TotalThreads = PerfDataGetTotalThreadCount();
TotalProcesses = PerfDataGetProcessCount(); TotalProcesses = PerfDataGetProcessCount();
_ultot(TotalHandles, Text, 10); _ultow(TotalHandles, Text, 10);
SetWindowText(hPerformancePageTotalsHandleCountEdit, Text); SetWindowText(hPerformancePageTotalsHandleCountEdit, Text);
_ultot(TotalThreads, Text, 10); _ultow(TotalThreads, Text, 10);
SetWindowText(hPerformancePageTotalsThreadCountEdit, Text); SetWindowText(hPerformancePageTotalsThreadCountEdit, Text);
_ultot(TotalProcesses, Text, 10); _ultow(TotalProcesses, Text, 10);
SetWindowText(hPerformancePageTotalsProcessCountEdit, Text); SetWindowText(hPerformancePageTotalsProcessCountEdit, Text);
/* /*

View file

@ -1,6 +1,10 @@
#ifndef __PRECOMP_H #ifndef __PRECOMP_H
#define __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 #define WIN32_NO_STATUS
#include <windows.h> #include <windows.h>
#define NTOS_MODE_USER #define NTOS_MODE_USER
@ -10,7 +14,6 @@
#include <aclapi.h> #include <aclapi.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <tchar.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>

View file

@ -23,8 +23,8 @@
#include <precomp.h> #include <precomp.h>
TCHAR szTemp[256]; WCHAR szTemp[256];
TCHAR szTempA[256]; WCHAR szTempA[256];
void ProcessPage_OnSetPriorityRealTime(void) void ProcessPage_OnSetPriorityRealTime(void)
{ {
@ -32,7 +32,7 @@ void ProcessPage_OnSetPriorityRealTime(void)
ULONG Index; ULONG Index;
DWORD dwProcessId; DWORD dwProcessId;
HANDLE hProcess; HANDLE hProcess;
TCHAR strErrorText[260]; WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{ {
@ -84,7 +84,7 @@ void ProcessPage_OnSetPriorityHigh(void)
ULONG Index; ULONG Index;
DWORD dwProcessId; DWORD dwProcessId;
HANDLE hProcess; HANDLE hProcess;
TCHAR strErrorText[260]; WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{ {
@ -136,7 +136,7 @@ void ProcessPage_OnSetPriorityAboveNormal(void)
ULONG Index; ULONG Index;
DWORD dwProcessId; DWORD dwProcessId;
HANDLE hProcess; HANDLE hProcess;
TCHAR strErrorText[260]; WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{ {
@ -188,7 +188,7 @@ void ProcessPage_OnSetPriorityNormal(void)
ULONG Index; ULONG Index;
DWORD dwProcessId; DWORD dwProcessId;
HANDLE hProcess; HANDLE hProcess;
TCHAR strErrorText[260]; WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{ {
@ -240,7 +240,7 @@ void ProcessPage_OnSetPriorityBelowNormal(void)
ULONG Index; ULONG Index;
DWORD dwProcessId; DWORD dwProcessId;
HANDLE hProcess; HANDLE hProcess;
TCHAR strErrorText[260]; WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{ {
@ -292,7 +292,7 @@ void ProcessPage_OnSetPriorityLow(void)
ULONG Index; ULONG Index;
DWORD dwProcessId; DWORD dwProcessId;
HANDLE hProcess; HANDLE hProcess;
TCHAR strErrorText[260]; WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{ {

View file

@ -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 * Set the font, title, and extended window styles for the list control
*/ */
SendMessage(hProcessPageListCtrl, WM_SETFONT, SendMessage(hProcessPage, WM_GETFONT, 0, 0), TRUE); 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); (void)ListView_SetExtendedListViewStyle(hProcessPageListCtrl, ListView_GetExtendedListViewStyle(hProcessPageListCtrl) | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
AddColumns(); AddColumns();
@ -189,13 +189,13 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME) if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME)
PerfDataGetImageName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax); PerfDataGetImageName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
if (ColumnDataHints[ColumnIndex] == COLUMN_PID) 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) if (ColumnDataHints[ColumnIndex] == COLUMN_USERNAME)
PerfDataGetUserName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax); PerfDataGetUserName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
if (ColumnDataHints[ColumnIndex] == COLUMN_SESSIONID) 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) 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) if (ColumnDataHints[ColumnIndex] == COLUMN_CPUTIME)
{ {
DWORD dwHours; DWORD dwHours;
@ -212,120 +212,116 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
dwMinutes = (DWORD)((time.QuadPart % 36000000000LL) / 600000000LL); dwMinutes = (DWORD)((time.QuadPart % 36000000000LL) / 600000000LL);
dwSeconds = (DWORD)(((time.QuadPart % 36000000000LL) % 600000000LL) / 10000000LL); dwSeconds = (DWORD)(((time.QuadPart % 36000000000LL) % 600000000LL) / 10000000LL);
#endif #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) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K")); wcscat(pnmdi->item.pszText, L" K");
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_PEAKMEMORYUSAGE) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K")); wcscat(pnmdi->item.pszText, L" K");
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGEDELTA) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K")); wcscat(pnmdi->item.pszText, L" K");
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTS) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTSDELTA) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_VIRTUALMEMORYSIZE) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K")); wcscat(pnmdi->item.pszText, L" K");
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEDPOOL) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K")); wcscat(pnmdi->item.pszText, L" K");
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_NONPAGEDPOOL) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
_tcscat(pnmdi->item.pszText, _T(" K")); wcscat(pnmdi->item.pszText, L" K");
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_BASEPRIORITY) 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) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_THREADCOUNT) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_USEROBJECTS) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_GDIOBJECTS) 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); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS) if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS)
{ {
PerfDataGetIOCounters(Index, &iocounters); PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadOperationCount); */ /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.ReadOperationCount); */
#ifdef UNICODE _ui64tow(iocounters.ReadOperationCount, pnmdi->item.pszText, 10);
#define _ui64toa _ui64tow
#else
#endif
_ui64toa(iocounters.ReadOperationCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES) if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES)
{ {
PerfDataGetIOCounters(Index, &iocounters); PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteOperationCount); */ /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.WriteOperationCount); */
_ui64toa(iocounters.WriteOperationCount, pnmdi->item.pszText, 10); _ui64tow(iocounters.WriteOperationCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER) if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER)
{ {
PerfDataGetIOCounters(Index, &iocounters); PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherOperationCount); */ /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.OtherOperationCount); */
_ui64toa(iocounters.OtherOperationCount, pnmdi->item.pszText, 10); _ui64tow(iocounters.OtherOperationCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES) if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES)
{ {
PerfDataGetIOCounters(Index, &iocounters); PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadTransferCount); */ /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.ReadTransferCount); */
_ui64toa(iocounters.ReadTransferCount, pnmdi->item.pszText, 10); _ui64tow(iocounters.ReadTransferCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES) if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES)
{ {
PerfDataGetIOCounters(Index, &iocounters); PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteTransferCount); */ /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.WriteTransferCount); */
_ui64toa(iocounters.WriteTransferCount, pnmdi->item.pszText, 10); _ui64tow(iocounters.WriteTransferCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES) if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES)
{ {
PerfDataGetIOCounters(Index, &iocounters); PerfDataGetIOCounters(Index, &iocounters);
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherTransferCount); */ /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.OtherTransferCount); */
_ui64toa(iocounters.OtherTransferCount, pnmdi->item.pszText, 10); _ui64tow(iocounters.OtherTransferCount, pnmdi->item.pszText, 10);
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
} }
@ -391,18 +387,18 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount) void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount)
{ {
TCHAR temp[260]; WCHAR temp[260];
UINT i, j, k; 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]; 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)) if ((k % 3 == 0) && (j > 0))
temp[j++] = _T(','); temp[j++] = L',';
temp[j] = strNumber[i]; temp[j] = strNumber[i];
} }
temp[j] = _T('\0'); temp[j] = L'\0';
_tcsncpy(strNumber, temp, nMaxCount); wcsncpy(strNumber, temp, nMaxCount);
} }
void ProcessPageShowContextMenu(DWORD dwProcessId) void ProcessPageShowContextMenu(DWORD dwProcessId)
@ -414,7 +410,7 @@ void ProcessPageShowContextMenu(DWORD dwProcessId)
SYSTEM_INFO si; SYSTEM_INFO si;
HANDLE hProcess; HANDLE hProcess;
DWORD dwProcessPriorityClass; DWORD dwProcessPriorityClass;
TCHAR strDebugger[260]; WCHAR strDebugger[260];
DWORD dwDebuggerSize; DWORD dwDebuggerSize;
HKEY hKey; HKEY hKey;
UINT Idx; UINT Idx;
@ -459,15 +455,15 @@ void ProcessPageShowContextMenu(DWORD dwProcessId)
break; 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; 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]); 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); EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
} }
else else
@ -492,7 +488,7 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
{ {
ULONG OldProcessorUsage = 0; ULONG OldProcessorUsage = 0;
ULONG OldProcessCount = 0; ULONG OldProcessCount = 0;
TCHAR szCpuUsage[256], szProcesses[256]; WCHAR szCpuUsage[256], szProcesses[256];
/* Create the event */ /* Create the event */
hProcessPageEvent = CreateEvent(NULL, TRUE, TRUE, NULL); hProcessPageEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
@ -516,7 +512,7 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
return 0; return 0;
if (dwWaitVal == WAIT_OBJECT_0) { if (dwWaitVal == WAIT_OBJECT_0) {
TCHAR text[260]; WCHAR text[260];
/* Reset our event */ /* Reset our event */
ResetEvent(hProcessPageEvent); ResetEvent(hProcessPageEvent);

View file

@ -27,43 +27,23 @@ void TaskManager_OnFileNew(void)
{ {
HMODULE hShell32; HMODULE hShell32;
RUNFILEDLG RunFileDlg; RUNFILEDLG RunFileDlg;
TCHAR szTitle[40]; WCHAR szTitle[40];
TCHAR szText[256]; WCHAR szText[256];
/* Load language strings from resource file */ /* Load language strings from resource file */
LoadString(hInst, IDS_CREATENEWTASK, szTitle, sizeof(szTitle) / sizeof(szTitle[0])); LoadString(hInst, IDS_CREATENEWTASK, szTitle, sizeof(szTitle) / sizeof(szTitle[0]));
LoadString(hInst, IDS_CREATENEWTASK_DESC, szText, sizeof(szText) / sizeof(szText[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); RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (LPCSTR)0x3D);
/* Show "Run..." dialog */ /* Show "Run..." dialog */
if (RunFileDlg) 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 /* NOTE - don't check whether running on win 9x or NT, let's just
assume that a unicode build only runs on NT */ assume that a unicode build only runs on NT */
RunFileDlg(hMainWnd, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY); RunFileDlg(hMainWnd, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY);
#endif
} }
FreeLibrary(hShell32); FreeLibrary(hShell32);

View file

@ -43,9 +43,9 @@ BOOL bInMenuLoop = FALSE; /* Tells us if we are in the menu loop */
TASKMANAGER_SETTINGS TaskManagerSettings; TASKMANAGER_SETTINGS TaskManagerSettings;
int APIENTRY WinMain(HINSTANCE hInstance, int APIENTRY wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, LPWSTR lpCmdLine,
int nCmdShow) int nCmdShow)
{ {
HANDLE hProcess; HANDLE hProcess;
@ -423,7 +423,7 @@ BOOL OnCreate(HWND hWnd)
int nActivePage; int nActivePage;
int nParts[3]; int nParts[3];
RECT rc; RECT rc;
TCHAR szTemp[256]; WCHAR szTemp[256];
TCITEM item; TCITEM item;
SendMessage(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_TASKMANAGER))); 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); nMinimumHeight = (rc.bottom - rc.top);
/* Create the status bar */ /* 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) if(!hStatusWnd)
return FALSE; return FALSE;
@ -669,7 +669,7 @@ void OnSize( WPARAM nType, int cx, int cy )
void LoadSettings(void) void LoadSettings(void)
{ {
HKEY hKey; HKEY hKey;
TCHAR szSubKey[] = _T("Software\\ReactWare\\TaskManager"); WCHAR szSubKey[] = L"Software\\ReactWare\\TaskManager";
int i; int i;
DWORD dwSize; DWORD dwSize;
@ -718,7 +718,7 @@ void LoadSettings(void)
return; return;
/* Read the settings */ /* Read the settings */
dwSize = sizeof(TASKMANAGER_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 * ATM, the 'ImageName' column is always visible
@ -734,9 +734,9 @@ void LoadSettings(void)
void SaveSettings(void) void SaveSettings(void)
{ {
HKEY hKey; HKEY hKey;
TCHAR szSubKey1[] = _T("Software"); WCHAR szSubKey1[] = L"Software";
TCHAR szSubKey2[] = _T("Software\\ReactWare"); WCHAR szSubKey2[] = L"Software\\ReactWare";
TCHAR szSubKey3[] = _T("Software\\ReactWare\\TaskManager"); WCHAR szSubKey3[] = L"Software\\ReactWare\\TaskManager";
/* Open (or create) the key */ /* Open (or create) the key */
hKey = NULL; hKey = NULL;
@ -749,7 +749,7 @@ void SaveSettings(void)
if (RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey3, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS) if (RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey3, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS)
return; return;
/* Save the settings */ /* 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 */ /* Close the key */
RegCloseKey(hKey); RegCloseKey(hKey);
} }
@ -776,15 +776,15 @@ void TaskManager_OnEnterMenuLoop(HWND hWnd)
nParts = -1; nParts = -1;
SendMessage(hStatusWnd, SB_SETPARTS, 1, (LPARAM) (LPINT)&nParts); SendMessage(hStatusWnd, SB_SETPARTS, 1, (LPARAM) (LPINT)&nParts);
bInMenuLoop = TRUE; bInMenuLoop = TRUE;
SendMessage(hStatusWnd, SB_SETTEXT, (WPARAM)0, (LPARAM)_T("")); SendMessage(hStatusWnd, SB_SETTEXT, (WPARAM)0, (LPARAM)L"");
} }
void TaskManager_OnExitMenuLoop(HWND hWnd) void TaskManager_OnExitMenuLoop(HWND hWnd)
{ {
RECT rc; RECT rc;
int nParts[3]; int nParts[3];
TCHAR text[260]; WCHAR text[260];
TCHAR szCpuUsage[256], szProcesses[256]; WCHAR szCpuUsage[256], szProcesses[256];
LoadString(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, 256); LoadString(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, 256);
LoadString(hInst, IDS_STATUS_PROCESSES, szProcesses, 256); LoadString(hInst, IDS_STATUS_PROCESSES, szProcesses, 256);
@ -796,7 +796,7 @@ void TaskManager_OnExitMenuLoop(HWND hWnd)
nParts[1] = 210; nParts[1] = 210;
nParts[2] = rc.right; nParts[2] = rc.right;
SendMessage(hStatusWnd, SB_SETPARTS, 3, (LPARAM) (LPINT) nParts); 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()); wsprintf(text, szCpuUsage, PerfDataGetProcessorUsage());
SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text); SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text);
wsprintf(text, szProcesses, PerfDataGetProcessCount()); wsprintf(text, szProcesses, PerfDataGetProcessCount());
@ -805,14 +805,14 @@ void TaskManager_OnExitMenuLoop(HWND hWnd)
void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu) 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)) { if (LoadString(hInst, nItemID, str, 100)) {
/* load appropriate string */ /* load appropriate string */
LPTSTR lpsz = str; LPTSTR lpsz = str;
/* first newline terminates actual string */ /* first newline terminates actual string */
lpsz = _tcschr(lpsz, '\n'); lpsz = wcschr(lpsz, '\n');
if (lpsz != NULL) if (lpsz != NULL)
*lpsz = '\0'; *lpsz = '\0';
} }
@ -896,7 +896,7 @@ void TaskManager_OnTabWndSelChange(void)
HMENU hOptionsMenu; HMENU hOptionsMenu;
HMENU hViewMenu; HMENU hViewMenu;
HMENU hSubMenu; HMENU hSubMenu;
TCHAR szTemp[256]; WCHAR szTemp[256];
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2); hViewMenu = GetSubMenu(hMenu, 2);
@ -1024,10 +1024,10 @@ LPTSTR GetLastErrorText(LPTSTR lpszBuf, DWORD dwSize)
/* supplied buffer is not long enough */ /* supplied buffer is not long enough */
if (!dwRet || ( (long)dwSize < (long)dwRet+14)) { if (!dwRet || ( (long)dwSize < (long)dwRet+14)) {
lpszBuf[0] = TEXT('\0'); lpszBuf[0] = L'\0';
} else { } else {
lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); /*remove cr and newline character */ lpszTemp[lstrlen(lpszTemp)-2] = L'\0'; /*remove cr and newline character */
_stprintf(lpszBuf, TEXT("%s (0x%x)"), lpszTemp, (int)GetLastError()); wsprintf(lpszBuf, L"%s (0x%x)", lpszTemp, (int)GetLastError());
} }
if (lpszTemp) { if (lpszTemp) {
LocalFree((HLOCAL)lpszTemp); LocalFree((HLOCAL)lpszTemp);

View file

@ -1,11 +1,9 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> <!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> <include base="taskmgr">.</include>
<define name="_WIN32_IE">0x0501</define> <define name="_WIN32_IE">0x0501</define>
<define name="_WIN32_WINNT">0x0501</define> <define name="_WIN32_WINNT">0x0501</define>
<define name="UNICODE" />
<define name="_UNICODE" />
<library>msvcrt</library> <library>msvcrt</library>
<library>ntdll</library> <library>ntdll</library>
<library>kernel32</library> <library>kernel32</library>

View file

@ -135,7 +135,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
NOTIFYICONDATA nid; NOTIFYICONDATA nid;
HICON hIcon = NULL; HICON hIcon = NULL;
BOOL bRetVal; BOOL bRetVal;
TCHAR szMsg[256]; WCHAR szMsg[256];
memset(&nid, 0, sizeof(NOTIFYICONDATA)); memset(&nid, 0, sizeof(NOTIFYICONDATA));
@ -183,7 +183,7 @@ BOOL TrayIcon_ShellUpdateTrayIcon(void)
NOTIFYICONDATA nid; NOTIFYICONDATA nid;
HICON hIcon = NULL; HICON hIcon = NULL;
BOOL bRetVal; BOOL bRetVal;
TCHAR szTemp[256]; WCHAR szTemp[256];
memset(&nid, 0, sizeof(NOTIFYICONDATA)); memset(&nid, 0, sizeof(NOTIFYICONDATA));