From a14b40e394d687fc61711739bab9a7e27dbfc5e0 Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Wed, 31 Oct 2007 23:26:27 +0000 Subject: [PATCH] - 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 --- reactos/base/applications/taskmgr/about.c | 4 +- reactos/base/applications/taskmgr/affinity.c | 36 +- reactos/base/applications/taskmgr/applpage.c | 180 ++++---- reactos/base/applications/taskmgr/column.c | 42 +- reactos/base/applications/taskmgr/dbgchnl.c | 118 ++--- reactos/base/applications/taskmgr/debug.c | 14 +- reactos/base/applications/taskmgr/endproc.c | 24 +- reactos/base/applications/taskmgr/graph.c | 116 ++--- reactos/base/applications/taskmgr/graphctl.c | 10 +- reactos/base/applications/taskmgr/optnmenu.c | 16 +- reactos/base/applications/taskmgr/perfdata.c | 178 ++++---- reactos/base/applications/taskmgr/perfpage.c | 414 +++++++++--------- reactos/base/applications/taskmgr/precomp.h | 5 +- reactos/base/applications/taskmgr/priority.c | 64 +-- reactos/base/applications/taskmgr/proclist.c | 20 +- reactos/base/applications/taskmgr/procpage.c | 150 +++---- reactos/base/applications/taskmgr/run.c | 30 +- reactos/base/applications/taskmgr/taskmgr.c | 128 +++--- .../base/applications/taskmgr/taskmgr.rbuild | 4 +- reactos/base/applications/taskmgr/trayicon.c | 32 +- 20 files changed, 776 insertions(+), 809 deletions(-) diff --git a/reactos/base/applications/taskmgr/about.c b/reactos/base/applications/taskmgr/about.c index bd73e5bf405..a935d23bf18 100644 --- a/reactos/base/applications/taskmgr/about.c +++ b/reactos/base/applications/taskmgr/about.c @@ -32,8 +32,8 @@ void OnAbout(void) INT_PTR CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND hLicenseEditWnd; - TCHAR strLicense[0x1000]; + HWND hLicenseEditWnd; + WCHAR strLicense[0x1000]; switch (message) { diff --git a/reactos/base/applications/taskmgr/affinity.c b/reactos/base/applications/taskmgr/affinity.c index bf8b55d0e0c..0987f9b05ec 100644 --- a/reactos/base/applications/taskmgr/affinity.c +++ b/reactos/base/applications/taskmgr/affinity.c @@ -24,8 +24,8 @@ #include HANDLE hProcessAffinityHandle; -TCHAR szTemp[256]; -TCHAR szTempA[256]; +WCHAR szTemp[256]; +WCHAR szTempA[256]; static const DWORD dwCpuTable[] = { IDC_CPU0, IDC_CPU1, IDC_CPU2, IDC_CPU3, @@ -42,10 +42,10 @@ static INT_PTR CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wP void ProcessPage_OnSetAffinity(void) { - LV_ITEM lvitem; - ULONG Index; - DWORD dwProcessId; - TCHAR strErrorText[260]; + LV_ITEM lvitem; + ULONG Index; + DWORD dwProcessId; + WCHAR strErrorText[260]; for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { memset(&lvitem, 0, sizeof(LV_ITEM)); @@ -61,8 +61,8 @@ void ProcessPage_OnSetAffinity(void) return; hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId); if (!hProcessAffinityHandle) { - GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(TCHAR)); - LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(TCHAR)); + GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR)); + LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(WCHAR)); MessageBox(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP); return; } @@ -76,10 +76,10 @@ void ProcessPage_OnSetAffinity(void) INT_PTR CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - DWORD dwProcessAffinityMask = 0; - DWORD dwSystemAffinityMask = 0; - TCHAR strErrorText[260]; - BYTE nCpu; + DWORD dwProcessAffinityMask = 0; + DWORD dwSystemAffinityMask = 0; + WCHAR strErrorText[260]; + BYTE nCpu; switch (message) { case WM_INITDIALOG: @@ -89,9 +89,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) * the number of CPUs present in the system */ if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask, &dwSystemAffinityMask)) { - GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(TCHAR)); + GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR)); EndDialog(hDlg, 0); - LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(TCHAR)); + LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(WCHAR)); MessageBox(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP); } @@ -143,8 +143,8 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) * of it's cpu time. */ if (!dwProcessAffinityMask) { - LoadString(hInst, IDS_MSG_PROCESSONEPRO, szTemp, sizeof(szTemp) / sizeof(TCHAR)); - LoadString(hInst, IDS_MSG_INVALIDOPTION, szTempA, sizeof(szTempA) / sizeof(TCHAR)); + LoadString(hInst, IDS_MSG_PROCESSONEPRO, szTemp, sizeof(szTemp) / sizeof(WCHAR)); + LoadString(hInst, IDS_MSG_INVALIDOPTION, szTempA, sizeof(szTempA) / sizeof(WCHAR)); MessageBox(hDlg, szTemp, szTempA, MB_OK|MB_ICONSTOP); return TRUE; } @@ -153,9 +153,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) * Try to set the process affinity */ if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask)) { - GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(TCHAR)); + GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR)); EndDialog(hDlg, LOWORD(wParam)); - LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(TCHAR)); + LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(WCHAR)); MessageBox(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP); } diff --git a/reactos/base/applications/taskmgr/applpage.c b/reactos/base/applications/taskmgr/applpage.c index 5826f9c12f1..c248e50ceaf 100644 --- a/reactos/base/applications/taskmgr/applpage.c +++ b/reactos/base/applications/taskmgr/applpage.c @@ -26,7 +26,7 @@ typedef struct { HWND hWnd; - TCHAR szTitle[260]; + WCHAR szTitle[260]; HICON hIcon; BOOL bHung; } APPLICATION_PAGE_LIST_ITEM, *LPAPPLICATION_PAGE_LIST_ITEM; @@ -42,7 +42,7 @@ static HANDLE hApplicationPageEvent = NULL; /* When this event becomes signa static BOOL bSortAscending = TRUE; DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter); BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam); -void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung); +void AddOrUpdateHwnd(HWND hWnd, WCHAR *szTitle, HICON hIcon, BOOL bHung); void ApplicationPageUpdate(void); void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam); void ApplicationPageShowContextMenu1(void); @@ -60,13 +60,13 @@ BOOL bRestore /* Restore the window if it is minimized */ INT_PTR CALLBACK ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - RECT rc; - int nXDifference; - int nYDifference; - LV_COLUMN column; - TCHAR szTemp[256]; - int cx, cy; - HANDLE hRefreshThread = NULL; + RECT rc; + int nXDifference; + int nYDifference; + LV_COLUMN column; + WCHAR szTemp[256]; + int cx, cy; + HANDLE hRefreshThread = NULL; switch (message) { case WM_INITDIALOG: @@ -85,7 +85,7 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) hApplicationPageSwitchToButton = GetDlgItem(hDlg, IDC_SWITCHTO); hApplicationPageNewTaskButton = GetDlgItem(hDlg, IDC_NEWTASK); - SetWindowText(hApplicationPageListCtrl, _T("Tasks")); + SetWindowText(hApplicationPageListCtrl, L"Tasks"); /* Initialize the application page's controls */ column.mask = LVCF_TEXT|LVCF_WIDTH; @@ -194,7 +194,7 @@ void RefreshApplicationPage(void) void UpdateApplicationListControlViewSetting(void) { - DWORD dwStyle = GetWindowLong(hApplicationPageListCtrl, GWL_STYLE); + DWORD dwStyle = GetWindowLong(hApplicationPageListCtrl, GWL_STYLE); dwStyle &= ~LVS_REPORT; dwStyle &= ~LVS_ICON; @@ -251,11 +251,11 @@ DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter) BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) { - HICON hIcon; - TCHAR szText[260]; - BOOL bLargeIcon; - BOOL bHung = FALSE; - HICON* xhIcon = (HICON*)&hIcon; + HICON hIcon; + WCHAR szText[260]; + BOOL bLargeIcon; + BOOL bHung = FALSE; + HICON* xhIcon = (HICON*)&hIcon; typedef int (FAR __stdcall *IsHungAppWindowProc)(HWND); IsHungAppWindowProc IsHungAppWindow; @@ -270,7 +270,7 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) GetWindowText(hWnd, szText, 260); /* Get the window text */ /* Check and see if this is a top-level app window */ - if ((_tcslen(szText) <= 0) || + if ((wcslen(szText) <= 0) || !IsWindowVisible(hWnd) || (GetParent(hWnd) != NULL) || (GetWindow(hWnd, GW_OWNER) != NULL) || @@ -296,7 +296,7 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) bHung = FALSE; - IsHungAppWindow = (IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle(_T("USER32.DLL")), "IsHungAppWindow"); + IsHungAppWindow = (IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle(L"USER32.DLL"), "IsHungAppWindow"); if (IsHungAppWindow) bHung = IsHungAppWindow(hWnd); @@ -306,15 +306,15 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) return TRUE; } -void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung) +void AddOrUpdateHwnd(HWND hWnd, WCHAR *szTitle, HICON hIcon, BOOL bHung) { - LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; - HIMAGELIST hImageListLarge; - HIMAGELIST hImageListSmall; - LV_ITEM item; - int i; - BOOL bAlreadyInList = FALSE; - BOOL bItemRemoved = FALSE; + LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; + HIMAGELIST hImageListLarge; + HIMAGELIST hImageListSmall; + LV_ITEM item; + int i; + BOOL bAlreadyInList = FALSE; + BOOL bItemRemoved = FALSE; memset(&item, 0, sizeof(LV_ITEM)); @@ -343,13 +343,13 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung) { /* Check to see if anything needs updating */ if ((pAPLI->hIcon != hIcon) || - (_tcsicmp(pAPLI->szTitle, szTitle) != 0) || + (wcsicmp(pAPLI->szTitle, szTitle) != 0) || (pAPLI->bHung != bHung)) { /* Update the structure */ pAPLI->hIcon = hIcon; pAPLI->bHung = bHung; - _tcscpy(pAPLI->szTitle, szTitle); + wcscpy(pAPLI->szTitle, szTitle); /* Update the image list */ ImageList_ReplaceIcon(hImageListLarge, item.iItem, hIcon); @@ -369,7 +369,7 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung) pAPLI->hWnd = hWnd; pAPLI->hIcon = hIcon; pAPLI->bHung = bHung; - _tcscpy(pAPLI->szTitle, szTitle); + wcscpy(pAPLI->szTitle, szTitle); /* Add the item to the list */ memset(&item, 0, sizeof(LV_ITEM)); @@ -393,7 +393,7 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung) pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam; if (!IsWindow(pAPLI->hWnd)|| - (_tcslen(pAPLI->szTitle) <= 0) || + (wcslen(pAPLI->szTitle) <= 0) || !IsWindowVisible(pAPLI->hWnd) || (GetParent(pAPLI->hWnd) != NULL) || (GetWindow(pAPLI->hWnd, GW_OWNER) != NULL) || @@ -446,8 +446,8 @@ void ApplicationPageUpdate(void) /* be present on the menu bar so enable & disable the menu items */ if (TabCtrl_GetCurSel(hTabWnd) == 0) { - HMENU hMenu; - HMENU hWindowsMenu; + HMENU hMenu; + HMENU hWindowsMenu; hMenu = GetMenu(hMainWnd); hWindowsMenu = GetSubMenu(hMenu, 3); @@ -487,12 +487,12 @@ void ApplicationPageUpdate(void) void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam) { - int idctrl; - LPNMHDR pnmh; - LPNM_LISTVIEW pnmv; - LV_DISPINFO* pnmdi; - LPAPPLICATION_PAGE_LIST_ITEM pAPLI; - TCHAR szMsg[256]; + int idctrl; + LPNMHDR pnmh; + LPNM_LISTVIEW pnmv; + LV_DISPINFO* pnmdi; + LPAPPLICATION_PAGE_LIST_ITEM pAPLI; + WCHAR szMsg[256]; idctrl = (int) wParam; @@ -512,7 +512,7 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam) /* Update the item text */ if (pnmdi->item.iSubItem == 0) { - _tcsncpy(pnmdi->item.pszText, pAPLI->szTitle, pnmdi->item.cchTextMax); + wcsncpy(pnmdi->item.pszText, pAPLI->szTitle, pnmdi->item.cchTextMax); } /* Update the item status */ @@ -521,12 +521,12 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam) if (pAPLI->bHung) { LoadString( GetModuleHandle(NULL), IDS_Not_Responding , szMsg, sizeof(szMsg) / sizeof(szMsg[0])); - _tcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax); + wcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax); } else { LoadString( GetModuleHandle(NULL), IDS_Running, (LPTSTR) szMsg, sizeof(szMsg) / sizeof(szMsg[0])); - _tcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax); + wcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax); } } @@ -582,9 +582,9 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam) void ApplicationPageShowContextMenu1(void) { - HMENU hMenu; - HMENU hSubMenu; - POINT pt; + HMENU hMenu; + HMENU hSubMenu; + POINT pt; GetCursorPos(&pt); @@ -605,9 +605,9 @@ void ApplicationPageShowContextMenu1(void) void ApplicationPageShowContextMenu2(void) { - HMENU hMenu; - HMENU hSubMenu; - POINT pt; + HMENU hMenu; + HMENU hSubMenu; + POINT pt; GetCursorPos(&pt); @@ -651,8 +651,8 @@ void ApplicationPageShowContextMenu2(void) void ApplicationPage_OnViewLargeIcons(void) { - HMENU hMenu; - HMENU hViewMenu; + HMENU hMenu; + HMENU hViewMenu; hMenu = GetMenu(hMainWnd); hViewMenu = GetSubMenu(hMenu, 2); @@ -667,8 +667,8 @@ void ApplicationPage_OnViewLargeIcons(void) void ApplicationPage_OnViewSmallIcons(void) { - HMENU hMenu; - HMENU hViewMenu; + HMENU hMenu; + HMENU hViewMenu; hMenu = GetMenu(hMainWnd); hViewMenu = GetSubMenu(hMenu, 2); @@ -683,8 +683,8 @@ void ApplicationPage_OnViewSmallIcons(void) void ApplicationPage_OnViewDetails(void) { - HMENU hMenu; - HMENU hViewMenu; + HMENU hMenu; + HMENU hViewMenu; hMenu = GetMenu(hMainWnd); hViewMenu = GetSubMenu(hMenu, 2); @@ -699,11 +699,11 @@ void ApplicationPage_OnViewDetails(void) void ApplicationPage_OnWindowsTileHorizontally(void) { - LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; - LV_ITEM item; - int i; - HWND* hWndArray; - int nWndCount; + LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; + LV_ITEM item; + int i; + HWND* hWndArray; + int nWndCount; hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl)); nWndCount = 0; @@ -730,11 +730,11 @@ void ApplicationPage_OnWindowsTileHorizontally(void) void ApplicationPage_OnWindowsTileVertically(void) { - LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; - LV_ITEM item; - int i; - HWND* hWndArray; - int nWndCount; + LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; + LV_ITEM item; + int i; + HWND* hWndArray; + int nWndCount; hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl)); nWndCount = 0; @@ -761,9 +761,9 @@ void ApplicationPage_OnWindowsTileVertically(void) void ApplicationPage_OnWindowsMinimize(void) { - LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; - LV_ITEM item; - int i; + LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; + LV_ITEM item; + int i; for (i=0; ihWnd, TRUE); @@ -893,9 +893,9 @@ void ApplicationPage_OnSwitchTo(void) void ApplicationPage_OnEndTask(void) { - LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; - LV_ITEM item; - int i; + LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; + LV_ITEM item; + int i; for (i=0; iszTitle, Param2->szTitle); + return wcscmp(Param1->szTitle, Param2->szTitle); } diff --git a/reactos/base/applications/taskmgr/column.c b/reactos/base/applications/taskmgr/column.c index a0b2aba4b50..24091a2a4d3 100644 --- a/reactos/base/applications/taskmgr/column.c +++ b/reactos/base/applications/taskmgr/column.c @@ -24,7 +24,7 @@ #include UINT ColumnDataHints[COLUMN_NMAX]; -TCHAR szTemp[256]; +WCHAR szTemp[256]; #define DECLARE_COLUMN_PRESET(_name, _size, _state) \ { IDS_TAB_##_name, IDC_##_name, _size, _state }, @@ -62,13 +62,13 @@ INT_PTR CALLBACK ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, void AddColumns(void) { - LRESULT size; - TCHAR szTemp[256]; - unsigned int n; + LRESULT size; + WCHAR szTemp[256]; + unsigned int n; for (n=0; nname || !_tcscmp(buffer + 1, user->name)) + if (!user->name || !wcscmp(buffer + 1, user->name)) { buffer[0] = (buffer[0] & ~user->mask) | (user->value & user->mask); if (WriteProcessMemory(hProcess, addr, buffer, 1, NULL)) @@ -161,7 +161,7 @@ void* get_symbol(HANDLE hProcess, const char* name, const char* lib) if (!(h = wine_dlopen(lib, RTLD_LAZY, buffer, sizeof(buffer)))) { printf("Couldn't load %s (%s)\n", lib, buffer); - return NULL; + return NULL; } env = getenv("LD_LIBRARY_PATH"); @@ -182,14 +182,14 @@ void* get_symbol(HANDLE hProcess, const char* name, const char* lib) free(env); if (!ptr) { - printf("Couldn't find %s in LD_LIBRARY_PATH\n", lib); - return NULL; - } + printf("Couldn't find %s in LD_LIBRARY_PATH\n", lib); + return NULL; + } } if (!(f = popen(buffer, "r"))) { printf("Cannot execute '%s'\n", buffer); - return NULL; + return NULL; } while (fgets(buffer, sizeof(buffer), f)) @@ -216,13 +216,13 @@ void* get_symbol(HANDLE hProcess, const char* name, const char* lib) struct dll_option_layout { - void* next; - void* prev; - char* const* channels; - unsigned int nb_channels; + void* next; + void* prev; + char* const* channels; + unsigned int nb_channels; }; -typedef int (*EnumChannelCB)(HANDLE, void*, TCHAR*, void*); +typedef int (*EnumChannelCB)(HANDLE, void*, WCHAR*, void*); /****************************************************************** * enum_channel @@ -232,18 +232,18 @@ typedef int (*EnumChannelCB)(HANDLE, void*, TCHAR*, void*); */ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned unique) { - struct dll_option_layout dol; - int ret = 1; - void* buf_addr; - TCHAR buffer[32]; - void* addr; - const TCHAR** cache = NULL; - unsigned i, j, num_cache, used_cache; + struct dll_option_layout dol; + int ret = 1; + void* buf_addr; + WCHAR buffer[32]; + void* addr; + const WCHAR** cache = NULL; + unsigned i, j, num_cache, used_cache; addr = get_symbol(hProcess, "first_dll", "libwine.so"); if (!addr) return -1; if (unique) - cache = HeapAlloc(GetProcessHeap(), 0, (num_cache = 32) * sizeof(TCHAR*)); + cache = HeapAlloc(GetProcessHeap(), 0, (num_cache = 32) * sizeof(WCHAR*)); else num_cache = 0; used_cache = 0; @@ -265,11 +265,11 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned * them again */ for (j = 0; j < used_cache; j++) - if (!_tcscmp(cache[j], buffer + 1)) break; + if (!wcscmp(cache[j], buffer + 1)) break; if (j != used_cache) continue; if (used_cache == num_cache) - cache = HeapReAlloc(GetProcessHeap(), 0, cache, (num_cache *= 2) * sizeof(TCHAR*)); - cache[used_cache++] = _tcscpy(HeapAlloc(GetProcessHeap(), 0, (_tcslen(buffer + 1) + 1) * sizeof(TCHAR)), + cache = HeapReAlloc(GetProcessHeap(), 0, cache, (num_cache *= 2) * sizeof(WCHAR*)); + cache[used_cache++] = wcscpy(HeapAlloc(GetProcessHeap(), 0, (wcslen(buffer + 1) + 1) * sizeof(WCHAR)), buffer + 1); } ret = ce(hProcess, buf_addr, buffer, user); @@ -278,7 +278,7 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned } if (unique) { - for (j = 0; j < used_cache; j++) HeapFree(GetProcessHeap(), 0, (TCHAR*)cache[j]); + for (j = 0; j < used_cache; j++) HeapFree(GetProcessHeap(), 0, (WCHAR*)cache[j]); HeapFree(GetProcessHeap(), 0, cache); } return 0; @@ -286,7 +286,7 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned static void DebugChannels_FillList(HWND hChannelLV) { - HANDLE hProcess; + HANDLE hProcess; (void)ListView_DeleteAllItems(hChannelLV); @@ -300,36 +300,36 @@ static void DebugChannels_FillList(HWND hChannelLV) static void DebugChannels_OnCreate(HWND hwndDlg) { - HWND hLV = GetDlgItem(hwndDlg, IDC_DEBUG_CHANNELS_LIST); - LVCOLUMN lvc; + HWND hLV = GetDlgItem(hwndDlg, IDC_DEBUG_CHANNELS_LIST); + LVCOLUMN lvc; lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.fmt = LVCFMT_LEFT; - lvc.pszText = _T("Debug Channel"); + lvc.pszText = L"Debug Channel"; lvc.cx = 100; (void)ListView_InsertColumn(hLV, 0, &lvc); lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.fmt = LVCFMT_CENTER; - lvc.pszText = _T("Fixme"); + lvc.pszText = L"Fixme"; lvc.cx = 55; (void)ListView_InsertColumn(hLV, 1, &lvc); lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.fmt = LVCFMT_CENTER; - lvc.pszText = _T("Err"); + lvc.pszText = L"Err"; lvc.cx = 55; (void)ListView_InsertColumn(hLV, 2, &lvc); lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.fmt = LVCFMT_CENTER; - lvc.pszText = _T("Warn"); + lvc.pszText = L"Warn"; lvc.cx = 55; (void)ListView_InsertColumn(hLV, 3, &lvc); lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.fmt = LVCFMT_CENTER; - lvc.pszText = _T("Trace"); + lvc.pszText = L"Trace"; lvc.cx = 55; (void)ListView_InsertColumn(hLV, 4, &lvc); @@ -338,17 +338,17 @@ static void DebugChannels_OnCreate(HWND hwndDlg) static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam) { - NMHDR* nmh = (NMHDR*)lParam; + NMHDR* nmh = (NMHDR*)lParam; switch (nmh->code) { case NM_CLICK: if (nmh->idFrom == IDC_DEBUG_CHANNELS_LIST) { - LVHITTESTINFO lhti; - HWND hChannelLV; - HANDLE hProcess; - NMITEMACTIVATE* nmia = (NMITEMACTIVATE*)lParam; + LVHITTESTINFO lhti; + HWND hChannelLV; + HANDLE hProcess; + NMITEMACTIVATE* nmia = (NMITEMACTIVATE*)lParam; hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, get_selected_pid()); if (!hProcess) return; /* FIXME message box */ @@ -357,21 +357,21 @@ static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam) SendMessage(hChannelLV, LVM_SUBITEMHITTEST, 0, (LPARAM)&lhti); if (nmia->iSubItem >= 1 && nmia->iSubItem <= 4) { - TCHAR val[2]; - TCHAR name[32]; - unsigned bitmask = 1 << (lhti.iSubItem - 1); - struct cce_user user; + WCHAR val[2]; + WCHAR name[32]; + unsigned bitmask = 1 << (lhti.iSubItem - 1); + struct cce_user user; ListView_GetItemText(hChannelLV, lhti.iItem, 0, name, sizeof(name) / sizeof(name[0])); ListView_GetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val, sizeof(val) / sizeof(val[0])); user.name = name; - user.value = (val[0] == TEXT('x')) ? 0 : bitmask; + user.value = (val[0] == L'x') ? 0 : bitmask; user.mask = bitmask; user.done = user.notdone = 0; enum_channel(hProcess, change_channel_CB, &user, FALSE); if (user.done) { - val[0] ^= (TEXT('x') ^ TEXT(' ')); + val[0] ^= (L'x' ^ L' '); ListView_SetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val); } if (user.notdone) diff --git a/reactos/base/applications/taskmgr/debug.c b/reactos/base/applications/taskmgr/debug.c index 487a72f1535..91c359ded19 100644 --- a/reactos/base/applications/taskmgr/debug.c +++ b/reactos/base/applications/taskmgr/debug.c @@ -28,16 +28,16 @@ void ProcessPage_OnDebug(void) LVITEM lvitem; ULONG Index; DWORD dwProcessId; - TCHAR strErrorText[260]; + WCHAR strErrorText[260]; HKEY hKey; - TCHAR strDebugPath[260]; - TCHAR strDebugger[260]; + WCHAR strDebugPath[260]; + WCHAR strDebugger[260]; DWORD dwDebuggerSize; PROCESS_INFORMATION pi; STARTUPINFO si; HANDLE hDebugEvent; - TCHAR szTemp[256]; - TCHAR szTempA[256]; + WCHAR szTemp[256]; + WCHAR szTempA[256]; for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) @@ -70,7 +70,7 @@ void ProcessPage_OnDebug(void) return; } - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug"), 0, KEY_READ, &hKey) != ERROR_SUCCESS) + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_READ, &hKey) != ERROR_SUCCESS) { GetLastErrorText(strErrorText, 260); LoadString(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256); @@ -79,7 +79,7 @@ void ProcessPage_OnDebug(void) } dwDebuggerSize = 260; - if (RegQueryValueEx(hKey, _T("Debugger"), NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) != ERROR_SUCCESS) { GetLastErrorText(strErrorText, 260); LoadString(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256); diff --git a/reactos/base/applications/taskmgr/endproc.c b/reactos/base/applications/taskmgr/endproc.c index 01a2eb037a2..af7e54a7d5a 100644 --- a/reactos/base/applications/taskmgr/endproc.c +++ b/reactos/base/applications/taskmgr/endproc.c @@ -23,16 +23,16 @@ #include -TCHAR szTemp[256]; -TCHAR szTempA[256]; +WCHAR szTemp[256]; +WCHAR szTempA[256]; void ProcessPage_OnEndProcess(void) { - LVITEM lvitem; - ULONG Index; - DWORD dwProcessId; - HANDLE hProcess; - TCHAR strErrorText[260]; + LVITEM lvitem; + ULONG Index; + DWORD dwProcessId; + HANDLE hProcess; + WCHAR strErrorText[260]; for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { @@ -80,11 +80,11 @@ void ProcessPage_OnEndProcess(void) void ProcessPage_OnEndProcessTree(void) { - LVITEM lvitem; - ULONG Index; - DWORD dwProcessId; - HANDLE hProcess; - TCHAR strErrorText[260]; + LVITEM lvitem; + ULONG Index; + DWORD dwProcessId; + HANDLE hProcess; + WCHAR strErrorText[260]; for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { diff --git a/reactos/base/applications/taskmgr/graph.c b/reactos/base/applications/taskmgr/graph.c index e90725cfd37..8727073ef29 100644 --- a/reactos/base/applications/taskmgr/graph.c +++ b/reactos/base/applications/taskmgr/graph.c @@ -22,20 +22,20 @@ #include -int nlastBarsUsed = 0; +int nlastBarsUsed = 0; -WNDPROC OldGraphWndProc; +WNDPROC OldGraphWndProc; -void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd); -void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd); -void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd); +void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd); +void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd); +void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd); INT_PTR CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - HDC hdc; - PAINTSTRUCT ps; - LONG WindowId; + HDC hdc; + PAINTSTRUCT ps; + LONG WindowId; switch (message) { @@ -131,23 +131,23 @@ Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd) { - RECT rcClient; - RECT rcBarLeft; - RECT rcBarRight; - RECT rcText; - COLORREF crPrevForeground; - TCHAR Text[260]; - HFONT hOldFont; - ULONG CpuUsage; - ULONG CpuKernelUsage; - int nBars; - int nBarsUsed; + RECT rcClient; + RECT rcBarLeft; + RECT rcBarRight; + RECT rcText; + COLORREF crPrevForeground; + WCHAR Text[260]; + HFONT hOldFont; + ULONG CpuUsage; + ULONG CpuKernelUsage; + int nBars; + int nBarsUsed; /* Bottom bars that are "used", i.e. are bright green, representing used cpu time */ - int nBarsUsedKernel; + int nBarsUsedKernel; /* Bottom bars that are "used", i.e. are bright green, representing used cpu kernel time */ - int nBarsFree; + int nBarsFree; /* Top bars that are "unused", i.e. are dark green, representing free cpu time */ - int i; + int i; /* * Get the client area rectangle @@ -163,10 +163,10 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd) * Get the CPU usage */ CpuUsage = PerfDataGetProcessorUsage(); - if (CpuUsage <= 0) CpuUsage = 0; - if (CpuUsage > 100) CpuUsage = 100; + if (CpuUsage <= 0) CpuUsage = 0; + if (CpuUsage > 100) CpuUsage = 100; - _stprintf(Text, _T("%d%%"), (int)CpuUsage); + wsprintf(Text, L"%d%%", (int)CpuUsage); /* * Draw the font text onto the graph @@ -240,22 +240,22 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd) /* * Draw the last "used" bars */ - if ((nlastBarsUsed - nBarsUsed) > 0) { - for (i=0; i< (nlastBarsUsed - nBarsUsed); i++) - { - if (nlastBarsUsed > 5000) nlastBarsUsed = 5000; + if ((nlastBarsUsed - nBarsUsed) > 0) { + for (i=0; i< (nlastBarsUsed - nBarsUsed); i++) + { + if (nlastBarsUsed > 5000) nlastBarsUsed = 5000; - FillSolidRect(hDC, &rcBarLeft, MEDIUM_GREEN); - FillSolidRect(hDC, &rcBarRight, MEDIUM_GREEN); + FillSolidRect(hDC, &rcBarLeft, MEDIUM_GREEN); + FillSolidRect(hDC, &rcBarRight, MEDIUM_GREEN); - rcBarLeft.top += 3; - rcBarLeft.bottom += 3; + rcBarLeft.top += 3; + rcBarLeft.bottom += 3; - rcBarRight.top += 3; - rcBarRight.bottom += 3; - } - } - nlastBarsUsed = nBarsUsed; + rcBarRight.top += 3; + rcBarRight.bottom += 3; + } + } + nlastBarsUsed = nBarsUsed; /* * Draw the "used" bars */ @@ -302,21 +302,21 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd) void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) { - RECT rcClient; - RECT rcBarLeft; - RECT rcBarRight; - RECT rcText; - COLORREF crPrevForeground; - TCHAR Text[260]; - HFONT hOldFont; - ULONGLONG CommitChargeTotal; - ULONGLONG CommitChargeLimit; - int nBars; - int nBarsUsed = 0; + RECT rcClient; + RECT rcBarLeft; + RECT rcBarRight; + RECT rcText; + COLORREF crPrevForeground; + WCHAR Text[260]; + HFONT hOldFont; + ULONGLONG CommitChargeTotal; + ULONGLONG CommitChargeLimit; + int nBars; + int nBarsUsed = 0; /* Bottom bars that are "used", i.e. are bright green, representing used memory */ - int nBarsFree; + int nBarsFree; /* Top bars that are "unused", i.e. are dark green, representing free memory */ - int i; + int i; /* * Get the client area rectangle @@ -335,9 +335,9 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK(); if (CommitChargeTotal > 1024) - _stprintf(Text, _T("%d MB"), (int)(CommitChargeTotal / 1024)); - else - _stprintf(Text, _T("%d K"), (int)CommitChargeTotal); + wsprintf(Text, L"%d MB", (int)(CommitChargeTotal / 1024)); + else + wsprintf(Text, L"%d K", (int)CommitChargeTotal); /* * Draw the font text onto the graph */ @@ -409,10 +409,10 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd) { - RECT rcClient; - ULONGLONG CommitChargeLimit; - int i; - static int offset = 0; + RECT rcClient; + ULONGLONG CommitChargeLimit; + int i; + static int offset = 0; if (offset++ >= 10) offset = 0; diff --git a/reactos/base/applications/taskmgr/graphctl.c b/reactos/base/applications/taskmgr/graphctl.c index fbf1caa550d..941494af1c1 100644 --- a/reactos/base/applications/taskmgr/graphctl.c +++ b/reactos/base/applications/taskmgr/graphctl.c @@ -301,12 +301,12 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this, BOOL bResize) SetTextColor(m_dcGrid, m_crGridColor); SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP); sprintf(strTemp, "%.*lf", m_nYDecimals, m_dUpperLimit); - TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.top, strTemp, _tcslen(strTemp)); + TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.top, strTemp, wcslen(strTemp)); /* y min */ SetTextAlign(m_dcGrid, TA_RIGHT|TA_BASELINE); sprintf(strTemp, "%.*lf", m_nYDecimals, m_dLowerLimit); - TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.bottom, strTemp, _tcslen(strTemp)); + TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.bottom, strTemp, wcslen(strTemp)); /* x min */ SetTextAlign(m_dcGrid, TA_LEFT|TA_TOP); @@ -315,12 +315,12 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this, BOOL bResize) /* x max */ SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP); sprintf(strTemp, "%d", m_nPlotWidth/m_nShiftPixels); - TextOut(m_dcGrid, m_rectPlot.right, m_rectPlot.bottom+4, strTemp, _tcslen(strTemp)); + TextOut(m_dcGrid, m_rectPlot.right, m_rectPlot.bottom+4, strTemp, wcslen(strTemp)); /* x units */ SetTextAlign(m_dcGrid, TA_CENTER|TA_TOP); TextOut(m_dcGrid, (m_rectPlot.left+m_rectPlot.right)/2, - m_rectPlot.bottom+4, m_strXUnitsString, _tcslen(m_strXUnitsString)); + m_rectPlot.bottom+4, m_strXUnitsString, wcslen(m_strXUnitsString)); /* restore the font */ SelectObject(m_dcGrid, oldFont); @@ -329,7 +329,7 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this, BOOL bResize) oldFont = (HFONT)SelectObject(m_dcGrid, yUnitFont); SetTextAlign(m_dcGrid, TA_CENTER|TA_BASELINE); TextOut(m_dcGrid, (m_rectClient.left+m_rectPlot.left)/2, - (m_rectPlot.bottom+m_rectPlot.top)/2, m_strYUnitsString, _tcslen(m_strYUnitsString)); + (m_rectPlot.bottom+m_rectPlot.top)/2, m_strYUnitsString, wcslen(m_strYUnitsString)); SelectObject(m_dcGrid, oldFont); #endif /* at this point we are done filling the the grid bitmap, */ diff --git a/reactos/base/applications/taskmgr/optnmenu.c b/reactos/base/applications/taskmgr/optnmenu.c index 74dca58749e..880bf7e61c9 100644 --- a/reactos/base/applications/taskmgr/optnmenu.c +++ b/reactos/base/applications/taskmgr/optnmenu.c @@ -30,8 +30,8 @@ void TaskManager_OnOptionsAlwaysOnTop(void) { - HMENU hMenu; - HMENU hOptionsMenu; + HMENU hMenu; + HMENU hOptionsMenu; hMenu = GetMenu(hMainWnd); hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX); @@ -56,8 +56,8 @@ void TaskManager_OnOptionsAlwaysOnTop(void) void TaskManager_OnOptionsMinimizeOnUse(void) { - HMENU hMenu; - HMENU hOptionsMenu; + HMENU hMenu; + HMENU hOptionsMenu; hMenu = GetMenu(hMainWnd); hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX); @@ -79,8 +79,8 @@ void TaskManager_OnOptionsMinimizeOnUse(void) void TaskManager_OnOptionsHideWhenMinimized(void) { - HMENU hMenu; - HMENU hOptionsMenu; + HMENU hMenu; + HMENU hOptionsMenu; hMenu = GetMenu(hMainWnd); hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX); @@ -102,8 +102,8 @@ void TaskManager_OnOptionsHideWhenMinimized(void) void TaskManager_OnOptionsShow16BitTasks(void) { - HMENU hMenu; - HMENU hOptionsMenu; + HMENU hMenu; + HMENU hOptionsMenu; hMenu = GetMenu(hMainWnd); hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX); diff --git a/reactos/base/applications/taskmgr/perfdata.c b/reactos/base/applications/taskmgr/perfdata.c index f76a5cad641..e9b3387a2e1 100644 --- a/reactos/base/applications/taskmgr/perfdata.c +++ b/reactos/base/applications/taskmgr/perfdata.c @@ -22,23 +22,23 @@ #include -CRITICAL_SECTION PerfDataCriticalSection; -PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */ -PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */ -ULONG ProcessCountOld = 0; -ULONG ProcessCount = 0; -double dbIdleTime; -double dbKernelTime; -double dbSystemTime; -LARGE_INTEGER liOldIdleTime = {{0,0}}; -double OldKernelTime = 0; -LARGE_INTEGER liOldSystemTime = {{0,0}}; -SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo; -SYSTEM_BASIC_INFORMATION SystemBasicInfo; -SYSTEM_FILECACHE_INFORMATION SystemCacheInfo; -SYSTEM_HANDLE_INFORMATION SystemHandleInfo; -PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo = NULL; -PSID SystemUserSid = NULL; +CRITICAL_SECTION PerfDataCriticalSection; +PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */ +PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */ +ULONG ProcessCountOld = 0; +ULONG ProcessCount = 0; +double dbIdleTime; +double dbKernelTime; +double dbSystemTime; +LARGE_INTEGER liOldIdleTime = {{0,0}}; +double OldKernelTime = 0; +LARGE_INTEGER liOldSystemTime = {{0,0}}; +SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo; +SYSTEM_BASIC_INFORMATION SystemBasicInfo; +SYSTEM_FILECACHE_INFORMATION SystemCacheInfo; +SYSTEM_HANDLE_INFORMATION SystemHandleInfo; +PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo = NULL; +PSID SystemUserSid = NULL; BOOL PerfDataInitialize(void) { @@ -78,7 +78,7 @@ void PerfDataUninitialize(void) static void SidToUserName(PSID Sid, LPTSTR szBuffer, DWORD BufferSize) { - static TCHAR szDomainNameUnused[255]; + static WCHAR szDomainNameUnused[255]; DWORD DomainNameLen = sizeof(szDomainNameUnused) / sizeof(szDomainNameUnused[0]); SID_NAME_USE Use; @@ -88,24 +88,24 @@ static void SidToUserName(PSID Sid, LPTSTR szBuffer, DWORD BufferSize) void PerfDataRefresh(void) { - SIZE_T ulSize; - NTSTATUS status; - LPBYTE pBuffer; - ULONG BufferSize; - PSYSTEM_PROCESS_INFORMATION pSPI; - PPERFDATA pPDOld; - ULONG Idx, Idx2; - HANDLE hProcess; - HANDLE hProcessToken; - SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo; - SYSTEM_TIMEOFDAY_INFORMATION SysTimeInfo; - SYSTEM_FILECACHE_INFORMATION SysCacheInfo; - LPBYTE SysHandleInfoData; - PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcessorTimeInfo; - double CurrentKernelTime; - PSECURITY_DESCRIPTOR ProcessSD; - PSID ProcessUser; - ULONG Buffer[64]; /* must be 4 bytes aligned! */ + SIZE_T ulSize; + NTSTATUS status; + LPBYTE pBuffer; + ULONG BufferSize; + PSYSTEM_PROCESS_INFORMATION pSPI; + PPERFDATA pPDOld; + ULONG Idx, Idx2; + HANDLE hProcess; + HANDLE hProcessToken; + SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo; + SYSTEM_TIMEOFDAY_INFORMATION SysTimeInfo; + SYSTEM_FILECACHE_INFORMATION SysCacheInfo; + LPBYTE SysHandleInfoData; + PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcessorTimeInfo; + double CurrentKernelTime; + PSECURITY_DESCRIPTOR ProcessSD; + PSID ProcessUser; + ULONG Buffer[64]; /* must be 4 bytes aligned! */ /* Get new system time */ status = NtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0); @@ -260,8 +260,8 @@ void PerfDataRefresh(void) if (pSPI->ImageName.Buffer) wcscpy(pPerfData[Idx].ImageName, pSPI->ImageName.Buffer); else - LoadStringW(hInst, IDS_IDLE_PROCESS, pPerfData[Idx].ImageName, - sizeof(pPerfData[Idx].ImageName) / sizeof(pPerfData[Idx].ImageName[0])); + LoadString(hInst, IDS_IDLE_PROCESS, pPerfData[Idx].ImageName, + sizeof(pPerfData[Idx].ImageName) / sizeof(pPerfData[Idx].ImageName[0])); pPerfData[Idx].ProcessId = pSPI->UniqueProcessId; @@ -291,7 +291,7 @@ void PerfDataRefresh(void) pPerfData[Idx].HandleCount = pSPI->HandleCount; pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads; pPerfData[Idx].SessionId = pSPI->SessionId; - pPerfData[Idx].UserName[0] = _T('\0'); + pPerfData[Idx].UserName[0] = L'\0'; pPerfData[Idx].USERObjectCount = 0; pPerfData[Idx].GDIObjectCount = 0; ProcessUser = SystemUserSid; @@ -370,17 +370,12 @@ ULONG PerfDataGetProcessorSystemUsage(void) BOOL PerfDataGetImageName(ULONG Index, LPTSTR lpImageName, int nMaxCount) { - BOOL bSuccessful; + BOOL bSuccessful; EnterCriticalSection(&PerfDataCriticalSection); if (Index < ProcessCount) { - #ifdef _UNICODE - wcsncpy(lpImageName, pPerfData[Index].ImageName, nMaxCount); - #else - WideCharToMultiByte(CP_ACP, 0, pPerfData[Index].ImageName, -1, lpImageName, nMaxCount, NULL, NULL); - #endif - + wcsncpy(lpImageName, pPerfData[Index].ImageName, nMaxCount); bSuccessful = TRUE; } else { bSuccessful = FALSE; @@ -411,7 +406,7 @@ int PerfGetIndexByProcessId(DWORD dwProcessId) ULONG PerfDataGetProcessId(ULONG Index) { - ULONG ProcessId; + ULONG ProcessId; EnterCriticalSection(&PerfDataCriticalSection); @@ -427,17 +422,12 @@ ULONG PerfDataGetProcessId(ULONG Index) BOOL PerfDataGetUserName(ULONG Index, LPTSTR lpUserName, int nMaxCount) { - BOOL bSuccessful; + BOOL bSuccessful; EnterCriticalSection(&PerfDataCriticalSection); if (Index < ProcessCount) { - #ifdef _UNICODE - wcsncpy(lpUserName, pPerfData[Index].UserName, nMaxCount); - #else - WideCharToMultiByte(CP_ACP, 0, pPerfData[Index].UserName, -1, lpUserName, nMaxCount, NULL, NULL); - #endif - + wcsncpy(lpUserName, pPerfData[Index].UserName, nMaxCount); bSuccessful = TRUE; } else { bSuccessful = FALSE; @@ -450,7 +440,7 @@ BOOL PerfDataGetUserName(ULONG Index, LPTSTR lpUserName, int nMaxCount) ULONG PerfDataGetSessionId(ULONG Index) { - ULONG SessionId; + ULONG SessionId; EnterCriticalSection(&PerfDataCriticalSection); @@ -466,7 +456,7 @@ ULONG PerfDataGetSessionId(ULONG Index) ULONG PerfDataGetCPUUsage(ULONG Index) { - ULONG CpuUsage; + ULONG CpuUsage; EnterCriticalSection(&PerfDataCriticalSection); @@ -482,7 +472,7 @@ ULONG PerfDataGetCPUUsage(ULONG Index) LARGE_INTEGER PerfDataGetCPUTime(ULONG Index) { - LARGE_INTEGER CpuTime = {{0,0}}; + LARGE_INTEGER CpuTime = {{0,0}}; EnterCriticalSection(&PerfDataCriticalSection); @@ -496,7 +486,7 @@ LARGE_INTEGER PerfDataGetCPUTime(ULONG Index) ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index) { - ULONG WorkingSetSizeBytes; + ULONG WorkingSetSizeBytes; EnterCriticalSection(&PerfDataCriticalSection); @@ -512,7 +502,7 @@ ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index) ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index) { - ULONG PeakWorkingSetSizeBytes; + ULONG PeakWorkingSetSizeBytes; EnterCriticalSection(&PerfDataCriticalSection); @@ -528,7 +518,7 @@ ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index) ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index) { - ULONG WorkingSetSizeDelta; + ULONG WorkingSetSizeDelta; EnterCriticalSection(&PerfDataCriticalSection); @@ -544,7 +534,7 @@ ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index) ULONG PerfDataGetPageFaultCount(ULONG Index) { - ULONG PageFaultCount; + ULONG PageFaultCount; EnterCriticalSection(&PerfDataCriticalSection); @@ -560,7 +550,7 @@ ULONG PerfDataGetPageFaultCount(ULONG Index) ULONG PerfDataGetPageFaultCountDelta(ULONG Index) { - ULONG PageFaultCountDelta; + ULONG PageFaultCountDelta; EnterCriticalSection(&PerfDataCriticalSection); @@ -576,7 +566,7 @@ ULONG PerfDataGetPageFaultCountDelta(ULONG Index) ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index) { - ULONG VirtualMemorySizeBytes; + ULONG VirtualMemorySizeBytes; EnterCriticalSection(&PerfDataCriticalSection); @@ -592,7 +582,7 @@ ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index) ULONG PerfDataGetPagedPoolUsagePages(ULONG Index) { - ULONG PagedPoolUsage; + ULONG PagedPoolUsage; EnterCriticalSection(&PerfDataCriticalSection); @@ -608,7 +598,7 @@ ULONG PerfDataGetPagedPoolUsagePages(ULONG Index) ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index) { - ULONG NonPagedPoolUsage; + ULONG NonPagedPoolUsage; EnterCriticalSection(&PerfDataCriticalSection); @@ -624,7 +614,7 @@ ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index) ULONG PerfDataGetBasePriority(ULONG Index) { - ULONG BasePriority; + ULONG BasePriority; EnterCriticalSection(&PerfDataCriticalSection); @@ -640,7 +630,7 @@ ULONG PerfDataGetBasePriority(ULONG Index) ULONG PerfDataGetHandleCount(ULONG Index) { - ULONG HandleCount; + ULONG HandleCount; EnterCriticalSection(&PerfDataCriticalSection); @@ -656,7 +646,7 @@ ULONG PerfDataGetHandleCount(ULONG Index) ULONG PerfDataGetThreadCount(ULONG Index) { - ULONG ThreadCount; + ULONG ThreadCount; EnterCriticalSection(&PerfDataCriticalSection); @@ -672,7 +662,7 @@ ULONG PerfDataGetThreadCount(ULONG Index) ULONG PerfDataGetUSERObjectCount(ULONG Index) { - ULONG USERObjectCount; + ULONG USERObjectCount; EnterCriticalSection(&PerfDataCriticalSection); @@ -688,7 +678,7 @@ ULONG PerfDataGetUSERObjectCount(ULONG Index) ULONG PerfDataGetGDIObjectCount(ULONG Index) { - ULONG GDIObjectCount; + ULONG GDIObjectCount; EnterCriticalSection(&PerfDataCriticalSection); @@ -704,7 +694,7 @@ ULONG PerfDataGetGDIObjectCount(ULONG Index) BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters) { - BOOL bSuccessful; + BOOL bSuccessful; EnterCriticalSection(&PerfDataCriticalSection); @@ -723,8 +713,8 @@ BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters) ULONG PerfDataGetCommitChargeTotalK(void) { - ULONG Total; - ULONG PageSize; + ULONG Total; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); @@ -740,8 +730,8 @@ ULONG PerfDataGetCommitChargeTotalK(void) ULONG PerfDataGetCommitChargeLimitK(void) { - ULONG Limit; - ULONG PageSize; + ULONG Limit; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); @@ -757,8 +747,8 @@ ULONG PerfDataGetCommitChargeLimitK(void) ULONG PerfDataGetCommitChargePeakK(void) { - ULONG Peak; - ULONG PageSize; + ULONG Peak; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); @@ -774,10 +764,10 @@ ULONG PerfDataGetCommitChargePeakK(void) ULONG PerfDataGetKernelMemoryTotalK(void) { - ULONG Total; - ULONG Paged; - ULONG NonPaged; - ULONG PageSize; + ULONG Total; + ULONG Paged; + ULONG NonPaged; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); @@ -797,8 +787,8 @@ ULONG PerfDataGetKernelMemoryTotalK(void) ULONG PerfDataGetKernelMemoryPagedK(void) { - ULONG Paged; - ULONG PageSize; + ULONG Paged; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); @@ -814,8 +804,8 @@ ULONG PerfDataGetKernelMemoryPagedK(void) ULONG PerfDataGetKernelMemoryNonPagedK(void) { - ULONG NonPaged; - ULONG PageSize; + ULONG NonPaged; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); @@ -831,8 +821,8 @@ ULONG PerfDataGetKernelMemoryNonPagedK(void) ULONG PerfDataGetPhysicalMemoryTotalK(void) { - ULONG Total; - ULONG PageSize; + ULONG Total; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); @@ -848,8 +838,8 @@ ULONG PerfDataGetPhysicalMemoryTotalK(void) ULONG PerfDataGetPhysicalMemoryAvailableK(void) { - ULONG Available; - ULONG PageSize; + ULONG Available; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); @@ -865,8 +855,8 @@ ULONG PerfDataGetPhysicalMemoryAvailableK(void) ULONG PerfDataGetPhysicalMemorySystemCacheK(void) { - ULONG SystemCache; - ULONG PageSize; + ULONG SystemCache; + ULONG PageSize; EnterCriticalSection(&PerfDataCriticalSection); @@ -880,7 +870,7 @@ ULONG PerfDataGetPhysicalMemorySystemCacheK(void) ULONG PerfDataGetSystemHandleCount(void) { - ULONG HandleCount; + ULONG HandleCount; EnterCriticalSection(&PerfDataCriticalSection); @@ -893,8 +883,8 @@ ULONG PerfDataGetSystemHandleCount(void) ULONG PerfDataGetTotalThreadCount(void) { - ULONG ThreadCount = 0; - ULONG i; + ULONG ThreadCount = 0; + ULONG i; EnterCriticalSection(&PerfDataCriticalSection); diff --git a/reactos/base/applications/taskmgr/perfpage.c b/reactos/base/applications/taskmgr/perfpage.c index 40a3aa7214d..e0460b4cac4 100644 --- a/reactos/base/applications/taskmgr/perfpage.c +++ b/reactos/base/applications/taskmgr/perfpage.c @@ -25,43 +25,43 @@ TGraphCtrl PerformancePageCpuUsageHistoryGraph; TGraphCtrl PerformancePageMemUsageHistoryGraph; -HWND hPerformancePage; /* Performance Property Page */ -HWND hPerformancePageCpuUsageGraph; /* CPU Usage Graph */ -HWND hPerformancePageMemUsageGraph; /* MEM Usage Graph */ -HWND hPerformancePageCpuUsageHistoryGraph; /* CPU Usage History Graph */ -HWND hPerformancePageMemUsageHistoryGraph; /* Memory Usage History Graph */ -HWND hPerformancePageTotalsFrame; /* Totals Frame */ -HWND hPerformancePageCommitChargeFrame; /* Commit Charge Frame */ -HWND hPerformancePageKernelMemoryFrame; /* Kernel Memory Frame */ -HWND hPerformancePagePhysicalMemoryFrame; /* Physical Memory Frame */ -HWND hPerformancePageCpuUsageFrame; -HWND hPerformancePageMemUsageFrame; -HWND hPerformancePageCpuUsageHistoryFrame; -HWND hPerformancePageMemUsageHistoryFrame; -HWND hPerformancePageCommitChargeTotalEdit; /* Commit Charge Total Edit Control */ -HWND hPerformancePageCommitChargeLimitEdit; /* Commit Charge Limit Edit Control */ -HWND hPerformancePageCommitChargePeakEdit; /* Commit Charge Peak Edit Control */ -HWND hPerformancePageKernelMemoryTotalEdit; /* Kernel Memory Total Edit Control */ -HWND hPerformancePageKernelMemoryPagedEdit; /* Kernel Memory Paged Edit Control */ -HWND hPerformancePageKernelMemoryNonPagedEdit; /* Kernel Memory NonPaged Edit Control */ -HWND hPerformancePagePhysicalMemoryTotalEdit; /* Physical Memory Total Edit Control */ -HWND hPerformancePagePhysicalMemoryAvailableEdit; /* Physical Memory Available Edit Control */ -HWND hPerformancePagePhysicalMemorySystemCacheEdit; /* Physical Memory System Cache Edit Control */ -HWND hPerformancePageTotalsHandleCountEdit; /* Total Handles Edit Control */ -HWND hPerformancePageTotalsProcessCountEdit; /* Total Processes Edit Control */ -HWND hPerformancePageTotalsThreadCountEdit; /* Total Threads Edit Control */ +HWND hPerformancePage; /* Performance Property Page */ +HWND hPerformancePageCpuUsageGraph; /* CPU Usage Graph */ +HWND hPerformancePageMemUsageGraph; /* MEM Usage Graph */ +HWND hPerformancePageCpuUsageHistoryGraph; /* CPU Usage History Graph */ +HWND hPerformancePageMemUsageHistoryGraph; /* Memory Usage History Graph */ +HWND hPerformancePageTotalsFrame; /* Totals Frame */ +HWND hPerformancePageCommitChargeFrame; /* Commit Charge Frame */ +HWND hPerformancePageKernelMemoryFrame; /* Kernel Memory Frame */ +HWND hPerformancePagePhysicalMemoryFrame; /* Physical Memory Frame */ +HWND hPerformancePageCpuUsageFrame; +HWND hPerformancePageMemUsageFrame; +HWND hPerformancePageCpuUsageHistoryFrame; +HWND hPerformancePageMemUsageHistoryFrame; +HWND hPerformancePageCommitChargeTotalEdit; /* Commit Charge Total Edit Control */ +HWND hPerformancePageCommitChargeLimitEdit; /* Commit Charge Limit Edit Control */ +HWND hPerformancePageCommitChargePeakEdit; /* Commit Charge Peak Edit Control */ +HWND hPerformancePageKernelMemoryTotalEdit; /* Kernel Memory Total Edit Control */ +HWND hPerformancePageKernelMemoryPagedEdit; /* Kernel Memory Paged Edit Control */ +HWND hPerformancePageKernelMemoryNonPagedEdit; /* Kernel Memory NonPaged Edit Control */ +HWND hPerformancePagePhysicalMemoryTotalEdit; /* Physical Memory Total Edit Control */ +HWND hPerformancePagePhysicalMemoryAvailableEdit; /* Physical Memory Available Edit Control */ +HWND hPerformancePagePhysicalMemorySystemCacheEdit; /* Physical Memory System Cache Edit Control */ +HWND hPerformancePageTotalsHandleCountEdit; /* Total Handles Edit Control */ +HWND hPerformancePageTotalsProcessCountEdit; /* Total Processes Edit Control */ +HWND hPerformancePageTotalsThreadCountEdit; /* Total Threads Edit Control */ -static int nPerformancePageWidth; -static int nPerformancePageHeight; -static int lastX, lastY; -static HANDLE hPerformancePageEvent = NULL; /* When this event becomes signaled then we refresh the performance page */ -DWORD WINAPI PerformancePageRefreshThread(void *lpParameter); +static int nPerformancePageWidth; +static int nPerformancePageHeight; +static int lastX, lastY; +static HANDLE hPerformancePageEvent = NULL; /* When this event becomes signaled then we refresh the performance page */ +DWORD WINAPI PerformancePageRefreshThread(void *lpParameter); void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos) { - RECT rc; - int cx, cy, sx, sy; + RECT rc; + int cx, cy, sx, sy; GetClientRect(hCntrl, &rc); MapWindowPoints(hCntrl, hDlg, (LPPOINT)(PRECT)(&rc), (sizeof(RECT)/sizeof(POINT))); @@ -107,11 +107,11 @@ void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference) INT_PTR CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - RECT rc; - int nXDifference; - int nYDifference; + RECT rc; + int nXDifference; + int nYDifference; #ifdef RUN_PERF_PAGE - HANDLE hRefreshThread = NULL; + HANDLE hRefreshThread = NULL; #endif /* HDC hdc; */ /* PAINTSTRUCT ps; */ @@ -121,7 +121,7 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph); GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph); #ifdef RUN_PERF_PAGE - CloseHandle(hRefreshThread); + CloseHandle(hRefreshThread); #endif break; @@ -204,8 +204,8 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) SetWindowLongPtr(hPerformancePageCpuUsageHistoryGraph, GWL_WNDPROC, (LONG_PTR)GraphCtrl_WndProc); return TRUE; - case WM_COMMAND: - break; + case WM_COMMAND: + break; #if 0 case WM_NCPAINT: hdc = GetDC(hDlg); @@ -221,22 +221,22 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) EndPaint(hDlg, &ps); break; #endif - case WM_SIZE: + case WM_SIZE: do { - int cx, cy; + int cx, cy; - if (wParam == SIZE_MINIMIZED) - return 0; + if (wParam == SIZE_MINIMIZED) + return 0; - cx = LOWORD(lParam); - cy = HIWORD(lParam); - nXDifference = cx - nPerformancePageWidth; - nYDifference = cy - nPerformancePageHeight; - nPerformancePageWidth = cx; - nPerformancePageHeight = cy; + cx = LOWORD(lParam); + cy = HIWORD(lParam); + nXDifference = cx - nPerformancePageWidth; + nYDifference = cy - nPerformancePageHeight; + nPerformancePageWidth = cx; + nPerformancePageHeight = cy; } while (0); - /* Reposition the performance page's controls */ + /* Reposition the performance page's controls */ AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0); AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0); AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0); @@ -274,20 +274,20 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) if (nXDifference > 0) { nXDifference--; lastX++; - } else { + } else { nXDifference++; lastX--; - } - } + } + } if (nYDifference % 2) { if (nYDifference > 0) { nYDifference--; lastY++; - } else { + } else { nYDifference++; lastY--; - } - } + } + } AdjustFrameSize(hPerformancePageCpuUsageFrame, hDlg, nXDifference, nYDifference, 1); AdjustFrameSize(hPerformancePageMemUsageFrame, hDlg, nXDifference, nYDifference, 2); AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3); @@ -296,148 +296,148 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) AdjustFrameSize(hPerformancePageMemUsageGraph, hDlg, nXDifference, nYDifference, 2); AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3); AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4); - break; - } + break; + } return 0; } void RefreshPerformancePage(void) { - /* Signal the event so that our refresh thread */ - /* will wake up and refresh the performance page */ - SetEvent(hPerformancePageEvent); + /* Signal the event so that our refresh thread */ + /* will wake up and refresh the performance page */ + SetEvent(hPerformancePageEvent); } DWORD WINAPI PerformancePageRefreshThread(void *lpParameter) { - ULONG CommitChargeTotal; - ULONG CommitChargeLimit; - ULONG CommitChargePeak; + ULONG CommitChargeTotal; + ULONG CommitChargeLimit; + ULONG CommitChargePeak; - ULONG CpuUsage; - ULONG CpuKernelUsage; + ULONG CpuUsage; + ULONG CpuKernelUsage; - ULONG KernelMemoryTotal; - ULONG KernelMemoryPaged; - ULONG KernelMemoryNonPaged; + ULONG KernelMemoryTotal; + ULONG KernelMemoryPaged; + ULONG KernelMemoryNonPaged; - ULONG PhysicalMemoryTotal; - ULONG PhysicalMemoryAvailable; - ULONG PhysicalMemorySystemCache; + ULONG PhysicalMemoryTotal; + ULONG PhysicalMemoryAvailable; + ULONG PhysicalMemorySystemCache; - ULONG TotalHandles; - ULONG TotalThreads; - ULONG TotalProcesses; + ULONG TotalHandles; + ULONG TotalThreads; + ULONG TotalProcesses; - TCHAR Text[260]; - TCHAR szMemUsage[256]; + WCHAR Text[260]; + WCHAR szMemUsage[256]; - /* Create the event */ - hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, NULL); + /* Create the event */ + hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, NULL); - /* If we couldn't create the event then exit the thread */ - if (!hPerformancePageEvent) - return 0; + /* If we couldn't create the event then exit the thread */ + if (!hPerformancePageEvent) + return 0; - LoadString(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, 256); + LoadString(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, 256); - while (1) - { - DWORD dwWaitVal; + while (1) + { + DWORD dwWaitVal; - int nBarsUsed1; - int nBarsUsed2; + int nBarsUsed1; + int nBarsUsed2; - /* Wait on the event */ - dwWaitVal = WaitForSingleObject(hPerformancePageEvent, INFINITE); + /* Wait on the event */ + dwWaitVal = WaitForSingleObject(hPerformancePageEvent, INFINITE); - /* If the wait failed then the event object must have been */ - /* closed and the task manager is exiting so exit this thread */ - if (dwWaitVal == WAIT_FAILED) - return 0; + /* If the wait failed then the event object must have been */ + /* closed and the task manager is exiting so exit this thread */ + if (dwWaitVal == WAIT_FAILED) + return 0; - if (dwWaitVal == WAIT_OBJECT_0) - { - /* Reset our event */ - ResetEvent(hPerformancePageEvent); + if (dwWaitVal == WAIT_OBJECT_0) + { + /* Reset our event */ + ResetEvent(hPerformancePageEvent); - /* - * Update the commit charge info - */ - CommitChargeTotal = PerfDataGetCommitChargeTotalK(); - CommitChargeLimit = PerfDataGetCommitChargeLimitK(); - CommitChargePeak = PerfDataGetCommitChargePeakK(); - _ultot(CommitChargeTotal, Text, 10); - SetWindowText(hPerformancePageCommitChargeTotalEdit, Text); - _ultot(CommitChargeLimit, Text, 10); - SetWindowText(hPerformancePageCommitChargeLimitEdit, Text); - _ultot(CommitChargePeak, Text, 10); - SetWindowText(hPerformancePageCommitChargePeakEdit, Text); - wsprintf(Text, szMemUsage, CommitChargeTotal, CommitChargeLimit); - SendMessage(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text); + /* + * Update the commit charge info + */ + CommitChargeTotal = PerfDataGetCommitChargeTotalK(); + CommitChargeLimit = PerfDataGetCommitChargeLimitK(); + CommitChargePeak = PerfDataGetCommitChargePeakK(); + _ultow(CommitChargeTotal, Text, 10); + SetWindowText(hPerformancePageCommitChargeTotalEdit, Text); + _ultow(CommitChargeLimit, Text, 10); + SetWindowText(hPerformancePageCommitChargeLimitEdit, Text); + _ultow(CommitChargePeak, Text, 10); + SetWindowText(hPerformancePageCommitChargePeakEdit, Text); + wsprintf(Text, szMemUsage, CommitChargeTotal, CommitChargeLimit); + SendMessage(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text); - /* - * Update the kernel memory info - */ - KernelMemoryTotal = PerfDataGetKernelMemoryTotalK(); - KernelMemoryPaged = PerfDataGetKernelMemoryPagedK(); - KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK(); - _ultot(KernelMemoryTotal, Text, 10); - SetWindowText(hPerformancePageKernelMemoryTotalEdit, Text); - _ultot(KernelMemoryPaged, Text, 10); - SetWindowText(hPerformancePageKernelMemoryPagedEdit, Text); - _ultot(KernelMemoryNonPaged, Text, 10); - SetWindowText(hPerformancePageKernelMemoryNonPagedEdit, Text); + /* + * Update the kernel memory info + */ + KernelMemoryTotal = PerfDataGetKernelMemoryTotalK(); + KernelMemoryPaged = PerfDataGetKernelMemoryPagedK(); + KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK(); + _ultow(KernelMemoryTotal, Text, 10); + SetWindowText(hPerformancePageKernelMemoryTotalEdit, Text); + _ultow(KernelMemoryPaged, Text, 10); + SetWindowText(hPerformancePageKernelMemoryPagedEdit, Text); + _ultow(KernelMemoryNonPaged, Text, 10); + SetWindowText(hPerformancePageKernelMemoryNonPagedEdit, Text); - /* - * Update the physical memory info - */ - PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK(); - PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK(); - PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK(); - _ultot(PhysicalMemoryTotal, Text, 10); - SetWindowText(hPerformancePagePhysicalMemoryTotalEdit, Text); - _ultot(PhysicalMemoryAvailable, Text, 10); - SetWindowText(hPerformancePagePhysicalMemoryAvailableEdit, Text); - _ultot(PhysicalMemorySystemCache, Text, 10); - SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit, Text); + /* + * Update the physical memory info + */ + PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK(); + PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK(); + PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK(); + _ultow(PhysicalMemoryTotal, Text, 10); + SetWindowText(hPerformancePagePhysicalMemoryTotalEdit, Text); + _ultow(PhysicalMemoryAvailable, Text, 10); + SetWindowText(hPerformancePagePhysicalMemoryAvailableEdit, Text); + _ultow(PhysicalMemorySystemCache, Text, 10); + SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit, Text); - /* - * Update the totals info - */ - TotalHandles = PerfDataGetSystemHandleCount(); - TotalThreads = PerfDataGetTotalThreadCount(); - TotalProcesses = PerfDataGetProcessCount(); - _ultot(TotalHandles, Text, 10); - SetWindowText(hPerformancePageTotalsHandleCountEdit, Text); - _ultot(TotalThreads, Text, 10); - SetWindowText(hPerformancePageTotalsThreadCountEdit, Text); - _ultot(TotalProcesses, Text, 10); - SetWindowText(hPerformancePageTotalsProcessCountEdit, Text); + /* + * Update the totals info + */ + TotalHandles = PerfDataGetSystemHandleCount(); + TotalThreads = PerfDataGetTotalThreadCount(); + TotalProcesses = PerfDataGetProcessCount(); + _ultow(TotalHandles, Text, 10); + SetWindowText(hPerformancePageTotalsHandleCountEdit, Text); + _ultow(TotalThreads, Text, 10); + SetWindowText(hPerformancePageTotalsThreadCountEdit, Text); + _ultow(TotalProcesses, Text, 10); + SetWindowText(hPerformancePageTotalsProcessCountEdit, Text); - /* - * Redraw the graphs - */ - InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE); - InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE); + /* + * Redraw the graphs + */ + InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE); + InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE); - /* - * Get the CPU usage - */ - CpuUsage = PerfDataGetProcessorUsage(); - if (CpuUsage <= 0 ) CpuUsage = 0; - if (CpuUsage > 100) CpuUsage = 100; + /* + * Get the CPU usage + */ + CpuUsage = PerfDataGetProcessorUsage(); + if (CpuUsage <= 0 ) CpuUsage = 0; + if (CpuUsage > 100) CpuUsage = 100; - if (TaskManagerSettings.ShowKernelTimes) - { - CpuKernelUsage = PerfDataGetProcessorSystemUsage(); - if (CpuKernelUsage <= 0) CpuKernelUsage = 0; - if (CpuKernelUsage > 100) CpuKernelUsage = 100; - } - else - { - CpuKernelUsage = 0; - } + if (TaskManagerSettings.ShowKernelTimes) + { + CpuKernelUsage = PerfDataGetProcessorSystemUsage(); + if (CpuKernelUsage <= 0) CpuKernelUsage = 0; + if (CpuKernelUsage > 100) CpuKernelUsage = 100; + } + else + { + CpuKernelUsage = 0; + } /* * Get the memory usage */ @@ -445,8 +445,8 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter) CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK(); nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0; - PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK(); - PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK(); + PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK(); + PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK(); nBarsUsed2 = PhysicalMemoryTotal ? ((PhysicalMemoryAvailable * 100) / PhysicalMemoryTotal) : 0; @@ -454,61 +454,61 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter) GraphCtrl_AppendPoint(&PerformancePageCpuUsageHistoryGraph, CpuUsage, CpuKernelUsage, 0.0, 0.0); GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph, nBarsUsed1, nBarsUsed2, 0.0, 0.0); /* PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ; */ - InvalidateRect(hPerformancePageMemUsageHistoryGraph, NULL, FALSE); - InvalidateRect(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE); - } - } + InvalidateRect(hPerformancePageMemUsageHistoryGraph, NULL, FALSE); + InvalidateRect(hPerformancePageCpuUsageHistoryGraph, NULL, FALSE); + } + } return 0; } void PerformancePage_OnViewShowKernelTimes(void) { - HMENU hMenu; - HMENU hViewMenu; + HMENU hMenu; + HMENU hViewMenu; - hMenu = GetMenu(hMainWnd); - hViewMenu = GetSubMenu(hMenu, 2); + hMenu = GetMenu(hMainWnd); + hViewMenu = GetSubMenu(hMenu, 2); - /* Check or uncheck the show 16-bit tasks menu item */ - if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & MF_CHECKED) - { - CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED); - TaskManagerSettings.ShowKernelTimes = FALSE; - } - else - { - CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED); - TaskManagerSettings.ShowKernelTimes = TRUE; - } + /* Check or uncheck the show 16-bit tasks menu item */ + if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & MF_CHECKED) + { + CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED); + TaskManagerSettings.ShowKernelTimes = FALSE; + } + else + { + CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED); + TaskManagerSettings.ShowKernelTimes = TRUE; + } - RefreshPerformancePage(); + RefreshPerformancePage(); } void PerformancePage_OnViewCPUHistoryOneGraphAll(void) { - HMENU hMenu; - HMENU hViewMenu; - HMENU hCPUHistoryMenu; + HMENU hMenu; + HMENU hViewMenu; + HMENU hCPUHistoryMenu; - hMenu = GetMenu(hMainWnd); - hViewMenu = GetSubMenu(hMenu, 2); - hCPUHistoryMenu = GetSubMenu(hViewMenu, 3); + hMenu = GetMenu(hMainWnd); + hViewMenu = GetSubMenu(hMenu, 2); + hCPUHistoryMenu = GetSubMenu(hViewMenu, 3); - TaskManagerSettings.CPUHistory_OneGraphPerCPU = FALSE; - CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND); + TaskManagerSettings.CPUHistory_OneGraphPerCPU = FALSE; + CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND); } void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void) { - HMENU hMenu; - HMENU hViewMenu; - HMENU hCPUHistoryMenu; + HMENU hMenu; + HMENU hViewMenu; + HMENU hCPUHistoryMenu; - hMenu = GetMenu(hMainWnd); - hViewMenu = GetSubMenu(hMenu, 2); - hCPUHistoryMenu = GetSubMenu(hViewMenu, 3); + hMenu = GetMenu(hMainWnd); + hViewMenu = GetSubMenu(hMenu, 2); + hCPUHistoryMenu = GetSubMenu(hViewMenu, 3); - TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE; - CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND); + TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE; + CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND); } diff --git a/reactos/base/applications/taskmgr/precomp.h b/reactos/base/applications/taskmgr/precomp.h index b35cfedcd5c..3a2b83008c5 100644 --- a/reactos/base/applications/taskmgr/precomp.h +++ b/reactos/base/applications/taskmgr/precomp.h @@ -1,6 +1,10 @@ #ifndef __PRECOMP_H #define __PRECOMP_H +#ifndef UNICODE +#error Task-Manager uses NDK functions, so it can only be compiled with Unicode support enabled! +#endif + #define WIN32_NO_STATUS #include #define NTOS_MODE_USER @@ -10,7 +14,6 @@ #include #include #include -#include #include #include diff --git a/reactos/base/applications/taskmgr/priority.c b/reactos/base/applications/taskmgr/priority.c index bdc3ecbae27..4c9d7f69b59 100644 --- a/reactos/base/applications/taskmgr/priority.c +++ b/reactos/base/applications/taskmgr/priority.c @@ -23,16 +23,16 @@ #include -TCHAR szTemp[256]; -TCHAR szTempA[256]; +WCHAR szTemp[256]; +WCHAR szTempA[256]; void ProcessPage_OnSetPriorityRealTime(void) { - LVITEM lvitem; - ULONG Index; - DWORD dwProcessId; - HANDLE hProcess; - TCHAR strErrorText[260]; + LVITEM lvitem; + ULONG Index; + DWORD dwProcessId; + HANDLE hProcess; + WCHAR strErrorText[260]; for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { @@ -80,11 +80,11 @@ void ProcessPage_OnSetPriorityRealTime(void) void ProcessPage_OnSetPriorityHigh(void) { - LVITEM lvitem; - ULONG Index; - DWORD dwProcessId; - HANDLE hProcess; - TCHAR strErrorText[260]; + LVITEM lvitem; + ULONG Index; + DWORD dwProcessId; + HANDLE hProcess; + WCHAR strErrorText[260]; for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { @@ -132,11 +132,11 @@ void ProcessPage_OnSetPriorityHigh(void) void ProcessPage_OnSetPriorityAboveNormal(void) { - LVITEM lvitem; - ULONG Index; - DWORD dwProcessId; - HANDLE hProcess; - TCHAR strErrorText[260]; + LVITEM lvitem; + ULONG Index; + DWORD dwProcessId; + HANDLE hProcess; + WCHAR strErrorText[260]; for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { @@ -184,11 +184,11 @@ void ProcessPage_OnSetPriorityAboveNormal(void) void ProcessPage_OnSetPriorityNormal(void) { - LVITEM lvitem; - ULONG Index; - DWORD dwProcessId; - HANDLE hProcess; - TCHAR strErrorText[260]; + LVITEM lvitem; + ULONG Index; + DWORD dwProcessId; + HANDLE hProcess; + WCHAR strErrorText[260]; for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { @@ -236,11 +236,11 @@ void ProcessPage_OnSetPriorityNormal(void) void ProcessPage_OnSetPriorityBelowNormal(void) { - LVITEM lvitem; - ULONG Index; - DWORD dwProcessId; - HANDLE hProcess; - TCHAR strErrorText[260]; + LVITEM lvitem; + ULONG Index; + DWORD dwProcessId; + HANDLE hProcess; + WCHAR strErrorText[260]; for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { @@ -288,11 +288,11 @@ void ProcessPage_OnSetPriorityBelowNormal(void) void ProcessPage_OnSetPriorityLow(void) { - LVITEM lvitem; - ULONG Index; - DWORD dwProcessId; - HANDLE hProcess; - TCHAR strErrorText[260]; + LVITEM lvitem; + ULONG Index; + DWORD dwProcessId; + HANDLE hProcess; + WCHAR strErrorText[260]; for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) { diff --git a/reactos/base/applications/taskmgr/proclist.c b/reactos/base/applications/taskmgr/proclist.c index f55f619f23e..4789ba69688 100644 --- a/reactos/base/applications/taskmgr/proclist.c +++ b/reactos/base/applications/taskmgr/proclist.c @@ -31,11 +31,11 @@ WNDPROC OldProcessListWndProc; INT_PTR CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - HBRUSH hbrBackground; + HBRUSH hbrBackground; RECT rcItem; RECT rcClip; - HDC hDC; - int DcSave; + HDC hDC; + int DcSave; switch (message) { @@ -72,13 +72,13 @@ ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) * subtract it from our clip rect because we don't * use icons in this list control. */ - rcClip.left = LVIR_BOUNDS; - SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcClip); - rcClip.left = LVIR_BOUNDS; - SendMessage(hWnd, LVM_GETITEMRECT, ListView_GetItemCount(hWnd) - 1, (LPARAM)&rcItem); - rcClip.bottom = rcItem.bottom; - rcClip.left = LVIR_ICON; - SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcItem); + rcClip.left = LVIR_BOUNDS; + SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcClip); + rcClip.left = LVIR_BOUNDS; + SendMessage(hWnd, LVM_GETITEMRECT, ListView_GetItemCount(hWnd) - 1, (LPARAM)&rcItem); + rcClip.bottom = rcItem.bottom; + rcClip.left = LVIR_ICON; + SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcItem); rcClip.left = rcItem.right; /* diff --git a/reactos/base/applications/taskmgr/procpage.c b/reactos/base/applications/taskmgr/procpage.c index 63e6626bdd2..520da12473d 100644 --- a/reactos/base/applications/taskmgr/procpage.c +++ b/reactos/base/applications/taskmgr/procpage.c @@ -29,10 +29,10 @@ HWND hProcessPageHeaderCtrl; /* Process Header Control */ HWND hProcessPageEndProcessButton; /* Process End Process button */ HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */ -static int nProcessPageWidth; -static int nProcessPageHeight; +static int nProcessPageWidth; +static int nProcessPageHeight; -static HANDLE hProcessPageEvent = NULL; /* When this event becomes signaled then we refresh the process list */ +static HANDLE hProcessPageEvent = NULL; /* When this event becomes signaled then we refresh the process list */ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam); void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount); @@ -42,11 +42,11 @@ DWORD WINAPI ProcessPageRefreshThread(void *lpParameter); INT_PTR CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - RECT rc; - int nXDifference; - int nYDifference; - int cx, cy; - HANDLE hRefreshThread = NULL; + RECT rc; + int nXDifference; + int nYDifference; + int cx, cy; + HANDLE hRefreshThread = NULL; switch (message) { case WM_INITDIALOG: @@ -72,7 +72,7 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) * Set the font, title, and extended window styles for the list control */ SendMessage(hProcessPageListCtrl, WM_SETFONT, SendMessage(hProcessPage, WM_GETFONT, 0, 0), TRUE); - SetWindowText(hProcessPageListCtrl, _T("Processes")); + SetWindowText(hProcessPageListCtrl, L"Processes"); (void)ListView_SetExtendedListViewStyle(hProcessPageListCtrl, ListView_GetExtendedListViewStyle(hProcessPageListCtrl) | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP); AddColumns(); @@ -151,16 +151,16 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam) { - int idctrl; - LPNMHDR pnmh; - LPNMLISTVIEW pnmv; - NMLVDISPINFO* pnmdi; - LPNMHEADER pnmhdr; - LVITEM lvitem; - ULONG Index; - ULONG ColumnIndex; - IO_COUNTERS iocounters; - LARGE_INTEGER time; + int idctrl; + LPNMHDR pnmh; + LPNMLISTVIEW pnmv; + NMLVDISPINFO* pnmdi; + LPNMHEADER pnmhdr; + LVITEM lvitem; + ULONG Index; + ULONG ColumnIndex; + IO_COUNTERS iocounters; + LARGE_INTEGER time; idctrl = (int) wParam; pnmh = (LPNMHDR) lParam; @@ -189,13 +189,13 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam) if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME) PerfDataGetImageName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax); if (ColumnDataHints[ColumnIndex] == COLUMN_PID) - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetProcessId(Index)); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetProcessId(Index)); if (ColumnDataHints[ColumnIndex] == COLUMN_USERNAME) PerfDataGetUserName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax); if (ColumnDataHints[ColumnIndex] == COLUMN_SESSIONID) - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetSessionId(Index)); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetSessionId(Index)); if (ColumnDataHints[ColumnIndex] == COLUMN_CPUUSAGE) - wsprintf(pnmdi->item.pszText, _T("%02d"), PerfDataGetCPUUsage(Index)); + wsprintf(pnmdi->item.pszText, L"%02d", PerfDataGetCPUUsage(Index)); if (ColumnDataHints[ColumnIndex] == COLUMN_CPUTIME) { DWORD dwHours; @@ -212,120 +212,116 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam) dwMinutes = (DWORD)((time.QuadPart % 36000000000LL) / 600000000LL); dwSeconds = (DWORD)(((time.QuadPart % 36000000000LL) % 600000000LL) / 10000000LL); #endif - wsprintf(pnmdi->item.pszText, _T("%d:%02d:%02d"), dwHours, dwMinutes, dwSeconds); + wsprintf(pnmdi->item.pszText, L"%d:%02d:%02d", dwHours, dwMinutes, dwSeconds); } if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGE) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetWorkingSetSizeBytes(Index) / 1024); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetWorkingSetSizeBytes(Index) / 1024); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); - _tcscat(pnmdi->item.pszText, _T(" K")); + wcscat(pnmdi->item.pszText, L" K"); } if (ColumnDataHints[ColumnIndex] == COLUMN_PEAKMEMORYUSAGE) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); - _tcscat(pnmdi->item.pszText, _T(" K")); + wcscat(pnmdi->item.pszText, L" K"); } if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGEDELTA) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetWorkingSetSizeDelta(Index) / 1024); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetWorkingSetSizeDelta(Index) / 1024); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); - _tcscat(pnmdi->item.pszText, _T(" K")); + wcscat(pnmdi->item.pszText, L" K"); } if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTS) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPageFaultCount(Index)); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetPageFaultCount(Index)); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTSDELTA) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPageFaultCountDelta(Index)); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetPageFaultCountDelta(Index)); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_VIRTUALMEMORYSIZE) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetVirtualMemorySizeBytes(Index) / 1024); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetVirtualMemorySizeBytes(Index) / 1024); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); - _tcscat(pnmdi->item.pszText, _T(" K")); + wcscat(pnmdi->item.pszText, L" K"); } if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEDPOOL) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPagedPoolUsagePages(Index) / 1024); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetPagedPoolUsagePages(Index) / 1024); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); - _tcscat(pnmdi->item.pszText, _T(" K")); + wcscat(pnmdi->item.pszText, L" K"); } if (ColumnDataHints[ColumnIndex] == COLUMN_NONPAGEDPOOL) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetNonPagedPoolUsagePages(Index) / 1024); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetNonPagedPoolUsagePages(Index) / 1024); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); - _tcscat(pnmdi->item.pszText, _T(" K")); + wcscat(pnmdi->item.pszText, L" K"); } if (ColumnDataHints[ColumnIndex] == COLUMN_BASEPRIORITY) - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetBasePriority(Index)); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetBasePriority(Index)); if (ColumnDataHints[ColumnIndex] == COLUMN_HANDLECOUNT) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetHandleCount(Index)); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetHandleCount(Index)); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_THREADCOUNT) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetThreadCount(Index)); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetThreadCount(Index)); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_USEROBJECTS) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetUSERObjectCount(Index)); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetUSERObjectCount(Index)); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_GDIOBJECTS) { - wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetGDIObjectCount(Index)); + wsprintf(pnmdi->item.pszText, L"%d", PerfDataGetGDIObjectCount(Index)); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS) { PerfDataGetIOCounters(Index, &iocounters); - /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadOperationCount); */ -#ifdef UNICODE -#define _ui64toa _ui64tow -#else -#endif - _ui64toa(iocounters.ReadOperationCount, pnmdi->item.pszText, 10); + /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.ReadOperationCount); */ + _ui64tow(iocounters.ReadOperationCount, pnmdi->item.pszText, 10); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES) { PerfDataGetIOCounters(Index, &iocounters); - /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteOperationCount); */ - _ui64toa(iocounters.WriteOperationCount, pnmdi->item.pszText, 10); + /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.WriteOperationCount); */ + _ui64tow(iocounters.WriteOperationCount, pnmdi->item.pszText, 10); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER) { PerfDataGetIOCounters(Index, &iocounters); - /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherOperationCount); */ - _ui64toa(iocounters.OtherOperationCount, pnmdi->item.pszText, 10); + /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.OtherOperationCount); */ + _ui64tow(iocounters.OtherOperationCount, pnmdi->item.pszText, 10); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES) { PerfDataGetIOCounters(Index, &iocounters); - /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadTransferCount); */ - _ui64toa(iocounters.ReadTransferCount, pnmdi->item.pszText, 10); + /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.ReadTransferCount); */ + _ui64tow(iocounters.ReadTransferCount, pnmdi->item.pszText, 10); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES) { PerfDataGetIOCounters(Index, &iocounters); - /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteTransferCount); */ - _ui64toa(iocounters.WriteTransferCount, pnmdi->item.pszText, 10); + /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.WriteTransferCount); */ + _ui64tow(iocounters.WriteTransferCount, pnmdi->item.pszText, 10); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES) { PerfDataGetIOCounters(Index, &iocounters); - /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherTransferCount); */ - _ui64toa(iocounters.OtherTransferCount, pnmdi->item.pszText, 10); + /* wsprintf(pnmdi->item.pszText, L"%d", iocounters.OtherTransferCount); */ + _ui64tow(iocounters.OtherTransferCount, pnmdi->item.pszText, 10); CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax); } @@ -391,18 +387,18 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam) void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount) { - TCHAR temp[260]; - UINT i, j, k; + WCHAR temp[260]; + UINT i, j, k; - for (i=0,j=0; i<(_tcslen(strNumber) % 3); i++, j++) + for (i=0,j=0; i<(wcslen(strNumber) % 3); i++, j++) temp[j] = strNumber[i]; - for (k=0; i<_tcslen(strNumber); i++,j++,k++) { + for (k=0; i 0)) - temp[j++] = _T(','); + temp[j++] = L','; temp[j] = strNumber[i]; } - temp[j] = _T('\0'); - _tcsncpy(strNumber, temp, nMaxCount); + temp[j] = L'\0'; + wcsncpy(strNumber, temp, nMaxCount); } void ProcessPageShowContextMenu(DWORD dwProcessId) @@ -411,13 +407,13 @@ void ProcessPageShowContextMenu(DWORD dwProcessId) HMENU hSubMenu; HMENU hPriorityMenu; POINT pt; - SYSTEM_INFO si; - HANDLE hProcess; + SYSTEM_INFO si; + HANDLE hProcess; DWORD dwProcessPriorityClass; - TCHAR strDebugger[260]; + WCHAR strDebugger[260]; DWORD dwDebuggerSize; - HKEY hKey; - UINT Idx; + HKEY hKey; + UINT Idx; memset(&si, 0, sizeof(SYSTEM_INFO)); @@ -459,15 +455,15 @@ void ProcessPageShowContextMenu(DWORD dwProcessId) break; } - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug"), 0, KEY_READ, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { dwDebuggerSize = 260; - if (RegQueryValueEx(hKey, _T("Debugger"), NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS) + if (RegQueryValueEx(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS) { - for (Idx=0; Idx<_tcslen(strDebugger); Idx++) + for (Idx=0; Idx - + . 0x0501 0x0501 - - msvcrt ntdll kernel32 diff --git a/reactos/base/applications/taskmgr/trayicon.c b/reactos/base/applications/taskmgr/trayicon.c index 5f260d73630..87abe591aad 100644 --- a/reactos/base/applications/taskmgr/trayicon.c +++ b/reactos/base/applications/taskmgr/trayicon.c @@ -25,17 +25,17 @@ HICON TrayIcon_GetProcessorUsageIcon(void) { - HICON hTrayIcon = NULL; - HDC hScreenDC = NULL; - HDC hDC = NULL; - HBITMAP hBitmap = NULL; - HBITMAP hOldBitmap = NULL; - HBITMAP hBitmapMask = NULL; - ICONINFO iconInfo; - ULONG ProcessorUsage; - int nLinesToDraw; - HBRUSH hBitmapBrush = NULL; - RECT rc; + HICON hTrayIcon = NULL; + HDC hScreenDC = NULL; + HDC hDC = NULL; + HBITMAP hBitmap = NULL; + HBITMAP hOldBitmap = NULL; + HBITMAP hBitmapMask = NULL; + ICONINFO iconInfo; + ULONG ProcessorUsage; + int nLinesToDraw; + HBRUSH hBitmapBrush = NULL; + RECT rc; /* * Get a handle to the screen DC @@ -132,10 +132,10 @@ done: BOOL TrayIcon_ShellAddTrayIcon(void) { - NOTIFYICONDATA nid; - HICON hIcon = NULL; + NOTIFYICONDATA nid; + HICON hIcon = NULL; BOOL bRetVal; - TCHAR szMsg[256]; + WCHAR szMsg[256]; memset(&nid, 0, sizeof(NOTIFYICONDATA)); @@ -162,7 +162,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void) BOOL TrayIcon_ShellRemoveTrayIcon(void) { - NOTIFYICONDATA nid; + NOTIFYICONDATA nid; BOOL bRetVal; memset(&nid, 0, sizeof(NOTIFYICONDATA)); @@ -183,7 +183,7 @@ BOOL TrayIcon_ShellUpdateTrayIcon(void) NOTIFYICONDATA nid; HICON hIcon = NULL; BOOL bRetVal; - TCHAR szTemp[256]; + WCHAR szTemp[256]; memset(&nid, 0, sizeof(NOTIFYICONDATA));