From 6a40ff730c41fcf75537d8587b67e3acfcc2942b Mon Sep 17 00:00:00 2001 From: sergei Date: Fri, 29 Nov 2013 14:23:46 +0000 Subject: [PATCH] * In preparation to support SEH on Win32, moved definitions that apply to Win32 from seh64.inc into syswin.inc. git-svn-id: trunk@26153 - --- rtl/win/syswin.inc | 31 +++++++++++++++++++++++++++++++ rtl/win64/seh64.inc | 25 +++---------------------- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/rtl/win/syswin.inc b/rtl/win/syswin.inc index d35ec431cf..a09da621cd 100644 --- a/rtl/win/syswin.inc +++ b/rtl/win/syswin.inc @@ -81,10 +81,23 @@ const STATUS_FLOAT_MULTIPLE_TRAPS = $C00002B5; STATUS_REG_NAT_CONSUMPTION = $C00002C9; + { Exceptions raised by RTL use this code } + FPC_EXCEPTION_CODE = $E0465043; + EXCEPTION_EXECUTE_HANDLER = 1; EXCEPTION_CONTINUE_EXECUTION = -1; EXCEPTION_CONTINUE_SEARCH = 0; + { exception flags (not everything applies to Win32!) } + EXCEPTION_NONCONTINUABLE = $01; + EXCEPTION_UNWINDING = $02; + EXCEPTION_EXIT_UNWIND = $04; + EXCEPTION_STACK_INVALID = $08; + EXCEPTION_NESTED_CALL = $10; + EXCEPTION_TARGET_UNWIND = $20; + EXCEPTION_COLLIDED_UNWIND = $40; + + CONTEXT_X86 = $00010000; CONTEXT_CONTROL = CONTEXT_X86 or $00000001; CONTEXT_INTEGER = CONTEXT_X86 or $00000002; @@ -97,6 +110,24 @@ const MAXIMUM_SUPPORTED_EXTENSION = 512; +type + EXCEPTION_DISPOSITION=( + ExceptionContinueExecution, + ExceptionContinueSearch, + ExceptionNestedException, + ExceptionCollidedUnwind + ); + + TUnwindProc=procedure(frame: PtrUInt); + +procedure RaiseException( + dwExceptionCode: DWORD; + dwExceptionFlags: DWORD; + dwArgCount: DWORD; + lpArguments: Pointer); // msdn: *ULONG_PTR + stdcall; external 'kernel32.dll' name 'RaiseException'; + + {***************************************************************************** Parameter Handling *****************************************************************************} diff --git a/rtl/win64/seh64.inc b/rtl/win64/seh64.inc index c4411d6b44..33e0d55969 100644 --- a/rtl/win64/seh64.inc +++ b/rtl/win64/seh64.inc @@ -15,14 +15,8 @@ { exception flags } const - EXCEPTION_NONCONTINUABLE = $01; - EXCEPTION_UNWINDING = $02; - EXCEPTION_EXIT_UNWIND = $04; - EXCEPTION_STACK_INVALID = $08; - EXCEPTION_NESTED_CALL = $10; - EXCEPTION_TARGET_UNWIND = $20; - EXCEPTION_COLLIDED_UNWIND = $40; - EXCEPTION_UNWIND = $66; + EXCEPTION_UNWIND = EXCEPTION_UNWINDING or EXCEPTION_EXIT_UNWIND or + EXCEPTION_TARGET_UNWIND or EXCEPTION_COLLIDED_UNWIND; UNWIND_HISTORY_TABLE_SIZE = 12; @@ -109,12 +103,6 @@ type IntegerContext: array[0..15] of PQWord; end; - EXCEPTION_DISPOSITION=( - ExceptionContinueExecution, - ExceptionContinueSearch, - ExceptionNestedException, - ExceptionCollidedUnwind - ); PExceptionPointers = ^TExceptionPointers; TExceptionPointers = record @@ -204,17 +192,10 @@ procedure RtlUnwindEx( HistoryTable: PUNWIND_HISTORY_TABLE); external 'kernel32.dll' name 'RtlUnwindEx'; -procedure RaiseException( - dwExceptionCode: DWORD; - dwExceptionFlags: DWORD; - dwArgCount: DWORD; - lpArguments: Pointer); // msdn: *ULONG_PTR - external 'kernel32.dll' name 'RaiseException'; { FPC specific stuff } {$ifdef FPC_USE_WIN64_SEH} const - FPC_EXCEPTION_CODE=$E0465043; SCOPE_FINALLY=0; SCOPE_CATCHALL=1; SCOPE_IMPLICIT=2; @@ -237,7 +218,7 @@ type RvaHandler: DWord; end; - TUnwindProc=procedure(frame: QWord); + TExceptObjProc=function(code: Longint; const rec: TExceptionRecord): Pointer; { Exception } TExceptClsProc=function(code: Longint): Pointer; { ExceptClass }