There are 2 reasons why the EXCEPTION_ARRAY_BOUNDS_EXCEEDED is no catching by the hook function set to the PROP:LastChanceHook property:
- The RTL exception handler filters some exceptions and returns DISPOSITION_CONTINUE_SEARCH before showing them to the hook function and to the RTL internal exception stuff. Exceptions which are filtered are debug exceptions (e.g. EXCEPTION_BREAKPOINT) to allow the debugger do its work, known .NET internal exceptions - otherwise the AppGen could not work, and some others. Also, there are exceptions which the RTL is processing internally only without invoking the hook function.
- Windows not passes some exceptions to the SEH handlers chain. The EXCEPTION_ARRAY_BOUNDS_EXCEEDED exception is among them. Such exceptions can be caught using another mechanism: vectored exception handling. The RTL uses VEH but not to catch EXCEPTION_ARRAY_BOUNDS_EXCEEDED. Also, it’s need to call the SetErrorMode function with the SEM_NOGPFAULTERRORBOX parameter to turn off default processing of such exceptions.
I could modify my variant of the RTL to allow catch exceptions initiated by program’s components by calling to RaiseException. It’s need to divide the exception filter function to two parts: one is calling before invoking possible hook function and other one - after. Also, I could route all exceptions caught by VEH mechanism to main exception stuff. Some time is required for that.
I do not see reasons for that.