My application has custom crash-handling built-in (see John Robbins' excellent book about "Debugging Windows Applications"). To test this functionality, I always used the Windows function DebugBreak() and this always worked perfectly. But since Windows 7, calling this function just says "A breakpoint has been reached" and stops the application without calling my crash handlers.
I could always put this code in my application to test the crash-functionality:
int *ptr = (int *)0xdeadbeef;
*ptr = 123456789;
Or even add several cases, just in case 0xdeadbeef is a valid address:
int *ptr = (int *)0xdeadbeef;
*ptr = 123456789;
ptr = (int *)0L;
*ptr = 123456789;
ptr = (int *)0xffffffff;
*ptr = 123456789;
But I was wondering: isn't there a cleaner way to crash your application under Windows?