Disable exception handling and let windows catch it?

delphi, exception

Solution

You can set `JITEnable` to '1' or higher (default is '0'). With '1', non native exceptions, with higher than '1', all exceptions will be handled by JIT or WER (depending on the system).

This may not be what you want though. With this solution any qualifying exception will be passed to the OS, it doesn't matter if they're handled in code or not. Clarification (run outside the debugger):

procedure TForm1.Button1Click(Sender: TObject);
begin
  raise EAccessViolation.Create('access denied');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  try
    PInteger(0)^ := 0;
  except
  end;
end;

initialization
  JITEnable := 1;

The first example is a native exception, it will be handled by the application exception handling mechanism when `JITEnable` is 1. But the second example will trigger JIT/WER.

Problem

I want to disable the exception catching by Delphi and let Windows catch it - making it produce a window like "AppName crashed. Debug , Send", add this to Application events, create a memory dump and so on. By default, Delphi catches all the exception in TApplication.Run procedure... How can I avoid that without modifying Forms.pas?

Original source