views:

135

answers:

5

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.

+1  A: 

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.

Billy ONeal
It's difficult enough that my first two attempts couldn't do it. KevinK's idea, referencing address 0x00000000 worked.
Ian Boyd
And you seem to be right, the memory dumps, on XP, vanish once sent. Vista keeps them, as part of the **Problem Reports and Solutions Center**.
Ian Boyd
+2  A: 

Should be a good start:

int main(int argc, char* argv[])
{
   char *pointer = NULL;
   printf("crash please %s", *pointer);
   return 0;
}
KevenK
Might want to set the pointer to something other than NULL as it's likely printf checks for that. 0xDEADBEEF perhaps?
Billy ONeal
i used your idea, i cast null to an object, then began calling methods. *boom*
Ian Boyd
@Billy ONeal: It's really not `printf` that's crashing, it's the attempt to dereference a null pointer. `printf` was just to be cute, `char *pointer = NULL; char crash = *pointer;` would have worked just as well.
KevenK
@KevenK: Ah, yes. I missed that little * character :)
Billy ONeal
A: 

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

David
That just throws an exception. It doesn't crash on Win32. (Note that I don't mean C++ exceptions, I mean Win32 SEH)
Billy ONeal
A: 
void crash(void)
{
    char* a = 0;
    *a = 0;
}
Steve Hanov
+4  A: 

You guys are all so verbose! :-)

Here's a compact way to do it:

*((int*)0)=0;
Will Dean
lol... crash efficiently?
Mark
:-) You should see how fast my idle loops run too...
Will Dean