mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
5d1be078f8
Allow the user to hold shift to automatically answer IDYES when killing/debugging a process or changing the priority.
46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
/*
|
|
* PROJECT: ReactOS Task Manager
|
|
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
|
|
* PURPOSE: Process Priority.
|
|
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
|
|
* Copyright 2005 Klemens Friedl <frik85@reactos.at>
|
|
*/
|
|
|
|
#include "precomp.h"
|
|
|
|
void DoSetPriority(DWORD priority)
|
|
{
|
|
DWORD dwProcessId;
|
|
HANDLE hProcess;
|
|
WCHAR szText[260];
|
|
WCHAR szTitle[256];
|
|
|
|
dwProcessId = GetSelectedProcessId();
|
|
|
|
if (dwProcessId == 0)
|
|
return;
|
|
|
|
LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTitle, 256);
|
|
LoadStringW(hInst, IDS_MSG_WARNINGCHANGEPRIORITY, szText, 260);
|
|
if (!ConfirmMessageBox(hMainWnd, szText, szTitle, MB_YESNO|MB_ICONWARNING))
|
|
return;
|
|
|
|
hProcess = OpenProcess(PROCESS_SET_INFORMATION, FALSE, dwProcessId);
|
|
|
|
if (!hProcess)
|
|
{
|
|
GetLastErrorText(szText, 260);
|
|
LoadStringW(hInst, IDS_MSG_UNABLECHANGEPRIORITY, szTitle, 256);
|
|
MessageBoxW(hMainWnd, szText, szTitle, MB_OK|MB_ICONSTOP);
|
|
return;
|
|
}
|
|
|
|
if (!SetPriorityClass(hProcess, priority))
|
|
{
|
|
GetLastErrorText(szText, 260);
|
|
LoadStringW(hInst, IDS_MSG_UNABLECHANGEPRIORITY, szTitle, 256);
|
|
MessageBoxW(hMainWnd, szText, szTitle, MB_OK|MB_ICONSTOP);
|
|
}
|
|
|
|
CloseHandle(hProcess);
|
|
}
|