Programmatically cause a BSOD using Right Ctrl + Scroll Lock + Scroll Lock

143 views Asked by At

Followed these steps on How to force a Blue Screen Of Death (BSOD) in Windows 11/10.

I manually pressed these keys Right Ctrl + Scroll Lock + Scroll Lock to successfully cause a BSOD

bsod

However, ran a C program (as admin) to simulate the keys but it never causes a BSOD?

#include <Windows.h>
#include <stdio.h>

int main() {

    HKEY hKey;
    DWORD dwValue = 1;
    RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\i8042prt\\Parameters", 0, KEY_SET_VALUE, &hKey);
    RegSetValueExA(hKey, "CrashOnCtrlScroll", 0, REG_DWORD, (const BYTE*)&dwValue, sizeof(dwValue));
    RegCloseKey(hKey);

    DWORD dwDisposition;
    RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\kbdhid\\Parameters", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition);
    RegSetValueExA(hKey, "CrashOnCtrlScroll", 0, REG_DWORD, (const BYTE*)&dwValue, sizeof(dwValue));
    RegCloseKey(hKey);

    // Simulate pressing the RIGHT Ctrl key down
    keybd_event(VK_RCONTROL, MapVirtualKey(VK_RCONTROL, 0), 0, 0);

    // First Scroll Lock down/up keypress
    keybd_event(VK_SCROLL, MapVirtualKey(VK_SCROLL, 0), 0, 0);
    keybd_event(VK_SCROLL, MapVirtualKey(VK_SCROLL, 0), KEYEVENTF_KEYUP, 0);

    Sleep(200);

    // Second Scroll Lock down/up keypress
    keybd_event(VK_SCROLL, MapVirtualKey(VK_SCROLL, 0), 0, 0);
    keybd_event(VK_SCROLL, MapVirtualKey(VK_SCROLL, 0), KEYEVENTF_KEYUP, 0);

    // Simulate releasing the RIGHT Ctrl key
    keybd_event(VK_RCONTROL, MapVirtualKey(VK_RCONTROL, 0), KEYEVENTF_KEYUP, 0);

    printf("BSOD!\n");

    return 0;
}

Question

I've tried simulating the key presses to be more human like by introducing a delay, but no luck!?

0

There are 0 answers