From ff293a18779dc509c09fdea862a6abf33d7d281d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Wed, 20 Apr 2022 03:31:08 +0200 Subject: [PATCH] [CSRSRV] Acquire the necessary SE_INC_BASE_PRIORITY_PRIVILEGE at shutdown (#4461) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When increasing the base priority at shutdown, acquire the necessary SE_INC_BASE_PRIORITY_PRIVILEGE in CsrSetToShutdownPriority(), called by CsrShutdownProcesses(), which is necessary due to the increase of process base priority (i.e. increase of scheduling) being done. Dedicated to George Bișoc :) The Shutdown privilege is however unnecessary (or unwanted) since this has been already dealt with by the shutdown caller. Also, it will be needed only by the caller of NtShutdownSystem() -- that we don't call at all here. --- subsystems/win32/csrsrv/procsup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsystems/win32/csrsrv/procsup.c b/subsystems/win32/csrsrv/procsup.c index 8d00dc202a3..929a0bc39a6 100644 --- a/subsystems/win32/csrsrv/procsup.c +++ b/subsystems/win32/csrsrv/procsup.c @@ -64,8 +64,8 @@ CsrSetToNormalPriority(VOID) * @name CsrSetToShutdownPriority * * The CsrSetToShutdownPriority routine sets the current NT Process' - * priority to the boosted priority for CSR Processes doing shutdown. - * Additonally, it acquires the Shutdown Privilege required for shutdown. + * priority to the boosted priority for CSR Processes doing shutdown, + * acquiring also the required Increase Base Priority privilege. * * @param None. * @@ -82,8 +82,8 @@ CsrSetToShutdownPriority(VOID) KPRIORITY BasePriority = PROCESS_PRIORITY_NORMAL_FOREGROUND + 6; BOOLEAN Old; - /* Get the shutdown privilege */ - if (NT_SUCCESS(RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE, + /* Get the Increase Base Priority privilege */ + if (NT_SUCCESS(RtlAdjustPrivilege(SE_INC_BASE_PRIORITY_PRIVILEGE, TRUE, FALSE, &Old)))