[DllImport("ntdll.dll")]
private static extern uint NtRaiseHardError(
uint ErrorStatus,
uint NumberOfParameters,
uint UnicodeStringParameterMask,
IntPtr Parameters,
uint ValidResponseOption,
out uint Response
);
[DllImport("ntdll.dll")]
private static extern uint NtRaiseHardError(
NtStatus ErrorStatus,
uint NumberOfParameters,
uint UnicodeStringParameterMask,
IntPtr Parameters,
uint ValidResponseOption,
out uint Response
);
<DllImport("ntdll.dll")>
Private Shared Function NtRaiseHardError(ByVal ErrorStatus As UInteger, ByVal NumberOfParameters As UInteger, ByVal UnicodeStringParameterMask As UInteger, ByVal Parameters As IntPtr, ByVal ValidResponseOption As UInteger, <Out()> ByRef Response As UInteger) As
UInteger
End Function
http://deusexmachina.uk/ntstatus.html
http://pinvoke.net/default.aspx/Enums/NTStatus.html
Requires the SeShutdownPriviledge, otherwise will fail.
Use RtlAdjustPrivilege with Privilege parameter 19 to enable SeShutdownPriviledge.
Please add some!
Console.Write("Press any key to trigger a BSOD.");
Console.ReadKey();
RtlAdjustPrivilege(19, true, false, out bool previousValue);
NtRaiseHardError(0xC0000420, 0, 0, IntPtr.Zero, 6, out uint Response);
Console.Write("Press any key to trigger a BSOD.")
Console.ReadKey()
Dim previousValue As Boolean
RtlAdjustPrivilege(19, True, False, previousValue)
Dim Response As UInteger
NtRaiseHardError(3221226528, 0, 0, IntPtr.Zero, 6, Response)