0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

C++でBSODを発生させる

Last updated at Posted at 2025-07-16

はじめに

本記事ではC++を用いてwindows11でBSOD(BlueScreen)を発生させることを目的とした内容になります。

絶対に他人のPCで行わないでください

BSODを発生させる上でいくつかの方法があります。

  • svchost.exeをタスキルする
  • system32を削除する
  • 特定のレジストリを追加する
    など

ここではwindows NT APIを使用してBSODを発生させます。

extern "C" NTSTATUS NTAPI RtlAdjustPrivilege(ULONG Privilege, BOOLEAN Enable, BOOLEAN CurrThread, PBOOLEAN StatusPointer);
  • 指定した特権(ここではシャットダウン権限)を有効にする
  • Privilege = 19SeShutdownPrivilege を意味します
    つまり、システムをシャットダウン、再起動、クラッシュさせるための特権を取得するために使用します
extern "C" NTSTATUS NTAPI NtRaiseHardError(LONG ErrorStatus, ULONG Unless1, ULONG Unless2, PULONG_PTR Unless3, ULONG ValidResponseOption, PULONG ResponsePointer);
  • カーネルやドライバが 致命的なエラーを通知するために使う関数です
  • 第1引数にSTATUS_IN_PAGE_ERROR(エラーコード)を渡していて、BSODを引き起こすトリガーになっています
main.c
#include "stdafx.h"
#include <iostream>
#include <winternl.h>
#include <Windows.h>
#pragma comment(lib, "ntdll.lib")

using namespace std;

extern "C" NTSTATUS NTAPI RtlAdjustPrivilege(ULONG Privilege, BOOLEAN Enable, BOOLEAN CurrThread, PBOOLEAN StatusPointer);
extern "C" NTSTATUS NTAPI NtRaiseHardError(LONG ErrorStatus, ULONG Unless1, ULONG Unless2, PULONG_PTR Unless3, ULONG ValidResponseOption, PULONG ResponsePointer);

int main() {
	BOOLEAN PrivilegeState = FALSE;
	ULONG ErrorResponse = 0;
	RtlAdjustPrivilege(19, TRUE, FALSE, &PrivilegeState);
	printf("starting");
	NtRaiseHardError(STATUS_IN_PAGE_ERROR, 0, 0, NULL, 6, &ErrorResponse); 
	return 0;
}

絶対に他人のPCで行わないでください

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?