[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

@ -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)));
}

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: Applications Page.
* PURPOSE: Applications Page
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
* Copyright 2005 Klemens Friedl <frik85@reactos.at>
* Copyright 2021 Katayama Hirofumi MZ <katayama.hirofumi.mz@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);
}
}
}

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: Applications Page.
* PURPOSE: Applications Page
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
* Copyright 2005 Klemens Friedl <frik85@reactos.at>
* Copyright 2021 Katayama Hirofumi MZ <katayama.hirofumi.mz@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);

View file

@ -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;
}

View file

@ -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]

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

View file

@ -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);
}
}

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: Performance Graph Meters.
* PURPOSE: Performance Graph Meters
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@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

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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, "굴림"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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, "宋体"

View file

@ -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, "新細明體"

View file

@ -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, "新細明體"

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: Performance Counters.
* PURPOSE: Performance Counters
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
* Copyright 2014 Ismael Ferreras Morezuelas <swyterzone+ros@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)

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: Performance Page.
* PURPOSE: Performance Page
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@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)
{

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: Processes Page.
* PURPOSE: Processes Page
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
* Copyright 2009 Maxime Vernier <maxime.vernier@gmail.com>
* Copyright 2022 Thamatip Chitpong <tangaming123456@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)

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: Run Task.
* PURPOSE: Run Task
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
* Copyright 2005 Klemens Friedl <frik85@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);

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: Application Entry-point.
* PURPOSE: Application Entry-point
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
* Copyright 2005 Klemens Friedl <frik85@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);