This is a ring3 program that causes BSoD. It uses the following two functions:
RtlAdjustPrivilege
and NtRaiseHardError
.
They are defined as follows:
[DllImport("ntdll.dll")]
private static extern uint RtlAdjustPrivilege(
int Privilege,
bool bEnablePrivilege,
bool IsThreadPrivilege,
out bool PreviousValue
);
[DllImport("ntdll.dll")]
private static extern uint NtRaiseHardError(
uint ErrorStatus,
uint NumberOfParameters,
uint UnicodeStringParameterMask,
IntPtr Parameters,
uint ValidResponseOption,
out uint Response
);
For more information, please see: Analysis of the variety of ways and principles of R3 blue screen (In Chinese).