Possible Duplicate:
Simulating a BlueScreen
Hello SO,
I'm trying to induce a BSOD somehow inline in my C code. My main background is Java but have been fortunate to have been tutored by some coworkers and am helping out with a simple C utility.
There's two sections:
1) write to a hard drive (I finished this, wasn't too bad) 2) Force a blue screen immediately after sending the last SCSI write commandYou can probably tell the intent of the program easily now.
I've tried two things so far:
1) Externally calling pskill.exe (windows utility) to manually crash csrss.exe which forces a blue screen every time since csrss.exe is a required service of windows. This doesn't work because it's not fast enough. The call to the external utility takes too long so we need inline code to compile with the write to disk section in order to crash the computer fast enough.2) Use the windows.h API to call TerminateProcess: http://msdn.microsoft.com/en-us/library/ms686714%28v=vs.85%29.aspx The problem is this function cannot开发者_运维技巧 end system related tasks so it can't close csrss.exe
This has left me short on options. I need a clever way to kill csrss.exe in our own native code without an external call or a clever way to force a blue screen in internal code OR I need a very simple driver I can load and call which will blue screen the machine immediately. Could be as short as 1 line calling KeBugCheck http://msdn.microsoft.com/en-us/library/ff551948.aspx
Thanks for your time and input.
Your best bet is to write a trivial driver that calls KeBugCheck()
as you yourself suggest. You can take the most simple example from the Windows Driver Kit and cut it down to the barebones.
I recomment Not My Fault from sysinternals.
Here are two ways to get a blue screen when running in kernel mode:
- Dereference a null pointer, or
- Divide by zero
精彩评论