Assembly Language for Beginners

(nextflipdebug2) #1

6.5. WINDOWS NT


6.5.3 Windows SEH.


Let’s forget about MSVC


InWindows, theSEHisintendedforexceptionshandling, nevertheless, itislanguage-agnostic, notrelated
to C++ orOOPin any way.


Here we are going to take a look atSEHin its isolated (from C++ and MSVC extensions) form.


Each running process has a chain ofSEHhandlers, eachTIBhas the address of the most recently defined
handler.


When an exception occurs (division by zero, incorrect address access, user exception triggered by calling
theRaiseException()function), theOSfinds the last handler in theTIBand calls it, passing exception
kind and all information about theCPUstate (register values, etc.) at the moment of the exception.


The exception handler considering the exception, does it see something familiar? If so, it handles the
exception.


If not, it signals to theOSthat it cannot handle it and theOScalls the next handler in the chain, until a
handler which is able to handle the exception is be found.


At the very end of the chain there a standard handler that shows the well-known dialog box, informing the
user about a process crash, some technical information about theCPUstate at the time of the crash, and
offering to collect all information and send it to developers in Microsoft.


Figure 6.2:Windows XP
Free download pdf