PDA

View Full Version : Exceptional Help? (Pun intended)


FrankRizzo
August 18th, 2008, 19:42
I'm writing a module using the Debug API that catches an ACCESS_VIOLATION exception from the "slave" program. I pass along the "DBG_EXCEPTION_NOT_HANDLED" response, and my slave program exits dutifully.

When I run the slave app in Olly, it throws the same exception, and I chose the F7 option to return the exception to the app. When I do THIS, it goes along as if nothing happened!

What value is Olly returning that causes it to be happy?

Can I do the same thing?

Anyone?

Arcane
August 19th, 2008, 06:24
http://www.thebestpageintheuniverse.net/c.cgi?u=puns

FrankRizzo
August 19th, 2008, 20:33
First off, Arcane, bite me.

Now, back on topic.

If you read the documentation on the ContinueDebugEvent, it states that there are only *2* values that you can pass to it. THIS IS INCORRECT!

After a little digging, I found the list of "acceptable" values:

Code:
#define DBG_CONTINUE 0x00010002
#define DBG_TERMINATE_THREAD 0x40010003
#define DBG_TERMINATE_PROCESS 0x40010004
#define DBG_CONTROL_C 0x40010005
#define DBG_CONTROL_BREAK 0x40010008
#define DBG_EXCEPTION_NOT_HANDLED 0x80010001


And as it turns out, Olly was noticing that the exception came from a thread spawned by the main program, so it was responding with DBG_TERMINATE_THREAD. When I put that in my code, it works!

And the world is a better place as a result.