6.5. WINDOWS NT
FS:0 +0: __except_list+4: ...+8: ...TIB...Prev=0xFFFFFFFFHandle...PrevHandle...PrevHandlescope tableprevious try levelEBPhandler functionhandler function_except_handler3...Stack0xFFFFFFFF (-1)filter functionhandler/finally function0filter functionhandler/finally function1filter functionhandler/finally function... more entries ...information about
first try/except
blockinformation about
second try/except
blockinformation about
third try/except
blockscope tableAgain, it is very important to understand that theOStakes care only of theprev/handlefields, and nothing
more.
It is the job of the_except_handler3function to read the other fields andscope table, and decide which
handler to execute and when.
The source code of the_except_handler3function is closed.However, Sanos OS, which has a win32 compatibility layer, has the same functions reimplemented, which
are somewhat equivalent to those in Windows^46. Another reimplementation is present in Wine^47 and
ReactOS^48.
If thefilterpointer is NULL, thehandlerpointer is the pointer to thefinallycode block.
During execution, theprevious try levelvalue in the stack changes, so_except_handler3can get in-
formation about the current level of nestedness, in order to know whichscope tableentry to use.
SEH3: one try/except block example
#include <stdio.h>
#include <windows.h>
#include <excpt.h>
int main()
{
int* p = NULL;
(^46) http://go.yurichev.com/17058
(^47) GitHub
(^48) http://go.yurichev.com/17060