开发者

Win32: How to crash?

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.


You guys are all so verbose! :-)

Here's a compact way to do it:

*((int*)0)=0;


Should be a good start:

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


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.


void crash(void)
{
    char* a = 0;
    *a = 0;
}


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


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


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\.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜