diff options
Diffstat (limited to 'winsup/mingw/samples/seh/sehfix.c')
-rw-r--r-- | winsup/mingw/samples/seh/sehfix.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/winsup/mingw/samples/seh/sehfix.c b/winsup/mingw/samples/seh/sehfix.c deleted file mode 100644 index be527ab0d..000000000 --- a/winsup/mingw/samples/seh/sehfix.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * sehfix.c - * - * A test program involving an exception handler that fixes the exception - * causing condition. - * - * In this code we install an exception handler my_handler and then a piece - * of inline assembly attempts to write at the address marked in eax, after - * setting eax to 10. This should produce an exception. The handler then - * changes the eax register of the exception context to be the address of - * a static variable and restarts the code. This should allow everything - * to continue. - */ - -#include <windows.h> -#include <excpt.h> - -#include "exutil.h" - -int x; - -EXCEPTION_DISPOSITION -my_handler ( - struct _EXCEPTION_RECORD* pExceptionRec, - void* pEstablisherFrame, - struct _CONTEXT* pContextRecord, - void* pDispatcherContext - ) -{ - printf ("In my exception handler!\n"); - DumpExceptionRecord (pExceptionRec); - pContextRecord->Eax = (DWORD) &x; - return ExceptionContinueExecution; -} - -main () -{ - x = 2; - - printf ("x = %d\n", x); - - WalkExceptionHandlers(); - - __try1(my_handler) - - WalkExceptionHandlers(); - - /* This assembly code should produce an exception. */ - __asm__("movl $10,%%eax;movl $1,(%%eax);" : : : "%eax"); - - __except1 - - WalkExceptionHandlers(); - - printf ("x = %d\n", x); - - printf ("Finished!\n"); -} - - |