MathewMickle
December 1st, 2009, 02:01
I wrote the following code to learn Exception,
DWORD ExceptionHandler(void)
{
printf("Exception handler!\n"
;
ExitProcess(1);
}
void CreateException(char * input)
{
int zero=0;
__asm int 3
__try
{
zero=1/zero;
}
__except(Exceptionhandler()){}
}
When the code runs at the statement "zero=1/zero;", Ollydbg shows the message: "use shift+F7/F8/F9 to pass exception to program".
However, when I press these shortcuts, Ollydbg doesn't pass the exception to the ExceptionHandler function, but to run instructions in ntdll.dll.
Why does the situation happen?
How can the code directly run into the ExceptionHandler function at the statement "zero=1/zero;" when I press these hot keys(e.g. shift+/F8)?
PS. "Debugging options"-> "Exceptions": only "Ignore memory access violations in KERNEL32" enabled
DWORD ExceptionHandler(void)
{
printf("Exception handler!\n"

ExitProcess(1);
}
void CreateException(char * input)
{
int zero=0;
__asm int 3
__try
{
zero=1/zero;
}
__except(Exceptionhandler()){}
}
When the code runs at the statement "zero=1/zero;", Ollydbg shows the message: "use shift+F7/F8/F9 to pass exception to program".
However, when I press these shortcuts, Ollydbg doesn't pass the exception to the ExceptionHandler function, but to run instructions in ntdll.dll.
Why does the situation happen?
How can the code directly run into the ExceptionHandler function at the statement "zero=1/zero;" when I press these hot keys(e.g. shift+/F8)?
PS. "Debugging options"-> "Exceptions": only "Ignore memory access violations in KERNEL32" enabled