IT lexicon › Programming › Structured Exception Handling (SEH)

Structured Exception Handling (SEH)

Programming På svenska → Updated: 2026-11-06

Windows' own exception mechanism, in which hardware faults such as null-pointer dereferences and a program's own errors are caught with __try and __except.

SEH arrived with Windows NT in 1993 and lives in the operating system rather than the language. An access violation, a division by zero and a C++ throw all go through the same machinery; MSVC builds its C++ exceptions on top of it. The filter in __except runs before the stack is unwound and can choose to handle the fault, pass it on, or even resume at the instruction that failed.

On 32-bit x86 the handlers sit in a linked list on the stack, headed at FS:[0]. That made SEH an exploit favorite: overwrite a record with a buffer overflow and the next exception jumps wherever you like. SafeSEH and later SEHOP closed the hole. On x64 the model is table-based, with unwind data in .pdata and .xdata, and the on-stack list is gone.

← Back to the lexicon