ntdll: Move some exception definitions to winnt.h.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-08-19 13:14:33 +02:00
parent 448ba921be
commit 44a6043388
6 changed files with 129 additions and 124 deletions

View File

@ -40,29 +40,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(seh); WINE_DEFAULT_DEBUG_CHANNEL(seh);
struct _DISPATCHER_CONTEXT;
typedef LONG (WINAPI *PC_LANGUAGE_EXCEPTION_HANDLER)(EXCEPTION_POINTERS *ptrs, DWORD frame);
typedef EXCEPTION_DISPOSITION (WINAPI *PEXCEPTION_ROUTINE)(EXCEPTION_RECORD *rec, DWORD frame,
CONTEXT *context,
struct _DISPATCHER_CONTEXT *dispatch);
typedef struct _DISPATCHER_CONTEXT
{
DWORD ControlPc;
DWORD ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
DWORD EstablisherFrame;
DWORD TargetPc;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
DWORD ScopeIndex;
BOOLEAN ControlPcIsUnwound;
PBYTE NonVolatileRegisters;
DWORD VirtualVfpHead;
} DISPATCHER_CONTEXT;
/********************************************************************* /*********************************************************************
* __CxxExceptionFilter (MSVCRT.@) * __CxxExceptionFilter (MSVCRT.@)

View File

@ -41,29 +41,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(seh); WINE_DEFAULT_DEBUG_CHANNEL(seh);
struct _DISPATCHER_CONTEXT;
typedef LONG (WINAPI *PC_LANGUAGE_EXCEPTION_HANDLER)( EXCEPTION_POINTERS *ptrs, ULONG64 frame );
typedef EXCEPTION_DISPOSITION (WINAPI *PEXCEPTION_ROUTINE)( EXCEPTION_RECORD *rec,
ULONG64 frame,
CONTEXT *context,
struct _DISPATCHER_CONTEXT *dispatch );
typedef struct _DISPATCHER_CONTEXT
{
DWORD64 ControlPc;
DWORD64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
DWORD64 EstablisherFrame;
DWORD64 TargetPc;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
DWORD ScopeIndex;
BOOLEAN ControlPcIsUnwound;
PBYTE NonVolatileRegisters;
} DISPATCHER_CONTEXT;
/********************************************************************* /*********************************************************************
* __CxxExceptionFilter (MSVCRT.@) * __CxxExceptionFilter (MSVCRT.@)

View File

@ -39,28 +39,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(seh); WINE_DEFAULT_DEBUG_CHANNEL(seh);
struct _DISPATCHER_CONTEXT;
typedef LONG (WINAPI *PC_LANGUAGE_EXCEPTION_HANDLER)( EXCEPTION_POINTERS *ptrs, ULONG64 frame );
typedef EXCEPTION_DISPOSITION (WINAPI *PEXCEPTION_ROUTINE)( EXCEPTION_RECORD *rec,
ULONG64 frame,
CONTEXT *context,
struct _DISPATCHER_CONTEXT *dispatch );
typedef struct _DISPATCHER_CONTEXT
{
ULONG64 ControlPc;
ULONG64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
ULONG64 EstablisherFrame;
ULONG64 TargetIp;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
ULONG ScopeIndex;
} DISPATCHER_CONTEXT;
typedef struct typedef struct
{ {
int prev; int prev;

View File

@ -75,29 +75,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(seh); WINE_DEFAULT_DEBUG_CHANNEL(seh);
WINE_DECLARE_DEBUG_CHANNEL(relay); WINE_DECLARE_DEBUG_CHANNEL(relay);
struct _DISPATCHER_CONTEXT;
typedef LONG (WINAPI *PC_LANGUAGE_EXCEPTION_HANDLER)( EXCEPTION_POINTERS *ptrs, ULONG64 frame );
typedef EXCEPTION_DISPOSITION (WINAPI *PEXCEPTION_ROUTINE)( EXCEPTION_RECORD *rec,
ULONG64 frame,
CONTEXT *context,
struct _DISPATCHER_CONTEXT *dispatch );
typedef void (WINAPI *TERMINATION_HANDLER)( ULONG flags, ULONG64 frame );
typedef struct _DISPATCHER_CONTEXT
{
ULONG64 ControlPc;
ULONG64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
ULONG64 EstablisherFrame;
ULONG64 TargetIp;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
ULONG ScopeIndex;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
typedef struct _SCOPE_TABLE typedef struct _SCOPE_TABLE
{ {
ULONG Count; ULONG Count;
@ -2619,7 +2596,7 @@ static DWORD call_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCHER_C
TRACE( "calling handler %p (rec=%p, frame=0x%lx context=%p, dispatch=%p)\n", TRACE( "calling handler %p (rec=%p, frame=0x%lx context=%p, dispatch=%p)\n",
dispatch->LanguageHandler, rec, dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch ); dispatch->LanguageHandler, rec, dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
res = dispatch->LanguageHandler( rec, dispatch->EstablisherFrame, context, dispatch ); res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, context, dispatch );
TRACE( "handler at %p returned %u\n", dispatch->LanguageHandler, res ); TRACE( "handler at %p returned %u\n", dispatch->LanguageHandler, res );
__wine_pop_frame( &frame ); __wine_pop_frame( &frame );
@ -3990,7 +3967,7 @@ static DWORD call_unwind_handler( EXCEPTION_RECORD *rec, DISPATCHER_CONTEXT *dis
TRACE( "calling handler %p (rec=%p, frame=0x%lx context=%p, dispatch=%p)\n", TRACE( "calling handler %p (rec=%p, frame=0x%lx context=%p, dispatch=%p)\n",
dispatch->LanguageHandler, rec, dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch ); dispatch->LanguageHandler, rec, dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
res = dispatch->LanguageHandler( rec, dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch ); res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
TRACE( "handler %p returned %x\n", dispatch->LanguageHandler, res ); TRACE( "handler %p returned %x\n", dispatch->LanguageHandler, res );
__wine_pop_frame( &frame.frame ); __wine_pop_frame( &frame.frame );
@ -4359,14 +4336,14 @@ void WINAPI _local_unwind( void *frame, void *target_ip )
* __C_specific_handler (NTDLL.@) * __C_specific_handler (NTDLL.@)
*/ */
EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec, EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
ULONG64 frame, void *frame,
CONTEXT *context, CONTEXT *context,
struct _DISPATCHER_CONTEXT *dispatch ) struct _DISPATCHER_CONTEXT *dispatch )
{ {
SCOPE_TABLE *table = dispatch->HandlerData; SCOPE_TABLE *table = dispatch->HandlerData;
ULONG i; ULONG i;
TRACE( "%p %lx %p %p\n", rec, frame, context, dispatch ); TRACE( "%p %p %p %p\n", rec, frame, context, dispatch );
if (TRACE_ON(seh)) dump_scope_table( dispatch->ImageBase, table ); if (TRACE_ON(seh)) dump_scope_table( dispatch->ImageBase, table );
if (rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)) if (rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
@ -4376,7 +4353,7 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
if (dispatch->ControlPc >= dispatch->ImageBase + table->ScopeRecord[i].BeginAddress && if (dispatch->ControlPc >= dispatch->ImageBase + table->ScopeRecord[i].BeginAddress &&
dispatch->ControlPc < dispatch->ImageBase + table->ScopeRecord[i].EndAddress) dispatch->ControlPc < dispatch->ImageBase + table->ScopeRecord[i].EndAddress)
{ {
TERMINATION_HANDLER handler; PTERMINATION_HANDLER handler;
if (table->ScopeRecord[i].JumpTarget) continue; if (table->ScopeRecord[i].JumpTarget) continue;
@ -4387,11 +4364,11 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
break; break;
} }
handler = (TERMINATION_HANDLER)(dispatch->ImageBase + table->ScopeRecord[i].HandlerAddress); handler = (PTERMINATION_HANDLER)(dispatch->ImageBase + table->ScopeRecord[i].HandlerAddress);
dispatch->ScopeIndex = i+1; dispatch->ScopeIndex = i+1;
TRACE( "calling __finally %p frame %lx\n", handler, frame ); TRACE( "calling __finally %p frame %p\n", handler, frame );
handler( 1, frame ); handler( TRUE, frame );
} }
} }
return ExceptionContinueSearch; return ExceptionContinueSearch;
@ -4406,12 +4383,12 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
if (table->ScopeRecord[i].HandlerAddress != EXCEPTION_EXECUTE_HANDLER) if (table->ScopeRecord[i].HandlerAddress != EXCEPTION_EXECUTE_HANDLER)
{ {
EXCEPTION_POINTERS ptrs; EXCEPTION_POINTERS ptrs;
PC_LANGUAGE_EXCEPTION_HANDLER filter; PEXCEPTION_FILTER filter;
filter = (PC_LANGUAGE_EXCEPTION_HANDLER)(dispatch->ImageBase + table->ScopeRecord[i].HandlerAddress); filter = (PEXCEPTION_FILTER)(dispatch->ImageBase + table->ScopeRecord[i].HandlerAddress);
ptrs.ExceptionRecord = rec; ptrs.ExceptionRecord = rec;
ptrs.ContextRecord = context; ptrs.ContextRecord = context;
TRACE( "calling filter %p ptrs %p frame %lx\n", filter, &ptrs, frame ); TRACE( "calling filter %p ptrs %p frame %p\n", filter, &ptrs, frame );
switch (filter( &ptrs, frame )) switch (filter( &ptrs, frame ))
{ {
case EXCEPTION_EXECUTE_HANDLER: case EXCEPTION_EXECUTE_HANDLER:
@ -4423,7 +4400,7 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
} }
} }
TRACE( "unwinding to target %lx\n", dispatch->ImageBase + table->ScopeRecord[i].JumpTarget ); TRACE( "unwinding to target %lx\n", dispatch->ImageBase + table->ScopeRecord[i].JumpTarget );
RtlUnwindEx( (void *)frame, (char *)dispatch->ImageBase + table->ScopeRecord[i].JumpTarget, RtlUnwindEx( frame, (char *)dispatch->ImageBase + table->ScopeRecord[i].JumpTarget,
rec, 0, dispatch->ContextRecord, dispatch->HistoryTable ); rec, 0, dispatch->ContextRecord, dispatch->HistoryTable );
} }
} }

View File

@ -84,20 +84,6 @@ typedef struct
} ScopeRecord[1]; } ScopeRecord[1];
} SCOPE_TABLE; } SCOPE_TABLE;
typedef struct
{
ULONG64 ControlPc;
ULONG64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
ULONG64 EstablisherFrame;
ULONG64 TargetIp;
PCONTEXT ContextRecord;
void* /*PEXCEPTION_ROUTINE*/ LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
ULONG ScopeIndex;
} DISPATCHER_CONTEXT;
typedef struct _SETJMP_FLOAT128 typedef struct _SETJMP_FLOAT128
{ {
unsigned __int64 DECLSPEC_ALIGN(16) Part[2]; unsigned __int64 DECLSPEC_ALIGN(16) Part[2];

View File

@ -904,6 +904,16 @@ typedef enum _HEAP_INFORMATION_CLASS {
#define ES_USER_PRESENT 0x00000004 #define ES_USER_PRESENT 0x00000004
#define ES_CONTINUOUS 0x80000000 #define ES_CONTINUOUS 0x80000000
#include <excpt.h>
struct _CONTEXT;
struct _EXCEPTION_POINTERS;
struct _EXCEPTION_RECORD;
typedef EXCEPTION_DISPOSITION WINAPI EXCEPTION_ROUTINE(struct _EXCEPTION_RECORD*,PVOID,
struct _CONTEXT*,PVOID);
typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;
/* The Win32 register context */ /* The Win32 register context */
/* i386 context definitions */ /* i386 context definitions */
@ -964,7 +974,7 @@ typedef struct _CONTEXT
DWORD SegSs; /* 0c8 */ DWORD SegSs; /* 0c8 */
BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; /* 0xcc */ BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; /* 0xcc */
} CONTEXT; } CONTEXT, *PCONTEXT;
#define CONTEXT_X86 0x00010000 #define CONTEXT_X86 0x00010000
#define CONTEXT_i386 CONTEXT_X86 #define CONTEXT_i386 CONTEXT_X86
@ -1139,7 +1149,7 @@ typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
DWORD64 LastBranchFromRip; /* 4b8 */ DWORD64 LastBranchFromRip; /* 4b8 */
DWORD64 LastExceptionToRip; /* 4c0 */ DWORD64 LastExceptionToRip; /* 4c0 */
DWORD64 LastExceptionFromRip; /* 4c8 */ DWORD64 LastExceptionFromRip; /* 4c8 */
} CONTEXT; } CONTEXT, *PCONTEXT;
typedef struct _RUNTIME_FUNCTION typedef struct _RUNTIME_FUNCTION
{ {
@ -1220,6 +1230,24 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS
} DUMMYUNIONNAME2; } DUMMYUNIONNAME2;
} KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
typedef struct _DISPATCHER_CONTEXT
{
ULONG64 ControlPc;
ULONG64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
ULONG64 EstablisherFrame;
ULONG64 TargetIp;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
DWORD ScopeIndex;
DWORD Fill0;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,PVOID);
typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,PVOID);
typedef PRUNTIME_FUNCTION (CALLBACK *PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64,PVOID); typedef PRUNTIME_FUNCTION (CALLBACK *PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64,PVOID);
BOOLEAN CDECL RtlAddFunctionTable(RUNTIME_FUNCTION*,DWORD,DWORD64); BOOLEAN CDECL RtlAddFunctionTable(RUNTIME_FUNCTION*,DWORD,DWORD64);
@ -1641,7 +1669,7 @@ typedef struct _CONTEXT
DWORD Psr; DWORD Psr;
DWORD ContextFlags; DWORD ContextFlags;
DWORD Fill[4]; DWORD Fill[4];
} CONTEXT; } CONTEXT, *PCONTEXT;
#define _QUAD_PSR_OFFSET HighSoftFpcr #define _QUAD_PSR_OFFSET HighSoftFpcr
#define _QUAD_FLAGS_OFFSET HighFir #define _QUAD_FLAGS_OFFSET HighFir
@ -1750,7 +1778,48 @@ typedef struct _CONTEXT
ULONG Wvr[ARM_MAX_WATCHPOINTS]; /* 190 */ ULONG Wvr[ARM_MAX_WATCHPOINTS]; /* 190 */
ULONG Wcr[ARM_MAX_WATCHPOINTS]; /* 194 */ ULONG Wcr[ARM_MAX_WATCHPOINTS]; /* 194 */
ULONG Padding2[2]; /* 198 */ ULONG Padding2[2]; /* 198 */
} CONTEXT; } CONTEXT, *PCONTEXT;
typedef struct _KNONVOLATILE_CONTEXT_POINTERS
{
PDWORD R4;
PDWORD R5;
PDWORD R6;
PDWORD R7;
PDWORD R8;
PDWORD R9;
PDWORD R10;
PDWORD R11;
PDWORD Lr;
PULONGLONG D8;
PULONGLONG D9;
PULONGLONG D10;
PULONGLONG D11;
PULONGLONG D12;
PULONGLONG D13;
PULONGLONG D14;
PULONGLONG D15;
} KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
typedef struct _DISPATCHER_CONTEXT
{
DWORD ControlPc;
DWORD ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
DWORD EstablisherFrame;
DWORD TargetPc;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
DWORD ScopeIndex;
BOOLEAN ControlPcIsUnwound;
PBYTE NonVolatileRegisters;
DWORD Reserved;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,DWORD);
typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,DWORD);
typedef PRUNTIME_FUNCTION (CALLBACK *PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD,PVOID); typedef PRUNTIME_FUNCTION (CALLBACK *PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD,PVOID);
@ -1886,7 +1955,50 @@ typedef struct _CONTEXT
DWORD64 Bvr[ARM64_MAX_BREAKPOINTS]; /* 338 */ DWORD64 Bvr[ARM64_MAX_BREAKPOINTS]; /* 338 */
DWORD Wcr[ARM64_MAX_WATCHPOINTS]; /* 378 */ DWORD Wcr[ARM64_MAX_WATCHPOINTS]; /* 378 */
DWORD64 Wvr[ARM64_MAX_WATCHPOINTS]; /* 380 */ DWORD64 Wvr[ARM64_MAX_WATCHPOINTS]; /* 380 */
} CONTEXT; } CONTEXT, *PCONTEXT;
typedef struct _KNONVOLATILE_CONTEXT_POINTERS
{
PDWORD64 X19;
PDWORD64 X20;
PDWORD64 X21;
PDWORD64 X22;
PDWORD64 X23;
PDWORD64 X24;
PDWORD64 X25;
PDWORD64 X26;
PDWORD64 X27;
PDWORD64 X28;
PDWORD64 Fp;
PDWORD64 Lr;
PDWORD64 D8;
PDWORD64 D9;
PDWORD64 D10;
PDWORD64 D11;
PDWORD64 D12;
PDWORD64 D13;
PDWORD64 D14;
PDWORD64 D15;
} KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
typedef struct _DISPATCHER_CONTEXT
{
ULONG_PTR ControlPc;
ULONG_PTR ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
ULONG_PTR EstablisherFrame;
ULONG_PTR TargetPc;
PCONTEXT ContextRecord;
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
DWORD ScopeIndex;
BOOLEAN ControlPcIsUnwound;
PBYTE NonVolatileRegisters;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,DWORD64);
typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,DWORD64);
typedef PRUNTIME_FUNCTION (CALLBACK *PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64,PVOID); typedef PRUNTIME_FUNCTION (CALLBACK *PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64,PVOID);
@ -2133,8 +2245,6 @@ typedef struct _STACK_FRAME_HEADER
#error You need to define a CONTEXT for your CPU #error You need to define a CONTEXT for your CPU
#endif #endif
typedef CONTEXT *PCONTEXT;
NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*); NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*);
#define WOW64_CONTEXT_i386 0x00010000 #define WOW64_CONTEXT_i386 0x00010000