ReactOS
0.4.16-dev-1946-g52006dd
priority.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS Task Manager
3
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4
* PURPOSE: Process Priority.
5
* COPYRIGHT: Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
6
* Copyright 2005 Klemens Friedl <frik85@reactos.at>
7
*/
8
9
#include "
precomp.h
"
10
11
void
DoSetPriority
(
DWORD
priority
)
12
{
13
DWORD
dwProcessId
;
14
HANDLE
hProcess
;
15
WCHAR
szText[260];
16
WCHAR
szTitle
[256];
17
18
dwProcessId
=
GetSelectedProcessId
();
19
20
if
(
dwProcessId
== 0)
21
return
;
22
23
LoadStringW
(
hInst
,
IDS_MSG_TASKMGRWARNING
,
szTitle
, 256);
24
LoadStringW
(
hInst
,
IDS_MSG_WARNINGCHANGEPRIORITY
, szText, 260);
25
if
(!
ConfirmMessageBox
(
hMainWnd
, szText,
szTitle
,
MB_YESNO
|
MB_ICONWARNING
))
26
return
;
27
28
hProcess
=
OpenProcess
(
PROCESS_SET_INFORMATION
,
FALSE
,
dwProcessId
);
29
30
if
(!
hProcess
)
31
{
32
GetLastErrorText
(szText, 260);
33
LoadStringW
(
hInst
,
IDS_MSG_UNABLECHANGEPRIORITY
,
szTitle
, 256);
34
MessageBoxW
(
hMainWnd
, szText,
szTitle
,
MB_OK
|
MB_ICONSTOP
);
35
return
;
36
}
37
38
if
(!
SetPriorityClass
(
hProcess
,
priority
))
39
{
40
GetLastErrorText
(szText, 260);
41
LoadStringW
(
hInst
,
IDS_MSG_UNABLECHANGEPRIORITY
,
szTitle
, 256);
42
MessageBoxW
(
hMainWnd
, szText,
szTitle
,
MB_OK
|
MB_ICONSTOP
);
43
}
44
45
CloseHandle
(
hProcess
);
46
}
IDS_MSG_UNABLECHANGEPRIORITY
#define IDS_MSG_UNABLECHANGEPRIORITY
Definition:
resource.h:255
IDS_MSG_TASKMGRWARNING
#define IDS_MSG_TASKMGRWARNING
Definition:
resource.h:252
IDS_MSG_WARNINGCHANGEPRIORITY
#define IDS_MSG_WARNINGCHANGEPRIORITY
Definition:
resource.h:256
FALSE
#define FALSE
Definition:
types.h:117
CloseHandle
#define CloseHandle
Definition:
compat.h:739
OpenProcess
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition:
proc.c:1227
SetPriorityClass
BOOL WINAPI SetPriorityClass(IN HANDLE hProcess, IN DWORD dwPriorityClass)
Definition:
proc.c:1700
LoadStringW
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition:
string.c:1220
hInst
HINSTANCE hInst
Definition:
dxdiag.c:13
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
PROCESS_SET_INFORMATION
#define PROCESS_SET_INFORMATION
Definition:
pstypes.h:166
void
Definition:
nsiface.idl:2307
szTitle
TCHAR szTitle[MAX_LOADSTRING]
Definition:
magnifier.c:35
hMainWnd
HWND hMainWnd
Definition:
magnifier.c:32
hProcess
_In_ BOOL _In_ HANDLE hProcess
Definition:
mapping.h:71
priority
static int priority
Definition:
timer.c:163
DoSetPriority
void DoSetPriority(DWORD priority)
Definition:
priority.c:11
GetSelectedProcessId
DWORD GetSelectedProcessId(void)
Definition:
procpage.c:88
dwProcessId
_In_ DWORD dwProcessId
Definition:
shlwapi.h:193
ConfirmMessageBox
BOOL ConfirmMessageBox(HWND hWnd, LPCWSTR Text, LPCWSTR Title, UINT Type)
Definition:
taskmgr.c:1059
GetLastErrorText
LPWSTR GetLastErrorText(LPWSTR lpszBuf, DWORD dwSize)
Definition:
taskmgr.c:1083
precomp.h
MB_YESNO
#define MB_YESNO
Definition:
winuser.h:828
MessageBoxW
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
MB_OK
#define MB_OK
Definition:
winuser.h:801
MB_ICONWARNING
#define MB_ICONWARNING
Definition:
winuser.h:797
MB_ICONSTOP
#define MB_ICONSTOP
Definition:
winuser.h:814
WCHAR
__wchar_t WCHAR
Definition:
xmlstorage.h:180
base
applications
taskmgr
priority.c
Generated on Thu Dec 4 2025 06:02:39 for ReactOS by
1.9.6