[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.
This commit is contained in:
Joachim Henze 2023-10-03 21:00:10 +02:00 committed by GitHub
parent 410b1030c0
commit 46b4b5581d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 91 additions and 194 deletions

View file

@ -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@reactos.org>
* Copyright 2005 Klemens Friedl <frik85@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