Assembly Language for Beginners

(nextflipdebug2) #1

6.5. WINDOWS NT


*ExceptionCode = ExceptionPointer->ExceptionRecord->ExceptionCode;

if ( (*ExceptionCode == STATUS_IN_PAGE_ERROR) &&
(ExceptionPointer->ExceptionRecord->NumberParameters >= 3) ) {

*ExceptionCode = (NTSTATUS) ExceptionPointer->ExceptionRecord->ExceptionInformation[2];
}

ASSERT( !NT_SUCCESS(*ExceptionCode) );

return EXCEPTION_EXECUTE_HANDLER;
}


Internally,SEHisanextensionoftheOS-supportedexceptions. Butthehandlerfunctionis_except_handler3
(for SEH3) or_except_handler4(for SEH4).


The code of this handler is MSVC-related, it is located in its libraries, or in msvcr*.dll. It is very important
to know that SEH is a MSVC thing.


Other win32-compilers may offer something completely different.


SEH3


SEH3 has_except_handler3as a handler function, and extends the_EXCEPTION_REGISTRATIONtable,
adding a pointer to thescope tableandprevious try levelvariable. SEH4 extends thescope tableby 4
values for buffer overflow protection.


Thescope tableis a table that consists of pointers to the filter and handler code blocks, for each nested
level oftry/except.

Free download pdf