Win32:如何崩溃?

发布于 2024-08-30 10:04:09 字数 338 浏览 5 评论 0原文

我正在尝试找出 Windows 错误报告的保存位置;我今天早些时候点击了发送,但我忘记了我想要“查看详细信息”,以便我可以检查内存小型转储。

但我找不到它们的存储位置(谷歌也不知道)。

所以我想编写一个会崩溃的虚拟应用程序,显示 WER 对话框,让我单击“查看详细信息”,这样我就可以到达保存转储的文件夹。

我怎样才能在 Windows 上崩溃?

编辑:我问的原因是因为我尝试过堆栈溢出和浮点除以零。 Stack Overflow 使应用程序消失,但没有弹出 WER 对话框。浮点除以零会产生 +INF,但没有例外,也没有崩溃。

i'm trying to figure out where Windows Error Reports are saved; i hit Send on some earlier today, but i forgot that i want to "view the details" so i can examine the memory minidumps.

But i cannot find where they are stored (and google doesn't know).

So i want to write a dummy application that will crash, show the WER dialog, let me click "view the details" so i can get to the folder where the dumps are saved.

How can i crash on Windows?

Edit: The reason i ask is because i've tried overflowing the stack, and floating point dividing by zero. Stack Overflow makes the app vanish, but no WER dialog popped up. Floating point division by zero results in +INF, but no exception, and no crash.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

挽你眉间 2024-09-06 10:04:09

你们都太啰嗦了! :-)

这是一种紧凑的方法:

*((int*)0)=0;

You guys are all so verbose! :-)

Here's a compact way to do it:

*((int*)0)=0;
笛声青案梦长安 2024-09-06 10:04:09

应该是一个好的开始:

int main(int argc, char* argv[])
{
   char *pointer = NULL;
   printf("crash please %s", *pointer);
   return 0;
}

Should be a good start:

int main(int argc, char* argv[])
{
   char *pointer = NULL;
   printf("crash please %s", *pointer);
   return 0;
}
看海 2024-09-06 10:04:09

您假设内存转储仍然存在。一旦发送,据我所知转储将从机器中删除。

转储本身应该位于 %TEMP% 中的某个位置。

至于崩溃,这并不难,只需做一些导致段错误的事情即可。

You are assuming the memory dumps are still around. Once they are sent, AFAIK the dumps are deleted from the machine.

The dumps themselves should be located in %TEMP% somewhere.

As far as crashing, that's not difficult, just do something that causes a segfault.

幻梦 2024-09-06 10:04:09
void crash(void)
{
    char* a = 0;
    *a = 0;
}
void crash(void)
{
    char* a = 0;
    *a = 0;
}
你对谁都笑 2024-09-06 10:04:09

不确定这是否会触发错误报告对话框,但您可以尝试除以零。

Not sure if this will trigger the Error Reporting dialog, but you could try division by zero.

初懵 2024-09-06 10:04:09

官方支持的故意触发崩溃的方法可以在这里找到:

http://msdn.microsoft.com/en-us/library/ff545484(v=VS.85).aspx

基本上:

对于 USB 键盘,您必须启用
键盘引发的崩溃
注册表。在注册表项中
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\kbdhid\Parameters,
创建一个名为
CrashOnCtrlScroll,并将其设置为等于
REG_DWORD 值为 0x01。

然后:

您必须重新启动系统才能执行这些操作
设置生效。

完成后,键盘
可以通过使用来启动崩溃
以下热键序列:按住
最右边的 CTRL 键,然后按
按 SCROLL LOCK 键两次。

无需编程;)这里无需重新发明轮子:)

The officially-supported ways to trigger a crash on purpose can be found here:

http://msdn.microsoft.com/en-us/library/ff545484(v=VS.85).aspx

Basically:

With USB keyboards, you must enable
the keyboard-initiated crash in the
registry. In the registry key
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\kbdhid\Parameters,
create a value named
CrashOnCtrlScroll, and set it equal to
a REG_DWORD value of 0x01.

Then:

You must restart the system for these
settings to take effect.

After this is completed, the keyboard
crash can be initiated by using the
following hotkey sequence: Hold down
the rightmost CTRL key, and press the
SCROLL LOCK key twice.

No programming necessary ;) No wheel reinvention here :)

云淡风轻 2024-09-06 10:04:09

了解如何使 Windows 崩溃很有趣。但为什么不先看

%allusersprofile%\Application Data\Microsoft\Dr Watson\ 

一下呢?还要注意特定于应用程序的崩溃数据文件夹,我发现例如

...\FirefoxPortable\Data\profile\minidumps\ 

...\OpenOfficePortable\Data\settings\user\crashdata\.

Interesting to know how to crash Windows. But why not have a look at

%allusersprofile%\Application Data\Microsoft\Dr Watson\ 

first? Look out for application specific crashdata folders as well, I found e.g.

...\FirefoxPortable\Data\profile\minidumps\ 

and

...\OpenOfficePortable\Data\settings\user\crashdata\.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文