开发者

force a blue screen (from a simple driver bug?) in C code [duplicate]

开发者 https://www.devze.com 2023-02-19 15:51 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Simulating a BlueScreen
This question already has answers here: Closed 11 years ago.

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 command

You 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:

  1. Dereference a null pointer, or
  2. Divide by zero
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号