https://git.reactos.org/?p=reactos.git;a=commitdiff;h=46b4b5581d1fc4c1b50cf…
commit 46b4b5581d1fc4c1b50cfc0ee8b82b77be182dc6
Author: Joachim Henze <joachim.henze(a)reactos.org>
AuthorDate: Tue Oct 3 21:00:10 2023 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Oct 3 21:00:10 2023 +0200
[TASKMGR] Favor _countof(), no functional change intended (#5757)
Taskmgr used a mixture: Sometimes _countof(), sometimes ARRAYSIZE()
and sometimes it calculated the count plain by sizeof(var)/sizeof(TYPE).
Harmonize everywhere to _countof() as it is the shortest solution.
Fix some formatting sins, like placing comments before else-statement.
Shorten the length of some very long line
intentionally *without introducing additional linebreaks* !
Shorten vertical length of some functions to increase their chance to
fit on the screen without scrolling.
Fix wrong indentation level in TaskManagerWndProc().
*.rc: Remove superfluous and redundant comment in all langs
No functional change intended.
---
base/applications/taskmgr/about.c | 2 +-
base/applications/taskmgr/applpage.c | 74 ++++++---------------------------
base/applications/taskmgr/applpage.h | 13 +++---
base/applications/taskmgr/column.c | 16 ++++---
base/applications/taskmgr/column.h | 2 +-
base/applications/taskmgr/debug.c | 26 ++++++------
base/applications/taskmgr/graph.c | 28 +++++--------
base/applications/taskmgr/graph.h | 14 +++----
base/applications/taskmgr/lang/bg-BG.rc | 1 -
base/applications/taskmgr/lang/cs-CZ.rc | 1 -
base/applications/taskmgr/lang/da-DK.rc | 1 -
base/applications/taskmgr/lang/de-DE.rc | 1 -
base/applications/taskmgr/lang/el-GR.rc | 1 -
base/applications/taskmgr/lang/en-US.rc | 1 -
base/applications/taskmgr/lang/es-ES.rc | 1 -
base/applications/taskmgr/lang/et-EE.rc | 1 -
base/applications/taskmgr/lang/fr-FR.rc | 1 -
base/applications/taskmgr/lang/he-IL.rc | 1 -
base/applications/taskmgr/lang/hu-HU.rc | 1 -
base/applications/taskmgr/lang/id-ID.rc | 1 -
base/applications/taskmgr/lang/it-IT.rc | 1 -
base/applications/taskmgr/lang/ja-JP.rc | 1 -
base/applications/taskmgr/lang/ko-KR.rc | 1 -
base/applications/taskmgr/lang/nl-NL.rc | 1 -
base/applications/taskmgr/lang/no-NO.rc | 1 -
base/applications/taskmgr/lang/pl-PL.rc | 1 -
base/applications/taskmgr/lang/pt-BR.rc | 1 -
base/applications/taskmgr/lang/pt-PT.rc | 1 -
base/applications/taskmgr/lang/ro-RO.rc | 1 -
base/applications/taskmgr/lang/ru-RU.rc | 1 -
base/applications/taskmgr/lang/sk-SK.rc | 1 -
base/applications/taskmgr/lang/sq-AL.rc | 1 -
base/applications/taskmgr/lang/sv-SE.rc | 1 -
base/applications/taskmgr/lang/tr-TR.rc | 1 -
base/applications/taskmgr/lang/uk-UA.rc | 1 -
base/applications/taskmgr/lang/zh-CN.rc | 1 -
base/applications/taskmgr/lang/zh-HK.rc | 1 -
base/applications/taskmgr/lang/zh-TW.rc | 1 -
base/applications/taskmgr/perfdata.c | 10 ++---
base/applications/taskmgr/perfpage.c | 12 +++---
base/applications/taskmgr/procpage.c | 14 +++----
base/applications/taskmgr/run.c | 6 +--
base/applications/taskmgr/taskmgr.c | 38 ++++++-----------
43 files changed, 91 insertions(+), 194 deletions(-)
diff --git a/base/applications/taskmgr/about.c b/base/applications/taskmgr/about.c
index f97f6588550..46bc60e4d76 100644
--- a/base/applications/taskmgr/about.c
+++ b/base/applications/taskmgr/about.c
@@ -11,7 +11,7 @@ void OnAbout(void)
{
WCHAR szTaskmgr[128];
- LoadStringW(hInst, IDS_APP_TITLE, szTaskmgr, sizeof(szTaskmgr)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_APP_TITLE, szTaskmgr, _countof(szTaskmgr));
ShellAboutW(hMainWnd, szTaskmgr, NULL,
LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER)));
}
diff --git a/base/applications/taskmgr/applpage.c b/base/applications/taskmgr/applpage.c
index 7db38c09c90..600592c10f8 100644
--- a/base/applications/taskmgr/applpage.c
+++ b/base/applications/taskmgr/applpage.c
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Task Manager
* LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
- * PURPOSE: Applications Page.
+ * PURPOSE: Applications Page
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp(a)reactos.org>
* Copyright 2005 Klemens Friedl <frik85(a)reactos.at>
* Copyright 2021 Katayama Hirofumi MZ
<katayama.hirofumi.mz(a)gmail.com>
@@ -97,7 +97,6 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
switch (message) {
case WM_INITDIALOG:
-
/* Save the width and height */
GetClientRect(hDlg, &rc);
nApplicationPageWidth = rc.right;
@@ -151,7 +150,6 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
break;
case WM_COMMAND:
-
/* Handle the button clicks */
switch (LOWORD(wParam))
{
@@ -217,17 +215,16 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam,
LPARAM lParam)
if (wParam == VK_DELETE)
ProcessPage_OnEndProcess();
break;
-
}
- return 0;
+ return 0;
}
void RefreshApplicationPage(void)
{
#ifdef RUN_APPS_PAGE
- /* Signal the event so that our refresh thread */
- /* will wake up and refresh the application page */
+ /* Signal the event so that our refresh thread
+ * will wake up and refresh the application page */
PostThreadMessage(dwApplicationThread, WM_TIMER, 0, 0);
#endif
}
@@ -267,11 +264,7 @@ DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter)
if (msg.message == WM_TIMER)
{
- /*
- * FIXME:
- *
- * Should this be EnumDesktopWindows() instead?
- */
+ // FIXME: Should this be EnumDesktopWindows() instead?
noApps = TRUE;
EnumWindows(EnumWindowsProc, 0);
if (noApps)
@@ -450,9 +443,8 @@ void AddOrUpdateHwnd(HWND hWnd, WCHAR *szTitle, HICON hIcon, BOOL
bHung)
InvalidateRect(hApplicationPageListCtrl, NULL, 0);
}
}
- /* It is not already in the list so add it */
else
- {
+ { // It is not already in the list so add it
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)HeapAlloc(GetProcessHeap(), 0,
sizeof(APPLICATION_PAGE_LIST_ITEM));
pAPLI->hWnd = hWnd;
@@ -478,25 +470,16 @@ void AddOrUpdateHwnd(HWND hWnd, WCHAR *szTitle, HICON hIcon, BOOL
bHung)
ListView_SetItemState(hApplicationPageListCtrl, 0, LVIS_FOCUSED | LVIS_SELECTED,
LVIS_FOCUSED | LVIS_SELECTED);
bApplicationPageSelectionMade = TRUE;
}
- /*
- else
- {
- bApplicationPageSelectionMade = FALSE;
- }
- */
}
void ApplicationPageUpdate(void)
{
/* Enable or disable the "End Task" & "Switch To" buttons
*/
if (ListView_GetSelectedCount(hApplicationPageListCtrl))
- {
EnableWindow(hApplicationPageEndTaskButton, TRUE);
- }
else
- {
EnableWindow(hApplicationPageEndTaskButton, FALSE);
- }
+
/* Enable "Switch To" button only if only one app is selected */
EnableWindow(hApplicationPageSwitchToButton,
(ListView_GetSelectedCount(hApplicationPageListCtrl) == 1));
@@ -510,9 +493,8 @@ void ApplicationPageUpdate(void)
hMenu = GetMenu(hMainWnd);
hWindowsMenu = GetSubMenu(hMenu, 3);
- /* Only one item selected */
if (ListView_GetSelectedCount(hApplicationPageListCtrl) == 1)
- {
+ { // Only one item selected
EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEHORIZONTALLY,
MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEVERTICALLY,
MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
EnableMenuItem(hWindowsMenu, ID_WINDOWS_MINIMIZE, MF_BYCOMMAND|MF_ENABLED);
@@ -520,9 +502,8 @@ void ApplicationPageUpdate(void)
EnableMenuItem(hWindowsMenu, ID_WINDOWS_CASCADE,
MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
EnableMenuItem(hWindowsMenu, ID_WINDOWS_BRINGTOFRONT,
MF_BYCOMMAND|MF_ENABLED);
}
- /* More than one item selected */
else if (ListView_GetSelectedCount(hApplicationPageListCtrl) > 1)
- {
+ { // More than one item selected
EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEHORIZONTALLY,
MF_BYCOMMAND|MF_ENABLED);
EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEVERTICALLY,
MF_BYCOMMAND|MF_ENABLED);
EnableMenuItem(hWindowsMenu, ID_WINDOWS_MINIMIZE, MF_BYCOMMAND|MF_ENABLED);
@@ -530,9 +511,8 @@ void ApplicationPageUpdate(void)
EnableMenuItem(hWindowsMenu, ID_WINDOWS_CASCADE, MF_BYCOMMAND|MF_ENABLED);
EnableMenuItem(hWindowsMenu, ID_WINDOWS_BRINGTOFRONT,
MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
}
- /* No items selected */
else
- {
+ { // No items selected
EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEHORIZONTALLY,
MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEVERTICALLY,
MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
EnableMenuItem(hWindowsMenu, ID_WINDOWS_MINIMIZE,
MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
@@ -564,52 +544,35 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
/* Update the item text */
if (pnmdi->item.iSubItem == 0)
- {
wcsncpy(pnmdi->item.pszText, pAPLI->szTitle,
pnmdi->item.cchTextMax);
- }
/* Update the item status */
else if (pnmdi->item.iSubItem == 1)
{
if (pAPLI->bHung)
- {
- LoadStringW( GetModuleHandleW(NULL), IDS_NOT_RESPONDING , szMsg,
sizeof(szMsg) / sizeof(szMsg[0]));
- }
+ LoadStringW(GetModuleHandleW(NULL), IDS_NOT_RESPONDING , szMsg,
_countof(szMsg));
else
- {
- LoadStringW( GetModuleHandleW(NULL), IDS_RUNNING, (LPWSTR) szMsg,
sizeof(szMsg) / sizeof(szMsg[0]));
- }
+ LoadStringW(GetModuleHandleW(NULL), IDS_RUNNING, (LPWSTR) szMsg,
_countof(szMsg));
wcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
}
break;
case NM_RCLICK:
-
if (ListView_GetSelectedCount(hApplicationPageListCtrl) < 1)
- {
ApplicationPageShowContextMenu1();
- }
else
- {
ApplicationPageShowContextMenu2();
- }
-
break;
case NM_DBLCLK:
-
ApplicationPage_OnSwitchTo();
-
break;
case LVN_KEYDOWN:
-
if (((LPNMLVKEYDOWN)lParam)->wVKey == VK_DELETE)
ApplicationPage_OnEndTask();
-
break;
-
}
}
else if (pnmh->hwndFrom == ListView_GetHeader(hApplicationPageListCtrl))
@@ -617,27 +580,18 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
switch (pnmh->code)
{
case NM_RCLICK:
-
if (ListView_GetSelectedCount(hApplicationPageListCtrl) < 1)
- {
ApplicationPageShowContextMenu1();
- }
else
- {
ApplicationPageShowContextMenu2();
- }
-
break;
case HDN_ITEMCLICK:
-
(void)ListView_SortItems(hApplicationPageListCtrl,
ApplicationPageCompareFunc, 0);
bSortAscending = !bSortAscending;
-
break;
}
}
-
}
void ApplicationPageShowContextMenu1(void)
@@ -929,9 +883,7 @@ void ApplicationPage_OnGotoProcess(void)
i,
LVIS_SELECTED | LVIS_FOCUSED,
LVIS_SELECTED | LVIS_FOCUSED);
- (void)ListView_EnsureVisible(hProcessPageListCtrl,
- i,
- FALSE);
+ (void)ListView_EnsureVisible(hProcessPageListCtrl, i, FALSE);
}
}
}
diff --git a/base/applications/taskmgr/applpage.h b/base/applications/taskmgr/applpage.h
index e6bf69c21a1..04a57ffb0c5 100644
--- a/base/applications/taskmgr/applpage.h
+++ b/base/applications/taskmgr/applpage.h
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Task Manager
* LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
- * PURPOSE: Applications Page.
+ * PURPOSE: Applications Page
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp(a)reactos.org>
* Copyright 2005 Klemens Friedl <frik85(a)reactos.at>
* Copyright 2021 Katayama Hirofumi MZ
<katayama.hirofumi.mz(a)gmail.com>
@@ -9,12 +9,11 @@
#pragma once
-extern HWND hApplicationPage; /* Application List Property Page
*/
-
-extern HWND hApplicationPageListCtrl; /* Application ListCtrl Window
*/
-extern HWND hApplicationPageEndTaskButton; /* Application End Task button
*/
-extern HWND hApplicationPageSwitchToButton; /* Application Switch To button
*/
-extern HWND hApplicationPageNewTaskButton; /* Application New Task button
*/
+extern HWND hApplicationPage; /* Application List Property Page */
+extern HWND hApplicationPageListCtrl; /* Application ListCtrl Window */
+extern HWND hApplicationPageEndTaskButton; /* Application End Task button */
+extern HWND hApplicationPageSwitchToButton; /* Application Switch To button */
+extern HWND hApplicationPageNewTaskButton; /* Application New Task button */
INT_PTR CALLBACK ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam);
void RefreshApplicationPage(void);
diff --git a/base/applications/taskmgr/column.c b/base/applications/taskmgr/column.c
index 089e4044854..b6eec0f5ec8 100644
--- a/base/applications/taskmgr/column.c
+++ b/base/applications/taskmgr/column.c
@@ -42,8 +42,8 @@ const PresetColumnEntry ColumnPresets[COLUMN_NMAX] = {
DECLARE_COLUMN_PRESET(COMMANDLINE, 450, FALSE)
};
-static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int
nWidth, int nSubItem);
-INT_PTR CALLBACK ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam);
+static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int
nWidth, int nSubItem);
+INT_PTR CALLBACK ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam);
void AddColumns(void)
{
@@ -53,13 +53,13 @@ void AddColumns(void)
for (n=0; n<COLUMN_NMAX; n++) {
if (TaskManagerSettings.Columns[n]) {
- LoadStringW(hInst, ColumnPresets[n].dwIdsName, szTemp,
sizeof(szTemp)/sizeof(WCHAR));
+ LoadStringW(hInst, ColumnPresets[n].dwIdsName, szTemp, _countof(szTemp));
InsertColumn(n, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[n],
-1);
}
}
size = SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0);
- SendMessageW(hProcessPageHeaderCtrl, HDM_SETORDERARRAY, (WPARAM) size, (LPARAM)
&TaskManagerSettings.ColumnOrderArray);
+ SendMessageW(hProcessPageHeaderCtrl, HDM_SETORDERARRAY, (WPARAM)size,
(LPARAM)&TaskManagerSettings.ColumnOrderArray);
UpdateColumnDataHints();
}
@@ -104,7 +104,7 @@ void SaveColumnSettings(void)
/* Get header order */
size = SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0);
- SendMessageW(hProcessPageHeaderCtrl, HDM_GETORDERARRAY, (WPARAM) size, (LPARAM)
&TaskManagerSettings.ColumnOrderArray);
+ SendMessageW(hProcessPageHeaderCtrl, HDM_GETORDERARRAY, (WPARAM)size,
(LPARAM)&TaskManagerSettings.ColumnOrderArray);
/* Get visible columns */
for (i = 0; i < SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0); i++)
{
@@ -117,7 +117,7 @@ void SaveColumnSettings(void)
SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEM, i, (LPARAM) &hditem);
for (n = 0; n < COLUMN_NMAX; n++) {
- LoadStringW(hInst, ColumnPresets[n].dwIdsName, szTemp,
sizeof(szTemp)/sizeof(WCHAR));
+ LoadStringW(hInst, ColumnPresets[n].dwIdsName, szTemp, _countof(szTemp));
if (_wcsicmp(text, szTemp) == 0)
{
TaskManagerSettings.Columns[n] = TRUE;
@@ -155,7 +155,6 @@ ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
switch (message)
{
case WM_INITDIALOG:
-
for (i=0; i<COLUMN_NMAX; i++) {
if (TaskManagerSettings.Columns[i])
CheckDlgButton(hDlg, ColumnPresets[i].dwIdcCtrl, BST_CHECKED);
@@ -163,7 +162,6 @@ ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
return TRUE;
case WM_COMMAND:
-
if (LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
@@ -207,7 +205,7 @@ void UpdateColumnDataHints(void)
SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEM, Index, (LPARAM) &hditem);
for (i=0; i<COLUMN_NMAX; i++) {
- LoadStringW(hInst, ColumnPresets[i].dwIdsName, szTemp,
sizeof(szTemp)/sizeof(WCHAR));
+ LoadStringW(hInst, ColumnPresets[i].dwIdsName, szTemp, _countof(szTemp));
if (_wcsicmp(text, szTemp) == 0)
ColumnDataHints[Index] = i;
}
diff --git a/base/applications/taskmgr/column.h b/base/applications/taskmgr/column.h
index 615067104ad..4ccdf36d593 100644
--- a/base/applications/taskmgr/column.h
+++ b/base/applications/taskmgr/column.h
@@ -63,7 +63,7 @@ typedef struct {
} PresetColumnEntry;
-extern UINT ColumnDataHints[COLUMN_NMAX];
+extern UINT ColumnDataHints[COLUMN_NMAX];
extern const PresetColumnEntry ColumnPresets[COLUMN_NMAX];
#define Column_ImageName Columns[COLUMN_IMAGENAME]
diff --git a/base/applications/taskmgr/debug.c b/base/applications/taskmgr/debug.c
index 7e3e11f283e..678597a350c 100644
--- a/base/applications/taskmgr/debug.c
+++ b/base/applications/taskmgr/debug.c
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Task Manager
* LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
- * PURPOSE: Process Debugging.
+ * PURPOSE: Process Debugging
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp(a)reactos.org>
* Copyright 2005 Klemens Friedl <frik85(a)reactos.at>
*/
@@ -27,21 +27,21 @@ void ProcessPage_OnDebug(void)
if (dwProcessId == 0)
return;
- LoadStringW(hInst, IDS_MSG_WARNINGDEBUG, szTemp, ARRAYSIZE(szTemp));
- LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTempA, ARRAYSIZE(szTempA));
+ LoadStringW(hInst, IDS_MSG_WARNINGDEBUG, szTemp, _countof(szTemp));
+ LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTempA, _countof(szTempA));
if (MessageBoxW(hMainWnd, szTemp, szTempA, MB_YESNO | MB_ICONWARNING) != IDYES)
{
- GetLastErrorText(strErrorText, ARRAYSIZE(strErrorText));
- LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, ARRAYSIZE(szTemp));
+ GetLastErrorText(strErrorText, _countof(strErrorText));
+ LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, _countof(szTemp));
MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK | MB_ICONSTOP);
return;
}
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows
NT\\CurrentVersion\\AeDebug", 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
{
- GetLastErrorText(strErrorText, ARRAYSIZE(strErrorText));
- LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, ARRAYSIZE(szTemp));
+ GetLastErrorText(strErrorText, _countof(strErrorText));
+ LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, _countof(szTemp));
MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK | MB_ICONSTOP);
return;
}
@@ -49,8 +49,8 @@ void ProcessPage_OnDebug(void)
dwDebuggerSize = sizeof(strDebugger);
if (RegQueryValueExW(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger,
&dwDebuggerSize) != ERROR_SUCCESS)
{
- GetLastErrorText(strErrorText, ARRAYSIZE(strErrorText));
- LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, ARRAYSIZE(szTemp));
+ GetLastErrorText(strErrorText, _countof(strErrorText));
+ LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, _countof(szTemp));
MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK | MB_ICONSTOP);
RegCloseKey(hKey);
return;
@@ -61,8 +61,8 @@ void ProcessPage_OnDebug(void)
hDebugEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (!hDebugEvent)
{
- GetLastErrorText(strErrorText, ARRAYSIZE(strErrorText));
- LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, ARRAYSIZE(szTemp));
+ GetLastErrorText(strErrorText, _countof(strErrorText));
+ LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, _countof(szTemp));
MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK | MB_ICONSTOP);
return;
}
@@ -74,8 +74,8 @@ void ProcessPage_OnDebug(void)
si.cb = sizeof(si);
if (!CreateProcessW(NULL, strDebugPath, NULL, NULL, FALSE, 0, NULL, NULL, &si,
&pi))
{
- GetLastErrorText(strErrorText, ARRAYSIZE(strErrorText));
- LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, ARRAYSIZE(szTemp));
+ GetLastErrorText(strErrorText, _countof(strErrorText));
+ LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, _countof(szTemp));
MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK | MB_ICONSTOP);
}
else
diff --git a/base/applications/taskmgr/graph.c b/base/applications/taskmgr/graph.c
index aea347c47b6..f431bce46c9 100644
--- a/base/applications/taskmgr/graph.c
+++ b/base/applications/taskmgr/graph.c
@@ -28,7 +28,7 @@ Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
/*
- * Filter out mouse & keyboard messages
+ * Filter out mouse & keyboard messages
*/
/* case WM_APPCOMMAND: */
case WM_CAPTURECHANGED:
@@ -84,7 +84,6 @@ Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return 0;
case WM_PAINT:
-
hdc = BeginPaint(hWnd, &ps);
WindowId = GetWindowLongPtrW(hWnd, GWLP_ID);
@@ -103,13 +102,11 @@ Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
}
EndPaint(hWnd, &ps);
-
return 0;
-
}
/*
- * We pass on all non-handled messages
+ * Pass on all non-handled messages
*/
return CallWindowProcW(OldGraphWndProc, hWnd, message, wParam, lParam);
}
@@ -163,8 +160,7 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
SetTextColor(hDC, crPrevForeground);
/*
- * Now we have to draw the graph
- * So first find out how many bars we can fit
+ * Draw the graph. So first find out how many bars we can fit
*/
nBars = ((rcClient.bottom - rcClient.top) - 25) / 3;
nBarsUsed = (nBars * CpuUsage) / 100;
@@ -185,7 +181,7 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
}
/*
- * Now draw the bar graph
+ * Draw the bar graph
*/
rcBarLeft.left = ((rcClient.right - rcClient.left) - 33) / 2;
rcBarLeft.right = rcBarLeft.left + 16;
@@ -266,7 +262,6 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
for (i=0; i<nBarsUsedKernel; i++)
{
-
FillSolidRect(hDC, &rcBarLeft, RED);
FillSolidRect(hDC, &rcBarRight, RED);
@@ -275,7 +270,6 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
rcBarRight.top -=3;
rcBarRight.bottom -=3;
-
}
SelectObject(hDC, hOldFont);
@@ -331,8 +325,7 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
SetTextColor(hDC, crPrevForeground);
/*
- * Now we have to draw the graph
- * So first find out how many bars we can fit
+ * Draw the graph. So first find out how many bars we can fit
*/
nBars = ((rcClient.bottom - rcClient.top) - 25) / 3;
if (CommitChargeLimit)
@@ -346,7 +339,7 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
if (nBarsFree > nBars) nBarsFree = nBars;
/*
- * Now draw the bar graph
+ * Draw the bar graph
*/
rcBarLeft.left = ((rcClient.right - rcClient.left) - 33) / 2;
rcBarLeft.right = rcBarLeft.left + 16;
@@ -414,17 +407,16 @@ void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd)
//CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
/*
- * Draw the graph background
- *
- * Draw the horizontal bars
+ * Draw the graph background and horizontal bars
*/
for (i=0; i<rcClient.bottom; i++)
{
if ((i % 11) == 0)
{
- /* FillSolidRect2(hDC, 0, i, rcClient.right, 1, DARK_GREEN); */
+ //FillSolidRect2(hDC, 0, i, rcClient.right, 1, DARK_GREEN);
}
}
+
/*
* Draw the vertical bars
*/
@@ -432,7 +424,7 @@ void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd)
{
if ((i % 11) == 0)
{
- /* FillSolidRect2(hDC, i - offset, 0, 1, rcClient.bottom, DARK_GREEN); */
+ //FillSolidRect2(hDC, i - offset, 0, 1, rcClient.bottom, DARK_GREEN);
}
}
diff --git a/base/applications/taskmgr/graph.h b/base/applications/taskmgr/graph.h
index 27682b41c05..d2ada309b01 100644
--- a/base/applications/taskmgr/graph.h
+++ b/base/applications/taskmgr/graph.h
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Task Manager
* LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
- * PURPOSE: Performance Graph Meters.
+ * PURPOSE: Performance Graph Meters
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp(a)reactos.org>
*/
@@ -12,14 +12,14 @@ extern "C" {
#endif
-#define BRIGHT_GREEN RGB(0, 255, 0)
-#define MEDIUM_GREEN RGB(0, 190, 0)
-#define DARK_GREEN RGB(0, 130, 0)
-#define RED RGB(255, 0, 0)
+#define BRIGHT_GREEN RGB(0, 255, 0)
+#define MEDIUM_GREEN RGB(0, 190, 0)
+#define DARK_GREEN RGB(0, 130, 0)
+#define RED RGB(255, 0, 0)
-extern WNDPROC OldGraphWndProc;
+extern WNDPROC OldGraphWndProc;
-INT_PTR CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
#ifdef __cplusplus
diff --git a/base/applications/taskmgr/lang/bg-BG.rc
b/base/applications/taskmgr/lang/bg-BG.rc
index 7f523d3833c..e8505c05b0e 100644
--- a/base/applications/taskmgr/lang/bg-BG.rc
+++ b/base/applications/taskmgr/lang/bg-BG.rc
@@ -177,7 +177,6 @@ BEGIN
PUSHBUTTON "&Прекратяване на задачата", IDC_ENDPROCESS, 144, 203, 100,
14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/cs-CZ.rc
b/base/applications/taskmgr/lang/cs-CZ.rc
index 423155a957b..f15c3b3b7f5 100644
--- a/base/applications/taskmgr/lang/cs-CZ.rc
+++ b/base/applications/taskmgr/lang/cs-CZ.rc
@@ -177,7 +177,6 @@ BEGIN
PUSHBUTTON "&Ukončit proces", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/da-DK.rc
b/base/applications/taskmgr/lang/da-DK.rc
index 27ea5d0f36c..42162b6c048 100644
--- a/base/applications/taskmgr/lang/da-DK.rc
+++ b/base/applications/taskmgr/lang/da-DK.rc
@@ -177,7 +177,6 @@ BEGIN
PUSHBUTTON "&Afslut Proces", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/de-DE.rc
b/base/applications/taskmgr/lang/de-DE.rc
index aea8376cf63..519d3097edb 100644
--- a/base/applications/taskmgr/lang/de-DE.rc
+++ b/base/applications/taskmgr/lang/de-DE.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&Prozess beenden", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/el-GR.rc
b/base/applications/taskmgr/lang/el-GR.rc
index 616f0de9115..f5a3a34598b 100644
--- a/base/applications/taskmgr/lang/el-GR.rc
+++ b/base/applications/taskmgr/lang/el-GR.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&End Process", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/en-US.rc
b/base/applications/taskmgr/lang/en-US.rc
index 90b73950e6a..d6d45afc0e6 100644
--- a/base/applications/taskmgr/lang/en-US.rc
+++ b/base/applications/taskmgr/lang/en-US.rc
@@ -175,7 +175,6 @@ BEGIN
PUSHBUTTON "&End Process", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/es-ES.rc
b/base/applications/taskmgr/lang/es-ES.rc
index 9a99ddebc89..6a0f4780a53 100644
--- a/base/applications/taskmgr/lang/es-ES.rc
+++ b/base/applications/taskmgr/lang/es-ES.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&Finalizar proceso", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/et-EE.rc
b/base/applications/taskmgr/lang/et-EE.rc
index 4aba1b254f9..ed6eef05a74 100644
--- a/base/applications/taskmgr/lang/et-EE.rc
+++ b/base/applications/taskmgr/lang/et-EE.rc
@@ -181,7 +181,6 @@ BEGIN
PUSHBUTTON "&Lõpeta protsess", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/fr-FR.rc
b/base/applications/taskmgr/lang/fr-FR.rc
index 204caaef666..d86362f1fec 100644
--- a/base/applications/taskmgr/lang/fr-FR.rc
+++ b/base/applications/taskmgr/lang/fr-FR.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&Terminer le processus", IDC_ENDPROCESS, 165, 189, 75, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/he-IL.rc
b/base/applications/taskmgr/lang/he-IL.rc
index c9855c5ff30..dea754e3d91 100644
--- a/base/applications/taskmgr/lang/he-IL.rc
+++ b/base/applications/taskmgr/lang/he-IL.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&סיים תהליך", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/hu-HU.rc
b/base/applications/taskmgr/lang/hu-HU.rc
index 51fa95242a6..99a18e3eba4 100644
--- a/base/applications/taskmgr/lang/hu-HU.rc
+++ b/base/applications/taskmgr/lang/hu-HU.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&Folyamat befejezése", IDC_ENDPROCESS, 165, 189, 75, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/id-ID.rc
b/base/applications/taskmgr/lang/id-ID.rc
index 28427216fa3..2052bdd0891 100644
--- a/base/applications/taskmgr/lang/id-ID.rc
+++ b/base/applications/taskmgr/lang/id-ID.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&Akhiri Proses", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/it-IT.rc
b/base/applications/taskmgr/lang/it-IT.rc
index ff44c4e27a8..2785ef8715d 100644
--- a/base/applications/taskmgr/lang/it-IT.rc
+++ b/base/applications/taskmgr/lang/it-IT.rc
@@ -177,7 +177,6 @@ BEGIN
PUSHBUTTON "&Termina Processo", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/ja-JP.rc
b/base/applications/taskmgr/lang/ja-JP.rc
index bec1d437eaf..4565f6cc044 100644
--- a/base/applications/taskmgr/lang/ja-JP.rc
+++ b/base/applications/taskmgr/lang/ja-JP.rc
@@ -177,7 +177,6 @@ BEGIN
PUSHBUTTON "プロセスの終了(&E)", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 9, "MS UI Gothic"
diff --git a/base/applications/taskmgr/lang/ko-KR.rc
b/base/applications/taskmgr/lang/ko-KR.rc
index 1dc9dcb30b3..d3dd75b0c40 100644
--- a/base/applications/taskmgr/lang/ko-KR.rc
+++ b/base/applications/taskmgr/lang/ko-KR.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "작업 끝내기(&E)", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 9, "굴림"
diff --git a/base/applications/taskmgr/lang/nl-NL.rc
b/base/applications/taskmgr/lang/nl-NL.rc
index 64f70a7d0df..06702663f7c 100644
--- a/base/applications/taskmgr/lang/nl-NL.rc
+++ b/base/applications/taskmgr/lang/nl-NL.rc
@@ -177,7 +177,6 @@ BEGIN
PUSHBUTTON "&Proces beëindigen", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/no-NO.rc
b/base/applications/taskmgr/lang/no-NO.rc
index 86063df9bbf..7b1a2715f53 100644
--- a/base/applications/taskmgr/lang/no-NO.rc
+++ b/base/applications/taskmgr/lang/no-NO.rc
@@ -177,7 +177,6 @@ BEGIN
PUSHBUTTON "&Avslutt prosess", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/pl-PL.rc
b/base/applications/taskmgr/lang/pl-PL.rc
index 160755b4e75..ab60fa53be0 100644
--- a/base/applications/taskmgr/lang/pl-PL.rc
+++ b/base/applications/taskmgr/lang/pl-PL.rc
@@ -184,7 +184,6 @@ BEGIN
PUSHBUTTON "&Zakończ proces", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/pt-BR.rc
b/base/applications/taskmgr/lang/pt-BR.rc
index f2581fe758d..a63fd2319d1 100644
--- a/base/applications/taskmgr/lang/pt-BR.rc
+++ b/base/applications/taskmgr/lang/pt-BR.rc
@@ -177,7 +177,6 @@ BEGIN
PUSHBUTTON "&Finalizar processo", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/pt-PT.rc
b/base/applications/taskmgr/lang/pt-PT.rc
index 1d6568e2d6d..0fe5288defd 100644
--- a/base/applications/taskmgr/lang/pt-PT.rc
+++ b/base/applications/taskmgr/lang/pt-PT.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&Terminar processo", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/ro-RO.rc
b/base/applications/taskmgr/lang/ro-RO.rc
index 1b0d7df8a74..9cba5a635f4 100644
--- a/base/applications/taskmgr/lang/ro-RO.rc
+++ b/base/applications/taskmgr/lang/ro-RO.rc
@@ -182,7 +182,6 @@ BEGIN
PUSHBUTTON "Opr&ește procesul", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/ru-RU.rc
b/base/applications/taskmgr/lang/ru-RU.rc
index da28e3bc231..989dec8a6c1 100644
--- a/base/applications/taskmgr/lang/ru-RU.rc
+++ b/base/applications/taskmgr/lang/ru-RU.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&Завершить процесс", IDC_ENDPROCESS, 167, 189, 74, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/sk-SK.rc
b/base/applications/taskmgr/lang/sk-SK.rc
index 45567224455..75982e1f7f4 100644
--- a/base/applications/taskmgr/lang/sk-SK.rc
+++ b/base/applications/taskmgr/lang/sk-SK.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&Ukončiť proces", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/sq-AL.rc
b/base/applications/taskmgr/lang/sq-AL.rc
index 06c4254a6e2..d0753d2889b 100644
--- a/base/applications/taskmgr/lang/sq-AL.rc
+++ b/base/applications/taskmgr/lang/sq-AL.rc
@@ -178,7 +178,6 @@ BEGIN
PUSHBUTTON "Mbyll Procesin", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/sv-SE.rc
b/base/applications/taskmgr/lang/sv-SE.rc
index 5186e05c3ff..9e5315c58c1 100644
--- a/base/applications/taskmgr/lang/sv-SE.rc
+++ b/base/applications/taskmgr/lang/sv-SE.rc
@@ -179,7 +179,6 @@ BEGIN
PUSHBUTTON "&Avsluta process", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/tr-TR.rc
b/base/applications/taskmgr/lang/tr-TR.rc
index 27a1272cd9e..201bc7c4498 100644
--- a/base/applications/taskmgr/lang/tr-TR.rc
+++ b/base/applications/taskmgr/lang/tr-TR.rc
@@ -177,7 +177,6 @@ BEGIN
PUSHBUTTON "&İşlemi Sonlandır", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/uk-UA.rc
b/base/applications/taskmgr/lang/uk-UA.rc
index b7d630af65b..59372ae4607 100644
--- a/base/applications/taskmgr/lang/uk-UA.rc
+++ b/base/applications/taskmgr/lang/uk-UA.rc
@@ -177,7 +177,6 @@ BEGIN
PUSHBUTTON "Зн&яти процес", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
diff --git a/base/applications/taskmgr/lang/zh-CN.rc
b/base/applications/taskmgr/lang/zh-CN.rc
index 5afc17c975f..d81a7ce540f 100644
--- a/base/applications/taskmgr/lang/zh-CN.rc
+++ b/base/applications/taskmgr/lang/zh-CN.rc
@@ -184,7 +184,6 @@ BEGIN
PUSHBUTTON "结束进程(&E)", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 9, "宋体"
diff --git a/base/applications/taskmgr/lang/zh-HK.rc
b/base/applications/taskmgr/lang/zh-HK.rc
index d6abcc2aea5..e50b521c256 100644
--- a/base/applications/taskmgr/lang/zh-HK.rc
+++ b/base/applications/taskmgr/lang/zh-HK.rc
@@ -185,7 +185,6 @@ BEGIN
PUSHBUTTON "結束處理程序(&E)", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 9, "新細明體"
diff --git a/base/applications/taskmgr/lang/zh-TW.rc
b/base/applications/taskmgr/lang/zh-TW.rc
index c83bfea34ee..0c10bb3afd7 100644
--- a/base/applications/taskmgr/lang/zh-TW.rc
+++ b/base/applications/taskmgr/lang/zh-TW.rc
@@ -185,7 +185,6 @@ BEGIN
PUSHBUTTON "結束處理程序(&E)", IDC_ENDPROCESS, 171, 189, 69, 14
END
-/* IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210 */
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 9, "新細明體"
diff --git a/base/applications/taskmgr/perfdata.c b/base/applications/taskmgr/perfdata.c
index 0126285c98b..7f0869a5752 100644
--- a/base/applications/taskmgr/perfdata.c
+++ b/base/applications/taskmgr/perfdata.c
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Task Manager
* LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
- * PURPOSE: Performance Counters.
+ * PURPOSE: Performance Counters
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp(a)reactos.org>
* Copyright 2014 Ismael Ferreras Morezuelas
<swyterzone+ros(a)gmail.com>
*/
@@ -100,7 +100,7 @@ void PerfDataUninitialize(void)
static void SidToUserName(PSID Sid, LPWSTR szBuffer, DWORD BufferSize)
{
static WCHAR szDomainNameUnused[255];
- DWORD DomainNameLen = sizeof(szDomainNameUnused) / sizeof(szDomainNameUnused[0]);
+ DWORD DomainNameLen = _countof(szDomainNameUnused);
SID_NAME_USE Use;
if (Sid != NULL)
@@ -153,8 +153,6 @@ CachedGetUserFromSid(
pEntry->List.Blink = SidToUserNameHead.Blink;
SidToUserNameHead.Blink->Flink = &pEntry->List;
SidToUserNameHead.Blink = &pEntry->List;
-
- return;
}
void PerfDataRefresh(void)
@@ -324,7 +322,7 @@ void PerfDataRefresh(void)
wcsncpy(pPerfData[Idx].ImageName, pSPI->ImageName.Buffer, len);
} else {
LoadStringW(hInst, IDS_IDLE_PROCESS, pPerfData[Idx].ImageName,
- sizeof(pPerfData[Idx].ImageName) /
sizeof(pPerfData[Idx].ImageName[0]));
+ _countof(pPerfData[Idx].ImageName));
}
pPerfData[Idx].ProcessId = pSPI->UniqueProcessId;
@@ -402,7 +400,7 @@ ClearInfo:
ZeroMemory(&pPerfData[Idx].IOCounters, sizeof(IO_COUNTERS));
}
- cwcUserName = sizeof(pPerfData[0].UserName) / sizeof(pPerfData[0].UserName[0]);
+ cwcUserName = _countof(pPerfData[0].UserName);
CachedGetUserFromSid(ProcessUser, pPerfData[Idx].UserName, &cwcUserName);
if (ProcessSD != NULL)
diff --git a/base/applications/taskmgr/perfpage.c b/base/applications/taskmgr/perfpage.c
index c9abb74cd15..005bc6e2e40 100644
--- a/base/applications/taskmgr/perfpage.c
+++ b/base/applications/taskmgr/perfpage.c
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Task Manager
* LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
- * PURPOSE: Performance Page.
+ * PURPOSE: Performance Page
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp(a)reactos.org>
*/
@@ -320,9 +320,9 @@ DWORD WINAPI PerformancePageRefreshThread(PVOID Parameter)
WCHAR Text[260];
WCHAR szMemUsage[256], szCpuUsage[256], szProcesses[256];
- LoadStringW(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, ARRAYSIZE(szCpuUsage));
- LoadStringW(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, ARRAYSIZE(szMemUsage));
- LoadStringW(hInst, IDS_STATUS_PROCESSES, szProcesses, ARRAYSIZE(szProcesses));
+ LoadStringW(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, _countof(szCpuUsage));
+ LoadStringW(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, _countof(szMemUsage));
+ LoadStringW(hInst, IDS_STATUS_PROCESSES, szProcesses, _countof(szProcesses));
while (1)
{
@@ -355,11 +355,11 @@ DWORD WINAPI PerformancePageRefreshThread(PVOID Parameter)
StrFormatByteSizeW(CommitChargeTotal * 1024,
szChargeTotalFormat,
- ARRAYSIZE(szChargeTotalFormat));
+ _countof(szChargeTotalFormat));
StrFormatByteSizeW(CommitChargeLimit * 1024,
szChargeLimitFormat,
- ARRAYSIZE(szChargeLimitFormat));
+ _countof(szChargeLimitFormat));
if (!bTrackMenu)
{
diff --git a/base/applications/taskmgr/procpage.c b/base/applications/taskmgr/procpage.c
index e3e791b6182..27b34947153 100644
--- a/base/applications/taskmgr/procpage.c
+++ b/base/applications/taskmgr/procpage.c
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Task Manager
* LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
- * PURPOSE: Processes Page.
+ * PURPOSE: Processes Page
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp(a)reactos.org>
* Copyright 2009 Maxime Vernier <maxime.vernier(a)gmail.com>
* Copyright 2022 Thamatip Chitpong <tangaming123456(a)outlook.com>
@@ -797,8 +797,8 @@ int CALLBACK ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2,
LPARAM lPara
if (TaskManagerSettings.SortColumn == COLUMN_IMAGENAME)
{
- PerfDataGetImageName(IndexParam1, text1, sizeof (text1) / sizeof (*text1));
- PerfDataGetImageName(IndexParam2, text2, sizeof (text2) / sizeof (*text2));
+ PerfDataGetImageName(IndexParam1, text1, _countof(text1));
+ PerfDataGetImageName(IndexParam2, text2, _countof(text2));
ret = _wcsicmp(text1, text2);
}
else if (TaskManagerSettings.SortColumn == COLUMN_PID)
@@ -809,14 +809,14 @@ int CALLBACK ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2,
LPARAM lPara
}
else if (TaskManagerSettings.SortColumn == COLUMN_USERNAME)
{
- PerfDataGetUserName(IndexParam1, text1, sizeof (text1) / sizeof (*text1));
- PerfDataGetUserName(IndexParam2, text2, sizeof (text2) / sizeof (*text2));
+ PerfDataGetUserName(IndexParam1, text1, _countof(text1));
+ PerfDataGetUserName(IndexParam2, text2, _countof(text2));
ret = _wcsicmp(text1, text2);
}
else if (TaskManagerSettings.SortColumn == COLUMN_COMMANDLINE)
{
- PerfDataGetCommandLine(IndexParam1, text1, sizeof (text1) / sizeof (*text1));
- PerfDataGetCommandLine(IndexParam2, text2, sizeof (text2) / sizeof (*text2));
+ PerfDataGetCommandLine(IndexParam1, text1, _countof(text1));
+ PerfDataGetCommandLine(IndexParam2, text2, _countof(text2));
ret = _wcsicmp(text1, text2);
}
else if (TaskManagerSettings.SortColumn == COLUMN_SESSIONID)
diff --git a/base/applications/taskmgr/run.c b/base/applications/taskmgr/run.c
index 3e210f04415..621858a1e11 100644
--- a/base/applications/taskmgr/run.c
+++ b/base/applications/taskmgr/run.c
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Task Manager
* LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
- * PURPOSE: Run Task.
+ * PURPOSE: Run Task
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp(a)reactos.org>
* Copyright 2005 Klemens Friedl <frik85(a)reactos.at>
*/
@@ -16,8 +16,8 @@ void TaskManager_OnFileNew(void)
WCHAR szText[256];
/* Load language strings from resource file */
- LoadStringW(hInst, IDS_CREATENEWTASK, szTitle, sizeof(szTitle) /
sizeof(szTitle[0]));
- LoadStringW(hInst, IDS_CREATENEWTASK_DESC, szText, sizeof(szText) /
sizeof(szText[0]));
+ LoadStringW(hInst, IDS_CREATENEWTASK, szTitle, _countof(szTitle));
+ LoadStringW(hInst, IDS_CREATENEWTASK_DESC, szText, _countof(szText));
hShell32 = LoadLibraryW(L"SHELL32.DLL");
RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (LPCSTR)61);
diff --git a/base/applications/taskmgr/taskmgr.c b/base/applications/taskmgr/taskmgr.c
index bf24eef8b39..9dedb5e1093 100644
--- a/base/applications/taskmgr/taskmgr.c
+++ b/base/applications/taskmgr/taskmgr.c
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Task Manager
* LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
- * PURPOSE: Application Entry-point.
+ * PURPOSE: Application Entry-point
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp(a)reactos.org>
* Copyright 2005 Klemens Friedl <frik85(a)reactos.at>
*/
@@ -110,7 +110,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
HWND hTaskMgr;
TCHAR szTaskmgr[128];
- LoadString(hInst, IDS_APP_TITLE, szTaskmgr, sizeof(szTaskmgr)/sizeof(TCHAR));
+ LoadString(hInst, IDS_APP_TITLE, szTaskmgr, _countof(szTaskmgr));
hTaskMgr = FindWindow(NULL, szTaskmgr);
if (hTaskMgr != NULL)
@@ -139,10 +139,10 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
* so that we can debug processes
*/
- /* Get a token for this process. */
+ /* Get a token for this process. */
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
&hToken))
{
- /* Get the LUID for the debug privilege. */
+ /* Get the LUID for the debug privilege. */
if (LookupPrivilegeValueW(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid))
{
tkp.PrivilegeCount = 1; /* one privilege to set */
@@ -159,9 +159,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
/* Initialize perf data */
if (!PerfDataInitialize())
- {
return -1;
- }
/*
* Set our shutdown parameters: we want to shutdown the very last,
@@ -371,21 +369,14 @@ TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
hPopupMenu = GetSubMenu(hMenu, 0);
if(IsWindowVisible(hMainWnd))
- {
- DeleteMenu(hPopupMenu, ID_RESTORE, MF_BYCOMMAND);
- }
+ DeleteMenu(hPopupMenu, ID_RESTORE, MF_BYCOMMAND);
else
- {
- SetMenuDefaultItem(hPopupMenu, ID_RESTORE, FALSE);
- }
+ SetMenuDefaultItem(hPopupMenu, ID_RESTORE, FALSE);
if(OnTop)
- {
- CheckMenuItem(hPopupMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND |
MF_CHECKED);
- } else
- {
- CheckMenuItem(hPopupMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND |
MF_UNCHECKED);
- }
+ CheckMenuItem(hPopupMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND |
MF_CHECKED);
+ else
+ CheckMenuItem(hPopupMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND |
MF_UNCHECKED);
SetForegroundWindow(hMainWnd);
TrackPopupMenuEx(hPopupMenu, 0, pt.x, pt.y, hMainWnd, NULL);
@@ -680,19 +671,19 @@ BOOL OnCreate(HWND hWnd)
lpUserName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len *
sizeof(WCHAR));
if (lpUserName && GetUserNameW(lpUserName, &len))
{
- _snwprintf(szLogOffItem, sizeof(szLogOffItem)/sizeof(szLogOffItem[0]),
szTemp, lpUserName);
- szLogOffItem[sizeof(szLogOffItem)/sizeof(szLogOffItem[0]) - 1] =
UNICODE_NULL;
+ _snwprintf(szLogOffItem, _countof(szLogOffItem), szTemp, lpUserName);
+ szLogOffItem[_countof(szLogOffItem) - 1] = UNICODE_NULL;
}
else
{
- _snwprintf(szLogOffItem, sizeof(szLogOffItem)/sizeof(szLogOffItem[0]),
szTemp, L"n/a");
+ _snwprintf(szLogOffItem, _countof(szLogOffItem), szTemp, L"n/a");
}
if (lpUserName) HeapFree(GetProcessHeap(), 0, lpUserName);
}
else
{
- _snwprintf(szLogOffItem, sizeof(szLogOffItem)/sizeof(szLogOffItem[0]), szTemp,
L"n/a");
+ _snwprintf(szLogOffItem, _countof(szLogOffItem), szTemp, L"n/a");
}
/* 3- Set the menu item text to its formatted counterpart */
@@ -868,11 +859,8 @@ void SaveSettings(void)
void TaskManager_OnRestoreMainWindow(void)
{
- //HMENU hMenu, hOptionsMenu;
BOOL OnTop;
- //hMenu = GetMenu(hMainWnd);
- //hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
OnTop = ((GetWindowLongPtrW(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0);
OpenIcon(hMainWnd);