nv3prasad
asked on
Hook For All exceptions in my application...
Is there any way that I can trap all my Application Exceptions before anyother handler could handle it.
Want a detailed explanation.
Want a detailed explanation.
But this hooks unhandled exceptions. Your function will be alled only when there is no handler. nv3prasad wanted a crack ant every exception before any other handler had a chance.
..B ekiM
..B ekiM
Thanx for the reminder, Mike...
Should have remembered the good ol' "Think before you post an answer" rule ;-)
Should have remembered the good ol' "Think before you post an answer" rule ;-)
This might do the job, however.
What exceptions are handled already that SetUnhandledExceptionFilte r won't catch?
(I don't know, I'm just curious about this. I've used SetUnhandledExceptionFilte r and it catches most errors that occur in a running app.)
What exceptions are handled already that SetUnhandledExceptionFilte
(I don't know, I'm just curious about this. I've used SetUnhandledExceptionFilte
You're right jhance, but
__try
{
char* pc=NULL;
*pc='a';
}
__except(EXCEPTION_EXECUTE _HANDLER)
{
}
would handle the exception before it reaches the filter...
__try
{
char* pc=NULL;
*pc='a';
}
__except(EXCEPTION_EXECUTE
{
}
would handle the exception before it reaches the filter...
As jkr implies, any exception which is actually handled won't reach your installed handler. nv3prasad wanted something to get all exceptions, handled or not.
..B ekiM
..B ekiM
ASKER
Adjusted points to 100
ASKER
mikeblas has got my point!
Can anyone provide me a way where I can give the first try to all possible exceptions?
Thank you Mike
Prasad
Can anyone provide me a way where I can give the first try to all possible exceptions?
Thank you Mike
Prasad
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> Only debuggers can do that.
Now we're getting somewhere!
Aside from writing a debugger to monitor your process, your only other alternative is to write a DLL that replaces and watches the RaiseException() API.
..B ekiM
Now we're getting somewhere!
Aside from writing a debugger to monitor your process, your only other alternative is to write a DLL that replaces and watches the RaiseException() API.
..B ekiM
ASKER
I think Jkr has thrown a lot of light on this and also I thank Mike for his valuable suggestions.
I accept jkr's comment as the answer.
I accept jkr's comment as the answer.
LONG WINAPI __XceptFilter ( EXCEPTION_POINTERS* pExp)
{
LONG lnRC = EXCEPTION_EXECUTE_HANDLER;
TRACE3 ( "__XceptFilter(): got exception, code == 0x%x @ 0x%x, flags == 0x%x\r\n",
pExp->ExceptionRecord->Exc
( DWORD) pExp->ExceptionRecord->Exc
pExp->ExceptionRecord->Exc
);
return( lnRC);
}
// in your code:
SetUnhandledExceptionFilte
By calling this API, your function replaces 'UnhandledExceptionFilter(