RtlSetProcessIsCritical - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H

/**
 * The RtlSetProcessIsCritical function sets or clears the critical status of the current process.
 *
 * \param NewValue TRUE to mark the process as critical, FALSE to clear.
 * \param OldValue Optional pointer to receive the previous critical status.
 * \param CheckFlag If TRUE, checks for certain conditions before setting.
 * \return NTSTATUS Successful or errant status.
 * \remarks A critical process will cause a system bugcheck if terminated.
 */
NTSYSAPI
NTSTATUS
STDAPIVCALLTYPE
RtlSetProcessIsCritical(
    _In_ BOOLEAN NewValue,
    _Out_opt_ PBOOLEAN OldValue,
    _In_ BOOLEAN CheckFlag
    );

#endif

View code on GitHub

Adjusts the critical state of the current process. Termination of a critical process causes a BSOD. Calling this function requires SeDebugPrivilege.

Parameters

Notable return values

Implementation details

This function uses NtQueryInformationProcess and NtSetInformationProcess with the PROCESSINFOCLASS value of ProcessBreakOnTermination (29) on the current process.

See also