views:

111

answers:

1

In the Windows Driver Kit (WDK) there are some driver code samples written in pure C, but sprinkled with some try-catch-finally constructs. Does someone know their semantics ? Thank you microsoft for your great tools and standards compliance.

Code extract from some_file.c:

try {
    ...
    if (!NT_SUCCESS( status )) {

       leave; // ???
    }
    ...
} finally {
    ...
}

try  {
    ...
} except( EXCEPTION_EXECUTE_HANDLER ) {
    ...
}
+1  A: 

The try/except handling in the WDK follows the SEH model used throughout windows. Notice that you can continue after catching an exception.

This model predated C++, so the C++ standard is not the same as the exception model used by Win32.

PS: C does not have exception handling, so SEH is a non-standard extension to C.

SEH exception handling in the MSDN

Introduction to SEH

Christopher
Do you know where I could read about this SEH Model?
clyfe
http://msdn.microsoft.com/en-us/library/ms680657%28VS.85%29.aspx
evilpie