由于一篇幅的代码涉及到强制关机与显示蓝屏的部分,大家测试的时候尽量在虚拟机,否则后果负,手动滑稽~~
// ZwShutdownSystem.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <Windows.h>
#include "NTPublic.h"
typedef UINT (CALLBACK* NTRAISEHARDERROR)(NTSTATUS, ULONG, PUNICODE_STRING, PVOID,HARDERROR_RESPONSE_OPTION, PHARDERROR_RESPONSE);
typedef UINT (CALLBACK* RTLADJUSTPRIVILEGE)(ULONG, BOOL, BOOL, PINT);
typedef int (CALLBACK * ZWSHUTDOWNSYSTEM)(int);
const unsigned long SE_DEBUG_PRIVILEGE = 0x13;
// 强制关机代码
int WINAPI StartShutdown(const int nCode)
{
HINSTANCE hDLL = LoadLibrary(TEXT("ntdll.dll"));
ZWSHUTDOWNSYSTEM ZwShutdownSystem = NULL;
RTLADJUSTPRIVILEGE RtlAdjustPrivilege = NULL;
i