Does anyone know how to use this function (SetUnhandledExceptionFilter) in
Delphi ?
I try to use it but i dont succeeded.
More exactly : I try to override the default exception handler with my own,
but is seems like Delphi does not call this function when an error has
occured and is not included in an try..except statement. I have studied some
examples in VC++ and things are pretty clear about how to do this, but i did
not succeeded to make it work in Delphi.
PS : I dont want to use TApplication.OnException or
TApplicationEvents.OnException
Regards, Marius.
IIRC, Delphi uses Structured Exception Handling (SEH)
directly (via FS:[0]) and establishes an default
exception handler. See ErrorProc for more information.
- nico
ps: I recommend to NOT break the existing
exception handler chain by setting FS:[0]
Whoops, should be ExceptProc instead of ErrorProc.
Regards, Marius.
SetUnhandledExceptionFilter doesn't set the default exception handler,
it sets the lop level exception handler, which is a totally different
thing. This handler is only called, if no other handlers wants to handle
the exception.
The exception handler chain is internally built by the compiler. Each
try..except and try..finally statement temporarily adds a handler to the
exception chain.
Enough theory. What do you really want to achieve?
--
www.madshi.net
quality low level Delphi components
extended exception handling
API hooking, DLL injection
undocumented functionality
Regards, Marius.
uses madExcept;
procedure MariusExceptionHandler(...; bugReport: string; ...);
begin
// here you can with the bug report whatever you like
handled := true;
end;
intialization
RegisterExceptionHandler(MariusExceptionHandler);
end.
The bug report contains a full stack trace of all running threads and
lots of more information like a module list and such stuff. If you use
an exception handler like the one shown above (and better additionally
uncheck the option "show exception box"), all exceptions will be handled
silently. Even the TApplication.ShowException and SysUtils.ShowException
methods are reverted to madExcept.
Here are links to the online documentation, to the direct download of
the latest (beta) version and to a little demo:
http://help.madshi.net/madExcept.htm
http://madshi.bei.t-online.de/madCollectionBeta.exe
http://madshi.net/ExcCatch.zip
Regards, Marius.