To test this problem I have written a minimal windows application. If I force an access violation in the WM_PAINT
handler this exception never gets to the debugger. If started without debugger the access violation also does not show up. Usually you should get the Windows Error Reporting dialog.
Digging a bit deeper it seems that something in user32.dll catches all incoming exceptions. Is this normal behavior? Can I control this somehow? Isn't catching all exceptions a security risk? At least it is annoying as hell.
This is with a 32- and 64-bit application on Vista 64. On XP the exception seems to be handled as expected. Other windows messages have the same problem. Maybe all of them?
The WM_PAINT
handler:
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
*(int*)0 = 0;
EndPaint(hWnd, &ps);
break;