How to cause a BSOD on Windows XP and newer versions?
Try NotMyFault!
http://technet.microsoft.com/en-us/sysinternals/bb963901
The keyboard driver(s) can be told to cause a BSOD:
HKLM\SYSTEM\CurrentControlSet\Services\kbdhid\Parameters
or (for older PS/2 keyboards)
HKLM\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters
And there set a REG_DWORD
named CrashOnCtrlScroll
to 1
.
After the next reboot you can force the blue screen by Ctrl+ScrollLk+ScrollLk. The bug check code will in this case be 0xE2 (MANUALLY_INITIATED_CRASH).
If you really want a programmatic method, you need to find a hole in some driver on that machine or write and install a simplistic driver that calls either KeBugCheck
or KeBugCheckEx
.
Have fun ;)
Side-note: it can be very useful to deliberately cause a crash like this for driver writers or even when dealing with malware. If you configured your system to create a full memory dump, you will then have an image of the running system which can be further analyzed. Consider cases like a deadlock where a debugger does not necessarily help in all cases.