Jacek Caban | a20beb4 | 2025-04-11 23:19:27 +0200 | [diff] [blame^] | 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 | */ |
| 6 | |
| 7 | #undef __MSVCRT_VERSION__ |
| 8 | #define _UCRT |
| 9 | |
| 10 | #include <setjmp.h> |
| 11 | #include <windef.h> |
| 12 | #include <winbase.h> |
| 13 | |
| 14 | void __cdecl longjmp( jmp_buf b, int retval ) |
| 15 | { |
| 16 | _JUMP_BUFFER *buf = (_JUMP_BUFFER *)b; |
| 17 | EXCEPTION_RECORD rec; |
| 18 | |
| 19 | if (!retval) retval = 1; |
| 20 | |
| 21 | rec.ExceptionCode = STATUS_LONGJUMP; |
| 22 | rec.ExceptionFlags = 0; |
| 23 | rec.ExceptionRecord = NULL; |
| 24 | rec.ExceptionAddress = NULL; |
| 25 | rec.NumberParameters = 1; |
| 26 | rec.ExceptionInformation[0] = (DWORD_PTR)buf; |
| 27 | RtlUnwind( (void *)buf->Frame, (void *)buf->Rip, &rec, IntToPtr(retval) ); |
| 28 | } |
| 29 | |
| 30 | void (__cdecl *__MINGW_IMP_SYMBOL(longjmp))( jmp_buf b, int retval ) = longjmp; |