- 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 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,
@ -42,10 +42,10 @@ static INT_PTR CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wP
void ProcessPage_OnSetAffinity(void) 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;
} }
@ -76,10 +76,10 @@ void ProcessPage_OnSetAffinity(void)
INT_PTR CALLBACK INT_PTR CALLBACK
AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) 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) {
case WM_INITDIALOG: case WM_INITDIALOG:
@ -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);
@ -60,13 +60,13 @@ BOOL bRestore /* Restore the window if it is minimized */
INT_PTR CALLBACK INT_PTR CALLBACK
ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
RECT rc; RECT rc;
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;
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:
@ -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;
@ -194,7 +194,7 @@ void RefreshApplicationPage(void)
void UpdateApplicationListControlViewSetting(void) void UpdateApplicationListControlViewSetting(void)
{ {
DWORD dwStyle = GetWindowLong(hApplicationPageListCtrl, GWL_STYLE); DWORD dwStyle = GetWindowLong(hApplicationPageListCtrl, GWL_STYLE);
dwStyle &= ~LVS_REPORT; dwStyle &= ~LVS_REPORT;
dwStyle &= ~LVS_ICON; dwStyle &= ~LVS_ICON;
@ -251,11 +251,11 @@ 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;
typedef int (FAR __stdcall *IsHungAppWindowProc)(HWND); typedef int (FAR __stdcall *IsHungAppWindowProc)(HWND);
IsHungAppWindowProc IsHungAppWindow; IsHungAppWindowProc IsHungAppWindow;
@ -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,15 +306,15 @@ 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;
HIMAGELIST hImageListSmall; HIMAGELIST hImageListSmall;
LV_ITEM item; LV_ITEM item;
int i; int i;
BOOL bAlreadyInList = FALSE; BOOL bAlreadyInList = FALSE;
BOOL bItemRemoved = FALSE; BOOL bItemRemoved = FALSE;
memset(&item, 0, sizeof(LV_ITEM)); 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 */ /* 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) ||
@ -446,8 +446,8 @@ void ApplicationPageUpdate(void)
/* be present on the menu bar so enable & disable the menu items */ /* be present on the menu bar so enable & disable the menu items */
if (TabCtrl_GetCurSel(hTabWnd) == 0) if (TabCtrl_GetCurSel(hTabWnd) == 0)
{ {
HMENU hMenu; HMENU hMenu;
HMENU hWindowsMenu; HMENU hWindowsMenu;
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hWindowsMenu = GetSubMenu(hMenu, 3); hWindowsMenu = GetSubMenu(hMenu, 3);
@ -487,12 +487,12 @@ void ApplicationPageUpdate(void)
void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam) void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
{ {
int idctrl; int idctrl;
LPNMHDR pnmh; LPNMHDR pnmh;
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);
} }
} }
@ -582,9 +582,9 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
void ApplicationPageShowContextMenu1(void) void ApplicationPageShowContextMenu1(void)
{ {
HMENU hMenu; HMENU hMenu;
HMENU hSubMenu; HMENU hSubMenu;
POINT pt; POINT pt;
GetCursorPos(&pt); GetCursorPos(&pt);
@ -605,9 +605,9 @@ void ApplicationPageShowContextMenu1(void)
void ApplicationPageShowContextMenu2(void) void ApplicationPageShowContextMenu2(void)
{ {
HMENU hMenu; HMENU hMenu;
HMENU hSubMenu; HMENU hSubMenu;
POINT pt; POINT pt;
GetCursorPos(&pt); GetCursorPos(&pt);
@ -651,8 +651,8 @@ void ApplicationPageShowContextMenu2(void)
void ApplicationPage_OnViewLargeIcons(void) void ApplicationPage_OnViewLargeIcons(void)
{ {
HMENU hMenu; HMENU hMenu;
HMENU hViewMenu; HMENU hViewMenu;
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2); hViewMenu = GetSubMenu(hMenu, 2);
@ -667,8 +667,8 @@ void ApplicationPage_OnViewLargeIcons(void)
void ApplicationPage_OnViewSmallIcons(void) void ApplicationPage_OnViewSmallIcons(void)
{ {
HMENU hMenu; HMENU hMenu;
HMENU hViewMenu; HMENU hViewMenu;
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2); hViewMenu = GetSubMenu(hMenu, 2);
@ -683,8 +683,8 @@ void ApplicationPage_OnViewSmallIcons(void)
void ApplicationPage_OnViewDetails(void) void ApplicationPage_OnViewDetails(void)
{ {
HMENU hMenu; HMENU hMenu;
HMENU hViewMenu; HMENU hViewMenu;
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2); hViewMenu = GetSubMenu(hMenu, 2);
@ -699,11 +699,11 @@ void ApplicationPage_OnViewDetails(void)
void ApplicationPage_OnWindowsTileHorizontally(void) void ApplicationPage_OnWindowsTileHorizontally(void)
{ {
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item; LV_ITEM item;
int i; int i;
HWND* hWndArray; HWND* hWndArray;
int nWndCount; int nWndCount;
hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl)); hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
nWndCount = 0; nWndCount = 0;
@ -730,11 +730,11 @@ void ApplicationPage_OnWindowsTileHorizontally(void)
void ApplicationPage_OnWindowsTileVertically(void) void ApplicationPage_OnWindowsTileVertically(void)
{ {
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item; LV_ITEM item;
int i; int i;
HWND* hWndArray; HWND* hWndArray;
int nWndCount; int nWndCount;
hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl)); hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
nWndCount = 0; nWndCount = 0;
@ -761,9 +761,9 @@ void ApplicationPage_OnWindowsTileVertically(void)
void ApplicationPage_OnWindowsMinimize(void) void ApplicationPage_OnWindowsMinimize(void)
{ {
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item; LV_ITEM item;
int i; int i;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) { for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM)); memset(&item, 0, sizeof(LV_ITEM));
@ -782,9 +782,9 @@ void ApplicationPage_OnWindowsMinimize(void)
void ApplicationPage_OnWindowsMaximize(void) void ApplicationPage_OnWindowsMaximize(void)
{ {
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item; LV_ITEM item;
int i; int i;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) { for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM)); memset(&item, 0, sizeof(LV_ITEM));
@ -803,11 +803,11 @@ void ApplicationPage_OnWindowsMaximize(void)
void ApplicationPage_OnWindowsCascade(void) void ApplicationPage_OnWindowsCascade(void)
{ {
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item; LV_ITEM item;
int i; int i;
HWND* hWndArray; HWND* hWndArray;
int nWndCount; int nWndCount;
hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl)); hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
nWndCount = 0; nWndCount = 0;
@ -832,9 +832,9 @@ void ApplicationPage_OnWindowsCascade(void)
void ApplicationPage_OnWindowsBringToFront(void) void ApplicationPage_OnWindowsBringToFront(void)
{ {
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item; LV_ITEM item;
int i; int i;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) { for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM)); memset(&item, 0, sizeof(LV_ITEM));
@ -856,9 +856,9 @@ void ApplicationPage_OnWindowsBringToFront(void)
void ApplicationPage_OnSwitchTo(void) void ApplicationPage_OnSwitchTo(void)
{ {
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item; LV_ITEM item;
int i; int i;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) { for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM)); memset(&item, 0, sizeof(LV_ITEM));
@ -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);
@ -893,9 +893,9 @@ void ApplicationPage_OnSwitchTo(void)
void ApplicationPage_OnEndTask(void) void ApplicationPage_OnEndTask(void)
{ {
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item; LV_ITEM item;
int i; int i;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) { for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
memset(&item, 0, sizeof(LV_ITEM)); memset(&item, 0, sizeof(LV_ITEM));
@ -914,9 +914,9 @@ void ApplicationPage_OnEndTask(void)
void ApplicationPage_OnGotoProcess(void) void ApplicationPage_OnGotoProcess(void)
{ {
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item; LV_ITEM item;
int i; int i;
/* NMHDR nmhdr; */ /* NMHDR nmhdr; */
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) { 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) int CALLBACK ApplicationPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{ {
LPAPPLICATION_PAGE_LIST_ITEM Param1; LPAPPLICATION_PAGE_LIST_ITEM Param1;
LPAPPLICATION_PAGE_LIST_ITEM Param2; LPAPPLICATION_PAGE_LIST_ITEM Param2;
if (bSortAscending) { if (bSortAscending) {
Param1 = (LPAPPLICATION_PAGE_LIST_ITEM)lParam1; 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; 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 },
@ -62,13 +62,13 @@ 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);
} }
} }
@ -81,7 +81,7 @@ void AddColumns(void)
int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem) int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem)
{ {
LVCOLUMN column; LVCOLUMN column;
column.mask = LVCF_TEXT|LVCF_FMT; column.mask = LVCF_TEXT|LVCF_FMT;
column.pszText = (LPTSTR)lpszColumnHeading; column.pszText = (LPTSTR)lpszColumnHeading;
@ -104,10 +104,10 @@ int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat, int nWidth, i
void SaveColumnSettings(void) 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 */
for (i=0; i<COLUMN_NMAX; i++) { for (i=0; i<COLUMN_NMAX; i++) {
@ -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;
@ -143,7 +143,7 @@ void SaveColumnSettings(void)
void ProcessPage_OnViewSelectColumns(void) void ProcessPage_OnViewSelectColumns(void)
{ {
int i; int i;
if (DialogBox(hInst, MAKEINTRESOURCE(IDD_COLUMNS_DIALOG), hMainWnd, ColumnsDialogWndProc) == IDOK) if (DialogBox(hInst, MAKEINTRESOURCE(IDD_COLUMNS_DIALOG), hMainWnd, ColumnsDialogWndProc) == IDOK)
{ {
@ -164,7 +164,7 @@ void ProcessPage_OnViewSelectColumns(void)
INT_PTR CALLBACK INT_PTR CALLBACK
ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
unsigned int i; unsigned int i;
switch (message) switch (message)
{ {
@ -201,11 +201,11 @@ 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

@ -44,9 +44,9 @@ BOOL DebugChannelsAreSupported(void)
static DWORD get_selected_pid(void) static DWORD get_selected_pid(void)
{ {
LVITEM lvitem; LVITEM lvitem;
ULONG Index; ULONG Index;
DWORD dwProcessId; DWORD dwProcessId;
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{ {
@ -69,13 +69,13 @@ 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;
memset(&lvi, 0, sizeof(lvi)); 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); 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;
@ -96,10 +96,10 @@ static int list_channel_CB(HANDLE hProcess, void* addr, TCHAR* buffer, void*
struct cce_user struct cce_user
{ {
LPCTSTR name; /* channel to look for */ LPCTSTR name; /* channel to look for */
unsigned value, mask; /* how to change channel */ unsigned value, mask; /* how to change channel */
unsigned done; /* number of successful changes */ unsigned done; /* number of successful changes */
unsigned notdone; /* number of unsuccessful changes */ unsigned notdone; /* number of unsuccessful changes */
}; };
/****************************************************************** /******************************************************************
@ -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))
@ -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)))) if (!(h = wine_dlopen(lib, RTLD_LAZY, buffer, sizeof(buffer))))
{ {
printf("Couldn't load %s (%s)\n", lib, buffer); printf("Couldn't load %s (%s)\n", lib, buffer);
return NULL; return NULL;
} }
env = getenv("LD_LIBRARY_PATH"); env = getenv("LD_LIBRARY_PATH");
@ -182,14 +182,14 @@ void* get_symbol(HANDLE hProcess, const char* name, const char* lib)
free(env); free(env);
if (!ptr) if (!ptr)
{ {
printf("Couldn't find %s in LD_LIBRARY_PATH\n", lib); printf("Couldn't find %s in LD_LIBRARY_PATH\n", lib);
return NULL; return NULL;
} }
} }
if (!(f = popen(buffer, "r"))) if (!(f = popen(buffer, "r")))
{ {
printf("Cannot execute '%s'\n", buffer); printf("Cannot execute '%s'\n", buffer);
return NULL; return NULL;
} }
while (fgets(buffer, sizeof(buffer), f)) 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 struct dll_option_layout
{ {
void* next; void* next;
void* prev; void* prev;
char* const* channels; char* const* channels;
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
@ -232,18 +232,18 @@ typedef int (*EnumChannelCB)(HANDLE, void*, TCHAR*, void*);
*/ */
static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned unique) static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned unique)
{ {
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;
@ -286,7 +286,7 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned
static void DebugChannels_FillList(HWND hChannelLV) static void DebugChannels_FillList(HWND hChannelLV)
{ {
HANDLE hProcess; HANDLE hProcess;
(void)ListView_DeleteAllItems(hChannelLV); (void)ListView_DeleteAllItems(hChannelLV);
@ -300,36 +300,36 @@ static void DebugChannels_FillList(HWND hChannelLV)
static void DebugChannels_OnCreate(HWND hwndDlg) static void DebugChannels_OnCreate(HWND hwndDlg)
{ {
HWND hLV = GetDlgItem(hwndDlg, IDC_DEBUG_CHANNELS_LIST); HWND hLV = GetDlgItem(hwndDlg, IDC_DEBUG_CHANNELS_LIST);
LVCOLUMN lvc; LVCOLUMN lvc;
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);
@ -338,17 +338,17 @@ static void DebugChannels_OnCreate(HWND hwndDlg)
static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam) static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam)
{ {
NMHDR* nmh = (NMHDR*)lParam; NMHDR* nmh = (NMHDR*)lParam;
switch (nmh->code) switch (nmh->code)
{ {
case NM_CLICK: case NM_CLICK:
if (nmh->idFrom == IDC_DEBUG_CHANNELS_LIST) if (nmh->idFrom == IDC_DEBUG_CHANNELS_LIST)
{ {
LVHITTESTINFO lhti; LVHITTESTINFO lhti;
HWND hChannelLV; HWND hChannelLV;
HANDLE hProcess; HANDLE hProcess;
NMITEMACTIVATE* nmia = (NMITEMACTIVATE*)lParam; NMITEMACTIVATE* nmia = (NMITEMACTIVATE*)lParam;
hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, get_selected_pid()); hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, get_selected_pid());
if (!hProcess) return; /* FIXME message box */ 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); 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,16 +23,16 @@
#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)
{ {
LVITEM lvitem; LVITEM lvitem;
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++)
{ {
@ -80,11 +80,11 @@ void ProcessPage_OnEndProcess(void)
void ProcessPage_OnEndProcessTree(void) void ProcessPage_OnEndProcessTree(void)
{ {
LVITEM lvitem; LVITEM lvitem;
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

@ -22,20 +22,20 @@
#include <precomp.h> #include <precomp.h>
int nlastBarsUsed = 0; int nlastBarsUsed = 0;
WNDPROC OldGraphWndProc; WNDPROC OldGraphWndProc;
void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd); void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd);
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd); void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd);
void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd); void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd);
INT_PTR CALLBACK INT_PTR CALLBACK
Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
HDC hdc; HDC hdc;
PAINTSTRUCT ps; PAINTSTRUCT ps;
LONG WindowId; LONG WindowId;
switch (message) switch (message)
{ {
@ -131,23 +131,23 @@ Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd) void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
{ {
RECT rcClient; RECT rcClient;
RECT rcBarLeft; RECT rcBarLeft;
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;
int nBars; int nBars;
int nBarsUsed; int nBarsUsed;
/* Bottom bars that are "used", i.e. are bright green, representing used cpu time */ /* 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 */ /* 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 */ /* Top bars that are "unused", i.e. are dark green, representing free cpu time */
int i; int i;
/* /*
* Get the client area rectangle * Get the client area rectangle
@ -163,10 +163,10 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
* Get the CPU usage * Get the CPU usage
*/ */
CpuUsage = PerfDataGetProcessorUsage(); CpuUsage = PerfDataGetProcessorUsage();
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
@ -240,22 +240,22 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
/* /*
* Draw the last "used" bars * Draw the last "used" bars
*/ */
if ((nlastBarsUsed - nBarsUsed) > 0) { if ((nlastBarsUsed - nBarsUsed) > 0) {
for (i=0; i< (nlastBarsUsed - nBarsUsed); i++) for (i=0; i< (nlastBarsUsed - nBarsUsed); i++)
{ {
if (nlastBarsUsed > 5000) nlastBarsUsed = 5000; if (nlastBarsUsed > 5000) nlastBarsUsed = 5000;
FillSolidRect(hDC, &rcBarLeft, MEDIUM_GREEN); FillSolidRect(hDC, &rcBarLeft, MEDIUM_GREEN);
FillSolidRect(hDC, &rcBarRight, MEDIUM_GREEN); FillSolidRect(hDC, &rcBarRight, MEDIUM_GREEN);
rcBarLeft.top += 3; rcBarLeft.top += 3;
rcBarLeft.bottom += 3; rcBarLeft.bottom += 3;
rcBarRight.top += 3; rcBarRight.top += 3;
rcBarRight.bottom += 3; rcBarRight.bottom += 3;
} }
} }
nlastBarsUsed = nBarsUsed; nlastBarsUsed = nBarsUsed;
/* /*
* Draw the "used" bars * Draw the "used" bars
*/ */
@ -302,21 +302,21 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
{ {
RECT rcClient; RECT rcClient;
RECT rcBarLeft; RECT rcBarLeft;
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;
int nBars; int nBars;
int nBarsUsed = 0; int nBarsUsed = 0;
/* Bottom bars that are "used", i.e. are bright green, representing used memory */ /* 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 */ /* Top bars that are "unused", i.e. are dark green, representing free memory */
int i; int i;
/* /*
* Get the client area rectangle * Get the client area rectangle
@ -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
*/ */
@ -409,10 +409,10 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd) void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd)
{ {
RECT rcClient; RECT rcClient;
ULONGLONG CommitChargeLimit; ULONGLONG CommitChargeLimit;
int i; int i;
static int offset = 0; static int offset = 0;
if (offset++ >= 10) if (offset++ >= 10)
offset = 0; offset = 0;

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

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

View file

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

View file

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

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

View file

@ -29,10 +29,10 @@ HWND hProcessPageHeaderCtrl; /* Process Header Control */
HWND hProcessPageEndProcessButton; /* Process End Process button */ HWND hProcessPageEndProcessButton; /* Process End Process button */
HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */ HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */
static int nProcessPageWidth; static int nProcessPageWidth;
static int nProcessPageHeight; 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 ProcessPageOnNotify(WPARAM wParam, LPARAM lParam);
void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount); void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount);
@ -42,11 +42,11 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter);
INT_PTR CALLBACK INT_PTR CALLBACK
ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
RECT rc; RECT rc;
int nXDifference; int nXDifference;
int nYDifference; int nYDifference;
int cx, cy; int cx, cy;
HANDLE hRefreshThread = NULL; HANDLE hRefreshThread = NULL;
switch (message) { switch (message) {
case WM_INITDIALOG: 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 * 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();
@ -151,16 +151,16 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam) void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
{ {
int idctrl; int idctrl;
LPNMHDR pnmh; LPNMHDR pnmh;
LPNMLISTVIEW pnmv; LPNMLISTVIEW pnmv;
NMLVDISPINFO* pnmdi; NMLVDISPINFO* pnmdi;
LPNMHEADER pnmhdr; LPNMHEADER pnmhdr;
LVITEM lvitem; LVITEM lvitem;
ULONG Index; ULONG Index;
ULONG ColumnIndex; ULONG ColumnIndex;
IO_COUNTERS iocounters; IO_COUNTERS iocounters;
LARGE_INTEGER time; LARGE_INTEGER time;
idctrl = (int) wParam; idctrl = (int) wParam;
pnmh = (LPNMHDR) lParam; pnmh = (LPNMHDR) lParam;
@ -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)
@ -411,13 +407,13 @@ void ProcessPageShowContextMenu(DWORD dwProcessId)
HMENU hSubMenu; HMENU hSubMenu;
HMENU hPriorityMenu; HMENU hPriorityMenu;
POINT pt; POINT pt;
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;
memset(&si, 0, sizeof(SYSTEM_INFO)); memset(&si, 0, sizeof(SYSTEM_INFO));
@ -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);
@ -539,5 +535,5 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
} }
} }
} }
return 0; return 0;
} }

View file

@ -25,45 +25,25 @@
void TaskManager_OnFileNew(void) 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,10 +43,10 @@ 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;
HANDLE hToken; HANDLE hToken;
@ -97,13 +97,13 @@ int APIENTRY WinMain(HINSTANCE hInstance,
INT_PTR CALLBACK INT_PTR CALLBACK
TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
HDC hdc; HDC hdc;
PAINTSTRUCT ps; PAINTSTRUCT ps;
LPRECT pRC; LPRECT pRC;
RECT rc; RECT rc;
int idctrl; int idctrl;
LPNMHDR pnmh; LPNMHDR pnmh;
WINDOWPLACEMENT wp; WINDOWPLACEMENT wp;
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:
@ -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;
@ -612,10 +612,10 @@ void OnMove( WPARAM nType, int cx, int cy )
*/ */
void OnSize( WPARAM nType, int cx, int cy ) void OnSize( WPARAM nType, int cx, int cy )
{ {
int nParts[3]; int nParts[3];
int nXDifference; int nXDifference;
int nYDifference; int nYDifference;
RECT rc; RECT rc;
if (nType == SIZE_MINIMIZED) if (nType == SIZE_MINIMIZED)
{ {
@ -668,10 +668,10 @@ 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;
/* Window size & position settings */ /* Window size & position settings */
TaskManagerSettings.Maximized = FALSE; TaskManagerSettings.Maximized = FALSE;
@ -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,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) 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);
} }
void TaskManager_OnRestoreMainWindow(void) void TaskManager_OnRestoreMainWindow(void)
{ {
HMENU hMenu, hOptionsMenu; HMENU hMenu, hOptionsMenu;
BOOL OnTop; BOOL OnTop;
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX); hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
OnTop = ((GetWindowLong(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0); OnTop = ((GetWindowLong(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0);
OpenIcon(hMainWnd); OpenIcon(hMainWnd);
SetForegroundWindow(hMainWnd); SetForegroundWindow(hMainWnd);
SetWindowPos(hMainWnd, (OnTop ? HWND_TOPMOST : HWND_TOP), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW); SetWindowPos(hMainWnd, (OnTop ? HWND_TOPMOST : HWND_TOP), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
} }
void TaskManager_OnEnterMenuLoop(HWND hWnd) void TaskManager_OnEnterMenuLoop(HWND hWnd)
@ -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';
} }
@ -821,9 +821,9 @@ void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMe
void TaskManager_OnViewUpdateSpeedHigh(void) void TaskManager_OnViewUpdateSpeedHigh(void)
{ {
HMENU hMenu; HMENU hMenu;
HMENU hViewMenu; HMENU hViewMenu;
HMENU hUpdateSpeedMenu; HMENU hUpdateSpeedMenu;
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2); hViewMenu = GetSubMenu(hMenu, 2);
@ -838,9 +838,9 @@ void TaskManager_OnViewUpdateSpeedHigh(void)
void TaskManager_OnViewUpdateSpeedNormal(void) void TaskManager_OnViewUpdateSpeedNormal(void)
{ {
HMENU hMenu; HMENU hMenu;
HMENU hViewMenu; HMENU hViewMenu;
HMENU hUpdateSpeedMenu; HMENU hUpdateSpeedMenu;
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2); hViewMenu = GetSubMenu(hMenu, 2);
@ -855,9 +855,9 @@ void TaskManager_OnViewUpdateSpeedNormal(void)
void TaskManager_OnViewUpdateSpeedLow(void) void TaskManager_OnViewUpdateSpeedLow(void)
{ {
HMENU hMenu; HMENU hMenu;
HMENU hViewMenu; HMENU hViewMenu;
HMENU hUpdateSpeedMenu; HMENU hUpdateSpeedMenu;
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2); hViewMenu = GetSubMenu(hMenu, 2);
@ -877,9 +877,9 @@ void TaskManager_OnViewRefresh(void)
void TaskManager_OnViewUpdateSpeedPaused(void) void TaskManager_OnViewUpdateSpeedPaused(void)
{ {
HMENU hMenu; HMENU hMenu;
HMENU hViewMenu; HMENU hViewMenu;
HMENU hUpdateSpeedMenu; HMENU hUpdateSpeedMenu;
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2); hViewMenu = GetSubMenu(hMenu, 2);
@ -891,12 +891,12 @@ void TaskManager_OnViewUpdateSpeedPaused(void)
void TaskManager_OnTabWndSelChange(void) void TaskManager_OnTabWndSelChange(void)
{ {
int i; int i;
HMENU hMenu; HMENU hMenu;
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

@ -25,17 +25,17 @@
HICON TrayIcon_GetProcessorUsageIcon(void) HICON TrayIcon_GetProcessorUsageIcon(void)
{ {
HICON hTrayIcon = NULL; HICON hTrayIcon = NULL;
HDC hScreenDC = NULL; HDC hScreenDC = NULL;
HDC hDC = NULL; HDC hDC = NULL;
HBITMAP hBitmap = NULL; HBITMAP hBitmap = NULL;
HBITMAP hOldBitmap = NULL; HBITMAP hOldBitmap = NULL;
HBITMAP hBitmapMask = NULL; HBITMAP hBitmapMask = NULL;
ICONINFO iconInfo; ICONINFO iconInfo;
ULONG ProcessorUsage; ULONG ProcessorUsage;
int nLinesToDraw; int nLinesToDraw;
HBRUSH hBitmapBrush = NULL; HBRUSH hBitmapBrush = NULL;
RECT rc; RECT rc;
/* /*
* Get a handle to the screen DC * Get a handle to the screen DC
@ -132,10 +132,10 @@ done:
BOOL TrayIcon_ShellAddTrayIcon(void) 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));
@ -162,7 +162,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
BOOL TrayIcon_ShellRemoveTrayIcon(void) BOOL TrayIcon_ShellRemoveTrayIcon(void)
{ {
NOTIFYICONDATA nid; NOTIFYICONDATA nid;
BOOL bRetVal; BOOL bRetVal;
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));