How code catches exceptions (try, catch(…))?
push 0FFFFFFFFh
...
mov eax, dword ptr fs:[00000000h]
...
mov dword ptr fs:[00000000h],eax
mov dword ptr [ebp-10h],esp
What this code mean in “head” of function, which catches exceptions?
mov dword ptr [ebp-4], 0
And this (in head of “try”)? Function does not have any local variables.
Function:
int SUM(int a, int b)
{
try{}
catch(...){}
return 0;
}
What store in FS segment?
The value stored in
fs:[0]is a pointer to a linked list ofEXCEPTION_REGISTRATIONstructures. Read here for more details:A Crash Course on the Depths of Win32 Structured Exception Handling, MSJ January 1997