[CSRSRV] CsrUnhandledExceptionFilter: Check RtlAdjustPrivilege() result (#2864)

And remove unused NtRaiseHardError() Status assignment.

Detected by Cppcheck: redundantAssignment.
Related to commit d221bdfb (r55647).
This commit is contained in:
Serge Gautherie 2020-06-01 20:20:31 +02:00 committed by GitHub
parent 7094297b7a
commit b5af1eb44a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -659,6 +659,11 @@ CsrUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
FALSE, FALSE,
&OldValue); &OldValue);
} }
if (!NT_SUCCESS(Status))
{
DPRINT1("CsrUnhandledExceptionFilter(): RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE) failed, Status = 0x%08lx\n", Status);
goto NoPrivilege;
}
/* Initialize our Name String */ /* Initialize our Name String */
RtlInitUnicodeString(&ErrorSource, L"Windows SubSystem"); RtlInitUnicodeString(&ErrorSource, L"Windows SubSystem");
@ -670,14 +675,15 @@ CsrUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
ErrorParameters[3] = (ULONG_PTR)ExceptionInfo->ContextRecord; ErrorParameters[3] = (ULONG_PTR)ExceptionInfo->ContextRecord;
/* Bugcheck */ /* Bugcheck */
Status = NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED,
4, 4,
1, 1,
ErrorParameters, ErrorParameters,
OptionShutdownSystem, OptionShutdownSystem,
&Response); &Response);
} }
NoPrivilege:
/* Just terminate us */ /* Just terminate us */
NtTerminateProcess(NtCurrentProcess(), NtTerminateProcess(NtCurrentProcess(),
ExceptionInfo->ExceptionRecord->ExceptionCode); ExceptionInfo->ExceptionRecord->ExceptionCode);