windows 模拟蓝屏
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/667581/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Simulating a BlueScreen
提问by Michael Burr
I am trying to make a program that records a whole bunch of things periodically. The specific reason is that if it bluescreens, a developer can go back and check a lot of the environment and see what was going on around that time.
我正在尝试制作一个定期记录一大堆东西的程序。具体原因是,如果它蓝屏,开发人员可以回去检查很多环境,看看当时发生了什么。
My problem, is their a way to cause a bluescreen? Maybe with a windowsAPI call (ZeroMemory maybe?).
我的问题,他们是导致蓝屏的一种方式吗?也许使用 windowsAPI 调用(也许是 ZeroMemory?)。
Anywhoo, if you can think of a way to cause a bluescreen on call I would be thankful.
Anywhoo,如果您能想出一种方法来导致随叫随到蓝屏,我将不胜感激。
The computer I am testing this on is designed to take stuff like this haha.
我正在测试的计算机旨在接受这样的东西哈哈。
by the way the language I am using is C\C++. Thank you
顺便说一下,我使用的语言是 C\C++。谢谢
回答by Michael Burr
You can configure a machine to crash on a keystroke (Ctrl-ScrollLock)
您可以将机器配置为在击键时崩溃(Ctrl-ScrollLock)
Since it appears that there are times when that won't work on some systems with USB keyboards, you can also get the Debugging Tools for Windows, install the kernel debugger, and use the ".crash
" command to force a bugcheck.
由于有时这似乎在某些带有 USB 键盘的系统上不起作用,您还可以获取 Windows 调试工具,安装内核调试器,并使用“ .crash
”命令强制进行错误检查。
回答by Jesse Weigert
In order to cause a BSOD, a driver running in kernel mode needs to cause it. If you really want to do this, you can write a driver which exposes KeBugCheck to usermode.
为了导致 BSOD,在内核模式下运行的驱动程序需要导致它。如果您真的想这样做,您可以编写一个将 KeBugCheck 暴露给用户模式的驱动程序。
http://msdn.microsoft.com/en-us/library/ms801640.aspx
http://msdn.microsoft.com/en-us/library/ms801640.aspx
Thanks to Andrew below for pointing this utility out:
感谢下面的 Andrew 指出这个实用程序:
回答by Walden Leverich
If you kill the csrss process you'll get a blue-screen rather quickly.
如果您终止 csrss 进程,您将很快出现蓝屏。
回答by Dave Swersky
If you want to simulate a hard crash such as a bluescreen, you'd pretty much have to yank the power cord. NOT recommended.
如果您想模拟蓝屏等严重崩溃,您几乎必须拔掉电源线。不建议。
In case of a crash, anything not saved to persistent storage will be lost. If you want to simulate a crash for purposes of logging, write a "kill switch" into your logger, which stops the logging. Now you can simulate a crash by killing the logging and making sure you have the data you would have wanted in case of an actual crash.
如果发生崩溃,任何未保存到持久存储的内容都将丢失。如果您想模拟崩溃以记录日志,请将“终止开关”写入您的记录器,这将停止记录。现在,您可以通过终止日志记录并确保您拥有实际崩溃时需要的数据来模拟崩溃。
回答by Wim ten Brink
First of all, I would advise you to use a Virtual Machine to test this BSODon. This will allow you to keep a backup just in case the BSOD does some damage to the system. Here's a tip on how to generate a BSOD simply by pressing CTRL+SCROLLLOCK+SCROLLLOCK.
首先,我建议您使用虚拟机来测试此BSOD。这将允许您保留备份,以防万一 BSOD 对系统造成一些损害。这是有关如何通过按 CTRL+SCROLLLOCK+SCROLLLOCK来生成蓝屏死机的提示。
Is there a Windows API to generate one? No, according to this article. Still, if you would call certain API's with invalid data, they could still cause a crash inside the kernel, which would result in your BSOD.
是否有 Windows API 来生成一个?不,根据这篇文章。尽管如此,如果您使用无效数据调用某些 API,它们仍然可能导致内核崩溃,从而导致您的蓝屏死机。
回答by zapador
If you dont want to write code (driver, IOCTL...) you can use DiskCryptor. Note that no disk encrypting is need.
如果您不想编写代码(驱动程序、IOCTL...),您可以使用DiskCryptor。请注意,不需要磁盘加密。
Just need to install the driver:
只需要安装驱动程序:
dcinst.exe -setup
dcinst.exe -setup
And then generate a bsod using the DC console:
然后使用 DC 控制台生成一个 bsod:
dccon.exe -bsod
dccon.exe -bsod
回答by user956584
Run process as critic and exit http://waleedassar.blogspot.co.uk/2012/03/rtlsetprocessiscritical.html
以评论家身份运行进程并退出 http://waledassar.blogspot.co.uk/2012/03/rtlsetprocessiscritical.html
回答by tvanfosson
I'm not sure exactly what you'd be testing. Since your program runs periodically, surely it's enough to check that the information is being dumped at the frequency that you specify while the system is running? Are you checking that the information stays around after the blue screen? Depending on how you are dumping it (and whether you are flushing buffers), this may not be necessary.
我不确定你到底要测试什么。由于您的程序定期运行,因此在系统运行时检查信息是否以您指定的频率转储就足够了?您是否检查蓝屏后信息是否保留?根据您如何转储它(以及您是否正在刷新缓冲区),这可能不是必需的。