Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
97259a30
Commit
97259a30
authored
Feb 28, 2024
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use the official definitions for exception flags.
parent
7a66313c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
85 additions
and
89 deletions
+85
-89
exception.c
dlls/ntdll/exception.c
+4
-4
loader.c
dlls/ntdll/loader.c
+1
-1
signal_arm.c
dlls/ntdll/signal_arm.c
+14
-14
signal_arm64.c
dlls/ntdll/signal_arm64.c
+14
-14
signal_i386.c
dlls/ntdll/signal_i386.c
+7
-7
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+14
-14
exception.c
dlls/ntdll/tests/exception.c
+22
-26
signal_arm.c
dlls/ntdll/unix/signal_arm.c
+2
-2
signal_arm64.c
dlls/ntdll/unix/signal_arm64.c
+2
-2
signal_i386.c
dlls/ntdll/unix/signal_i386.c
+2
-2
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+2
-2
thread.c
dlls/ntdll/unix/thread.c
+1
-1
No files found.
dlls/ntdll/exception.c
View file @
97259a30
...
...
@@ -267,7 +267,7 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
EXCEPTION_DISPOSITION
WINAPI
user_callback_handler
(
EXCEPTION_RECORD
*
record
,
void
*
frame
,
CONTEXT
*
context
,
void
*
dispatch
)
{
if
(
!
(
record
->
ExceptionFlags
&
(
E
H_UNWINDING
|
EH
_EXIT_UNWIND
)))
if
(
!
(
record
->
ExceptionFlags
&
(
E
XCEPTION_UNWINDING
|
EXCEPTION
_EXIT_UNWIND
)))
{
ERR
(
"ignoring exception %lx
\n
"
,
record
->
ExceptionCode
);
RtlUnwind
(
frame
,
KiUserCallbackDispatcherReturn
,
record
,
ULongToPtr
(
record
->
ExceptionCode
)
);
...
...
@@ -308,7 +308,7 @@ NTSTATUS WINAPI dispatch_user_callback( void *args, ULONG len, ULONG id )
EXCEPTION_DISPOSITION
WINAPI
nested_exception_handler
(
EXCEPTION_RECORD
*
rec
,
void
*
frame
,
CONTEXT
*
context
,
void
*
dispatch
)
{
if
(
rec
->
ExceptionFlags
&
(
E
H_UNWINDING
|
EH
_EXIT_UNWIND
))
return
ExceptionContinueSearch
;
if
(
rec
->
ExceptionFlags
&
(
E
XCEPTION_UNWINDING
|
EXCEPTION
_EXIT_UNWIND
))
return
ExceptionContinueSearch
;
return
ExceptionNestedException
;
}
...
...
@@ -323,7 +323,7 @@ void DECLSPEC_NORETURN raise_status( NTSTATUS status, EXCEPTION_RECORD *rec )
EXCEPTION_RECORD
ExceptionRec
;
ExceptionRec
.
ExceptionCode
=
status
;
ExceptionRec
.
ExceptionFlags
=
E
H
_NONCONTINUABLE
;
ExceptionRec
.
ExceptionFlags
=
E
XCEPTION
_NONCONTINUABLE
;
ExceptionRec
.
ExceptionRecord
=
rec
;
ExceptionRec
.
NumberParameters
=
0
;
for
(;;)
RtlRaiseException
(
&
ExceptionRec
);
/* never returns */
...
...
@@ -450,7 +450,7 @@ void __cdecl __wine_spec_unimplemented_stub( const char *module, const char *fun
EXCEPTION_RECORD
record
;
record
.
ExceptionCode
=
EXCEPTION_WINE_STUB
;
record
.
ExceptionFlags
=
E
H
_NONCONTINUABLE
;
record
.
ExceptionFlags
=
E
XCEPTION
_NONCONTINUABLE
;
record
.
ExceptionRecord
=
NULL
;
record
.
ExceptionAddress
=
__wine_spec_unimplemented_stub
;
record
.
NumberParameters
=
2
;
...
...
dlls/ntdll/loader.c
View file @
97259a30
...
...
@@ -389,7 +389,7 @@ static void WINAPI stub_entry_point( const char *dll, const char *name, void *re
EXCEPTION_RECORD
rec
;
rec
.
ExceptionCode
=
EXCEPTION_WINE_STUB
;
rec
.
ExceptionFlags
=
E
H
_NONCONTINUABLE
;
rec
.
ExceptionFlags
=
E
XCEPTION
_NONCONTINUABLE
;
rec
.
ExceptionRecord
=
NULL
;
rec
.
ExceptionAddress
=
ret_addr
;
rec
.
NumberParameters
=
2
;
...
...
dlls/ntdll/signal_arm.c
View file @
97259a30
...
...
@@ -300,7 +300,7 @@ static DWORD call_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCHER_C
res
=
call_handler_wrapper
(
rec
,
context
,
dispatch
);
TRACE
(
"handler at %p returned %lu
\n
"
,
dispatch
->
LanguageHandler
,
res
);
rec
->
ExceptionFlags
&=
E
H
_NONCONTINUABLE
;
rec
->
ExceptionFlags
&=
E
XCEPTION
_NONCONTINUABLE
;
return
res
;
}
...
...
@@ -356,7 +356,7 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
{
ERR
(
"invalid frame %lx (%p-%p)
\n
"
,
dispatch
.
EstablisherFrame
,
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
rec
->
ExceptionFlags
|=
E
H
_STACK_INVALID
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_STACK_INVALID
;
break
;
}
...
...
@@ -365,12 +365,12 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
switch
(
call_handler
(
rec
,
orig_context
,
&
dispatch
))
{
case
ExceptionContinueExecution
:
if
(
rec
->
ExceptionFlags
&
E
H
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
if
(
rec
->
ExceptionFlags
&
E
XCEPTION
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
return
STATUS_SUCCESS
;
case
ExceptionContinueSearch
:
break
;
case
ExceptionNestedException
:
rec
->
ExceptionFlags
|=
E
H
_NESTED_CALL
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_NESTED_CALL
;
TRACE
(
"nested exception
\n
"
);
break
;
case
ExceptionCollidedUnwind
:
{
...
...
@@ -396,12 +396,12 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
switch
(
call_teb_handler
(
rec
,
orig_context
,
&
dispatch
,
teb_frame
))
{
case
ExceptionContinueExecution
:
if
(
rec
->
ExceptionFlags
&
E
H
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
if
(
rec
->
ExceptionFlags
&
E
XCEPTION
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
return
STATUS_SUCCESS
;
case
ExceptionContinueSearch
:
break
;
case
ExceptionNestedException
:
rec
->
ExceptionFlags
|=
E
H
_NESTED_CALL
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_NESTED_CALL
;
TRACE
(
"nested exception
\n
"
);
break
;
case
ExceptionCollidedUnwind
:
{
...
...
@@ -655,7 +655,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
rec
=
&
record
;
}
rec
->
ExceptionFlags
|=
E
H_UNWINDING
|
(
end_frame
?
0
:
EH
_EXIT_UNWIND
);
rec
->
ExceptionFlags
|=
E
XCEPTION_UNWINDING
|
(
end_frame
?
0
:
EXCEPTION
_EXIT_UNWIND
);
TRACE
(
"code=%lx flags=%lx end_frame=%p target_ip=%p
\n
"
,
rec
->
ExceptionCode
,
rec
->
ExceptionFlags
,
end_frame
,
target_ip
);
...
...
@@ -680,7 +680,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
{
ERR
(
"invalid frame %lx (%p-%p)
\n
"
,
dispatch
.
EstablisherFrame
,
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
rec
->
ExceptionFlags
|=
E
H
_STACK_INVALID
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_STACK_INVALID
;
break
;
}
...
...
@@ -691,7 +691,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
ERR
(
"invalid end frame %lx/%p
\n
"
,
dispatch
.
EstablisherFrame
,
end_frame
);
raise_status
(
STATUS_INVALID_UNWIND_TARGET
,
rec
);
}
if
(
dispatch
.
EstablisherFrame
==
(
DWORD
)
end_frame
)
rec
->
ExceptionFlags
|=
E
H
_TARGET_UNWIND
;
if
(
dispatch
.
EstablisherFrame
==
(
DWORD
)
end_frame
)
rec
->
ExceptionFlags
|=
E
XCEPTION
_TARGET_UNWIND
;
if
(
call_unwind_handler
(
rec
,
&
dispatch
)
==
ExceptionCollidedUnwind
)
{
ULONG_PTR
frame
;
...
...
@@ -702,10 +702,10 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
dispatch
.
ControlPc
,
dispatch
.
FunctionEntry
,
&
new_context
,
&
dispatch
.
HandlerData
,
&
frame
,
NULL
);
rec
->
ExceptionFlags
|=
E
H
_COLLIDED_UNWIND
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_COLLIDED_UNWIND
;
goto
unwind_done
;
}
rec
->
ExceptionFlags
&=
~
E
H
_COLLIDED_UNWIND
;
rec
->
ExceptionFlags
&=
~
E
XCEPTION
_COLLIDED_UNWIND
;
}
else
/* hack: call builtin handlers registered in the tib list */
{
...
...
@@ -728,7 +728,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
dispatch
.
ControlPc
,
dispatch
.
FunctionEntry
,
&
new_context
,
&
dispatch
.
HandlerData
,
&
frame
,
NULL
);
rec
->
ExceptionFlags
|=
E
H
_COLLIDED_UNWIND
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_COLLIDED_UNWIND
;
goto
unwind_done
;
}
teb_frame
=
__wine_pop_frame
(
teb_frame
);
...
...
@@ -796,7 +796,7 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
if
(
dispatch
->
ControlPcIsUnwound
)
ControlPc
-=
2
;
if
(
rec
->
ExceptionFlags
&
(
E
H_UNWINDING
|
EH
_EXIT_UNWIND
))
if
(
rec
->
ExceptionFlags
&
(
E
XCEPTION_UNWINDING
|
EXCEPTION
_EXIT_UNWIND
))
{
for
(
i
=
dispatch
->
ScopeIndex
;
i
<
table
->
Count
;
i
++
)
{
...
...
@@ -807,7 +807,7 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
if
(
table
->
ScopeRecord
[
i
].
JumpTarget
)
continue
;
if
(
rec
->
ExceptionFlags
&
E
H
_TARGET_UNWIND
&&
if
(
rec
->
ExceptionFlags
&
E
XCEPTION
_TARGET_UNWIND
&&
dispatch
->
TargetPc
>=
dispatch
->
ImageBase
+
table
->
ScopeRecord
[
i
].
BeginAddress
&&
dispatch
->
TargetPc
<
dispatch
->
ImageBase
+
table
->
ScopeRecord
[
i
].
EndAddress
)
{
...
...
dlls/ntdll/signal_arm64.c
View file @
97259a30
...
...
@@ -302,7 +302,7 @@ static DWORD call_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCHER_C
res
=
call_handler_wrapper
(
rec
,
context
,
dispatch
);
TRACE
(
"handler at %p returned %lu
\n
"
,
dispatch
->
LanguageHandler
,
res
);
rec
->
ExceptionFlags
&=
E
H
_NONCONTINUABLE
;
rec
->
ExceptionFlags
&=
E
XCEPTION
_NONCONTINUABLE
;
return
res
;
}
...
...
@@ -358,7 +358,7 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
{
ERR
(
"invalid frame %I64x (%p-%p)
\n
"
,
dispatch
.
EstablisherFrame
,
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
rec
->
ExceptionFlags
|=
E
H
_STACK_INVALID
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_STACK_INVALID
;
break
;
}
...
...
@@ -367,12 +367,12 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
switch
(
call_handler
(
rec
,
orig_context
,
&
dispatch
))
{
case
ExceptionContinueExecution
:
if
(
rec
->
ExceptionFlags
&
E
H
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
if
(
rec
->
ExceptionFlags
&
E
XCEPTION
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
return
STATUS_SUCCESS
;
case
ExceptionContinueSearch
:
break
;
case
ExceptionNestedException
:
rec
->
ExceptionFlags
|=
E
H
_NESTED_CALL
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_NESTED_CALL
;
TRACE
(
"nested exception
\n
"
);
break
;
case
ExceptionCollidedUnwind
:
{
...
...
@@ -398,12 +398,12 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
switch
(
call_teb_handler
(
rec
,
orig_context
,
&
dispatch
,
teb_frame
))
{
case
ExceptionContinueExecution
:
if
(
rec
->
ExceptionFlags
&
E
H
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
if
(
rec
->
ExceptionFlags
&
E
XCEPTION
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
return
STATUS_SUCCESS
;
case
ExceptionContinueSearch
:
break
;
case
ExceptionNestedException
:
rec
->
ExceptionFlags
|=
E
H
_NESTED_CALL
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_NESTED_CALL
;
TRACE
(
"nested exception
\n
"
);
break
;
case
ExceptionCollidedUnwind
:
{
...
...
@@ -648,7 +648,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
rec
=
&
record
;
}
rec
->
ExceptionFlags
|=
E
H_UNWINDING
|
(
end_frame
?
0
:
EH
_EXIT_UNWIND
);
rec
->
ExceptionFlags
|=
E
XCEPTION_UNWINDING
|
(
end_frame
?
0
:
EXCEPTION
_EXIT_UNWIND
);
TRACE
(
"code=%lx flags=%lx end_frame=%p target_ip=%p
\n
"
,
rec
->
ExceptionCode
,
rec
->
ExceptionFlags
,
end_frame
,
target_ip
);
...
...
@@ -673,7 +673,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
{
ERR
(
"invalid frame %I64x (%p-%p)
\n
"
,
dispatch
.
EstablisherFrame
,
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
rec
->
ExceptionFlags
|=
E
H
_STACK_INVALID
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_STACK_INVALID
;
break
;
}
...
...
@@ -684,7 +684,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
ERR
(
"invalid end frame %I64x/%p
\n
"
,
dispatch
.
EstablisherFrame
,
end_frame
);
raise_status
(
STATUS_INVALID_UNWIND_TARGET
,
rec
);
}
if
(
dispatch
.
EstablisherFrame
==
(
ULONG64
)
end_frame
)
rec
->
ExceptionFlags
|=
E
H
_TARGET_UNWIND
;
if
(
dispatch
.
EstablisherFrame
==
(
ULONG64
)
end_frame
)
rec
->
ExceptionFlags
|=
E
XCEPTION
_TARGET_UNWIND
;
if
(
call_unwind_handler
(
rec
,
&
dispatch
)
==
ExceptionCollidedUnwind
)
{
ULONG64
frame
;
...
...
@@ -695,10 +695,10 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
dispatch
.
ControlPc
,
dispatch
.
FunctionEntry
,
&
new_context
,
&
dispatch
.
HandlerData
,
&
frame
,
NULL
);
rec
->
ExceptionFlags
|=
E
H
_COLLIDED_UNWIND
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_COLLIDED_UNWIND
;
goto
unwind_done
;
}
rec
->
ExceptionFlags
&=
~
E
H
_COLLIDED_UNWIND
;
rec
->
ExceptionFlags
&=
~
E
XCEPTION
_COLLIDED_UNWIND
;
}
else
/* hack: call builtin handlers registered in the tib list */
{
...
...
@@ -721,7 +721,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
dispatch
.
ControlPc
,
dispatch
.
FunctionEntry
,
&
new_context
,
&
dispatch
.
HandlerData
,
&
frame
,
NULL
);
rec
->
ExceptionFlags
|=
E
H
_COLLIDED_UNWIND
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_COLLIDED_UNWIND
;
goto
unwind_done
;
}
teb_frame
=
__wine_pop_frame
(
teb_frame
);
...
...
@@ -816,7 +816,7 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
if
(
dispatch
->
ControlPcIsUnwound
)
ControlPc
-=
4
;
if
(
rec
->
ExceptionFlags
&
(
E
H_UNWINDING
|
EH
_EXIT_UNWIND
))
if
(
rec
->
ExceptionFlags
&
(
E
XCEPTION_UNWINDING
|
EXCEPTION
_EXIT_UNWIND
))
{
for
(
i
=
dispatch
->
ScopeIndex
;
i
<
table
->
Count
;
i
++
)
{
...
...
@@ -827,7 +827,7 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
if
(
table
->
ScopeRecord
[
i
].
JumpTarget
)
continue
;
if
(
rec
->
ExceptionFlags
&
E
H
_TARGET_UNWIND
&&
if
(
rec
->
ExceptionFlags
&
E
XCEPTION
_TARGET_UNWIND
&&
dispatch
->
TargetPc
>=
dispatch
->
ImageBase
+
table
->
ScopeRecord
[
i
].
BeginAddress
&&
dispatch
->
TargetPc
<
dispatch
->
ImageBase
+
table
->
ScopeRecord
[
i
].
EndAddress
)
{
...
...
dlls/ntdll/signal_i386.c
View file @
97259a30
...
...
@@ -113,7 +113,7 @@ DEFINE_SYSCALL_HELPER32()
static
DWORD
raise_handler
(
EXCEPTION_RECORD
*
rec
,
EXCEPTION_REGISTRATION_RECORD
*
frame
,
CONTEXT
*
context
,
EXCEPTION_REGISTRATION_RECORD
**
dispatcher
)
{
if
(
rec
->
ExceptionFlags
&
(
E
H_UNWINDING
|
EH
_EXIT_UNWIND
))
if
(
rec
->
ExceptionFlags
&
(
E
XCEPTION_UNWINDING
|
EXCEPTION
_EXIT_UNWIND
))
return
ExceptionContinueSearch
;
/* We shouldn't get here so we store faulty frame in dispatcher */
*
dispatcher
=
((
EXC_NESTED_FRAME
*
)
frame
)
->
prevFrame
;
...
...
@@ -129,7 +129,7 @@ static DWORD raise_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD
static
DWORD
unwind_handler
(
EXCEPTION_RECORD
*
rec
,
EXCEPTION_REGISTRATION_RECORD
*
frame
,
CONTEXT
*
context
,
EXCEPTION_REGISTRATION_RECORD
**
dispatcher
)
{
if
(
!
(
rec
->
ExceptionFlags
&
(
E
H_UNWINDING
|
EH
_EXIT_UNWIND
)))
if
(
!
(
rec
->
ExceptionFlags
&
(
E
XCEPTION_UNWINDING
|
EXCEPTION
_EXIT_UNWIND
)))
return
ExceptionContinueSearch
;
/* We shouldn't get here so we store faulty frame in dispatcher */
*
dispatcher
=
((
EXC_NESTED_FRAME
*
)
frame
)
->
prevFrame
;
...
...
@@ -154,7 +154,7 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
/* Check frame address */
if
(
!
is_valid_frame
(
(
ULONG_PTR
)
frame
))
{
rec
->
ExceptionFlags
|=
E
H
_STACK_INVALID
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_STACK_INVALID
;
break
;
}
...
...
@@ -168,19 +168,19 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
{
/* no longer nested */
nested_frame
=
NULL
;
rec
->
ExceptionFlags
&=
~
E
H
_NESTED_CALL
;
rec
->
ExceptionFlags
&=
~
E
XCEPTION
_NESTED_CALL
;
}
switch
(
res
)
{
case
ExceptionContinueExecution
:
if
(
!
(
rec
->
ExceptionFlags
&
E
H
_NONCONTINUABLE
))
return
STATUS_SUCCESS
;
if
(
!
(
rec
->
ExceptionFlags
&
E
XCEPTION
_NONCONTINUABLE
))
return
STATUS_SUCCESS
;
return
STATUS_NONCONTINUABLE_EXCEPTION
;
case
ExceptionContinueSearch
:
break
;
case
ExceptionNestedException
:
if
(
nested_frame
<
dispatch
)
nested_frame
=
dispatch
;
rec
->
ExceptionFlags
|=
E
H
_NESTED_CALL
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_NESTED_CALL
;
break
;
default:
return
STATUS_INVALID_DISPOSITION
;
...
...
@@ -341,7 +341,7 @@ void WINAPI __regs_RtlUnwind( EXCEPTION_REGISTRATION_RECORD* pEndFrame, PVOID ta
pRecord
=
&
record
;
}
pRecord
->
ExceptionFlags
|=
E
H_UNWINDING
|
(
pEndFrame
?
0
:
EH
_EXIT_UNWIND
);
pRecord
->
ExceptionFlags
|=
E
XCEPTION_UNWINDING
|
(
pEndFrame
?
0
:
EXCEPTION
_EXIT_UNWIND
);
TRACE
(
"code=%lx flags=%lx
\n
"
,
pRecord
->
ExceptionCode
,
pRecord
->
ExceptionFlags
);
TRACE_CONTEXT
(
context
);
...
...
dlls/ntdll/signal_x86_64.c
View file @
97259a30
...
...
@@ -220,7 +220,7 @@ static DWORD call_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCHER_C
res
=
exception_handler_call_wrapper
(
rec
,
(
void
*
)
dispatch
->
EstablisherFrame
,
context
,
dispatch
);
TRACE
(
"handler at %p returned %lu
\n
"
,
dispatch
->
LanguageHandler
,
res
);
rec
->
ExceptionFlags
&=
E
H
_NONCONTINUABLE
;
rec
->
ExceptionFlags
&=
E
XCEPTION
_NONCONTINUABLE
;
return
res
;
}
...
...
@@ -275,7 +275,7 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
{
ERR
(
"invalid frame %p (%p-%p)
\n
"
,
(
void
*
)
dispatch
.
EstablisherFrame
,
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
rec
->
ExceptionFlags
|=
E
H
_STACK_INVALID
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_STACK_INVALID
;
break
;
}
...
...
@@ -284,12 +284,12 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
switch
(
call_handler
(
rec
,
orig_context
,
&
dispatch
))
{
case
ExceptionContinueExecution
:
if
(
rec
->
ExceptionFlags
&
E
H
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
if
(
rec
->
ExceptionFlags
&
E
XCEPTION
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
return
STATUS_SUCCESS
;
case
ExceptionContinueSearch
:
break
;
case
ExceptionNestedException
:
rec
->
ExceptionFlags
|=
E
H
_NESTED_CALL
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_NESTED_CALL
;
TRACE
(
"nested exception
\n
"
);
break
;
case
ExceptionCollidedUnwind
:
{
...
...
@@ -315,12 +315,12 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
switch
(
call_teb_handler
(
rec
,
orig_context
,
&
dispatch
,
teb_frame
))
{
case
ExceptionContinueExecution
:
if
(
rec
->
ExceptionFlags
&
E
H
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
if
(
rec
->
ExceptionFlags
&
E
XCEPTION
_NONCONTINUABLE
)
return
STATUS_NONCONTINUABLE_EXCEPTION
;
return
STATUS_SUCCESS
;
case
ExceptionContinueSearch
:
break
;
case
ExceptionNestedException
:
rec
->
ExceptionFlags
|=
E
H
_NESTED_CALL
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_NESTED_CALL
;
TRACE
(
"nested exception
\n
"
);
break
;
case
ExceptionCollidedUnwind
:
{
...
...
@@ -799,7 +799,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
rec
=
&
record
;
}
rec
->
ExceptionFlags
|=
E
H_UNWINDING
|
(
end_frame
?
0
:
EH
_EXIT_UNWIND
);
rec
->
ExceptionFlags
|=
E
XCEPTION_UNWINDING
|
(
end_frame
?
0
:
EXCEPTION
_EXIT_UNWIND
);
TRACE
(
"code=%lx flags=%lx end_frame=%p target_ip=%p
\n
"
,
rec
->
ExceptionCode
,
rec
->
ExceptionFlags
,
end_frame
,
target_ip
);
...
...
@@ -824,7 +824,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
{
ERR
(
"invalid frame %p (%p-%p)
\n
"
,
(
void
*
)
dispatch
.
EstablisherFrame
,
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
rec
->
ExceptionFlags
|=
E
H
_STACK_INVALID
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_STACK_INVALID
;
break
;
}
...
...
@@ -835,7 +835,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
ERR
(
"invalid end frame %p/%p
\n
"
,
(
void
*
)
dispatch
.
EstablisherFrame
,
end_frame
);
raise_status
(
STATUS_INVALID_UNWIND_TARGET
,
rec
);
}
if
(
dispatch
.
EstablisherFrame
==
(
ULONG64
)
end_frame
)
rec
->
ExceptionFlags
|=
E
H
_TARGET_UNWIND
;
if
(
dispatch
.
EstablisherFrame
==
(
ULONG64
)
end_frame
)
rec
->
ExceptionFlags
|=
E
XCEPTION
_TARGET_UNWIND
;
if
(
call_unwind_handler
(
rec
,
&
dispatch
)
==
ExceptionCollidedUnwind
)
{
ULONG64
frame
;
...
...
@@ -847,10 +847,10 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
RtlVirtualUnwind
(
UNW_FLAG_NHANDLER
,
dispatch
.
ImageBase
,
dispatch
.
ControlPc
,
dispatch
.
FunctionEntry
,
&
new_context
,
NULL
,
&
frame
,
NULL
);
rec
->
ExceptionFlags
|=
E
H
_COLLIDED_UNWIND
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_COLLIDED_UNWIND
;
goto
unwind_done
;
}
rec
->
ExceptionFlags
&=
~
E
H
_COLLIDED_UNWIND
;
rec
->
ExceptionFlags
&=
~
E
XCEPTION
_COLLIDED_UNWIND
;
}
else
/* hack: call builtin handlers registered in the tib list */
{
...
...
@@ -874,7 +874,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
RtlVirtualUnwind
(
UNW_FLAG_NHANDLER
,
dispatch
.
ImageBase
,
dispatch
.
ControlPc
,
dispatch
.
FunctionEntry
,
&
new_context
,
NULL
,
&
frame
,
NULL
);
rec
->
ExceptionFlags
|=
E
H
_COLLIDED_UNWIND
;
rec
->
ExceptionFlags
|=
E
XCEPTION
_COLLIDED_UNWIND
;
goto
unwind_done
;
}
teb_frame
=
__wine_pop_frame
(
teb_frame
);
...
...
@@ -907,7 +907,7 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
TRACE
(
"%p %p %p %p
\n
"
,
rec
,
frame
,
context
,
dispatch
);
if
(
TRACE_ON
(
seh
))
dump_scope_table
(
dispatch
->
ImageBase
,
table
);
if
(
rec
->
ExceptionFlags
&
(
E
H_UNWINDING
|
EH
_EXIT_UNWIND
))
if
(
rec
->
ExceptionFlags
&
(
E
XCEPTION_UNWINDING
|
EXCEPTION
_EXIT_UNWIND
))
{
for
(
i
=
dispatch
->
ScopeIndex
;
i
<
table
->
Count
;
i
++
)
{
...
...
@@ -918,7 +918,7 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
if
(
table
->
ScopeRecord
[
i
].
JumpTarget
)
continue
;
if
(
rec
->
ExceptionFlags
&
E
H
_TARGET_UNWIND
&&
if
(
rec
->
ExceptionFlags
&
E
XCEPTION
_TARGET_UNWIND
&&
dispatch
->
TargetIp
>=
dispatch
->
ImageBase
+
table
->
ScopeRecord
[
i
].
BeginAddress
&&
dispatch
->
TargetIp
<
dispatch
->
ImageBase
+
table
->
ScopeRecord
[
i
].
EndAddress
)
{
...
...
dlls/ntdll/tests/exception.c
View file @
97259a30
This diff is collapsed.
Click to expand it.
dlls/ntdll/unix/signal_arm.c
View file @
97259a30
...
...
@@ -838,7 +838,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
case
0xfb
:
/* __fastfail */
{
rec
.
ExceptionCode
=
STATUS_STACK_BUFFER_OVERRUN
;
rec
.
ExceptionFlags
=
E
H
_NONCONTINUABLE
;
rec
.
ExceptionFlags
=
E
XCEPTION
_NONCONTINUABLE
;
rec
.
NumberParameters
=
1
;
rec
.
ExceptionInformation
[
0
]
=
ctx
.
R0
;
NtRaiseException
(
&
rec
,
&
ctx
,
FALSE
);
...
...
@@ -991,7 +991,7 @@ static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/
static
void
abrt_handler
(
int
signal
,
siginfo_t
*
siginfo
,
void
*
sigcontext
)
{
EXCEPTION_RECORD
rec
=
{
EXCEPTION_WINE_ASSERTION
,
E
H
_NONCONTINUABLE
};
EXCEPTION_RECORD
rec
=
{
EXCEPTION_WINE_ASSERTION
,
E
XCEPTION
_NONCONTINUABLE
};
setup_exception
(
sigcontext
,
&
rec
);
}
...
...
dlls/ntdll/unix/signal_arm64.c
View file @
97259a30
...
...
@@ -1097,7 +1097,7 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*
(
ULONG
*
)
PC_sig
(
context
)
==
0xd43e0060UL
)
/* brk #0xf003 -> __fastfail */
{
rec
.
ExceptionCode
=
STATUS_STACK_BUFFER_OVERRUN
;
rec
.
ExceptionFlags
=
E
H
_NONCONTINUABLE
;
rec
.
ExceptionFlags
=
E
XCEPTION
_NONCONTINUABLE
;
rec
.
NumberParameters
=
1
;
rec
.
ExceptionInformation
[
0
]
=
ctx
.
X
[
0
];
NtRaiseException
(
&
rec
,
&
ctx
,
FALSE
);
...
...
@@ -1193,7 +1193,7 @@ static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/
static
void
abrt_handler
(
int
signal
,
siginfo_t
*
siginfo
,
void
*
sigcontext
)
{
EXCEPTION_RECORD
rec
=
{
EXCEPTION_WINE_ASSERTION
,
E
H
_NONCONTINUABLE
};
EXCEPTION_RECORD
rec
=
{
EXCEPTION_WINE_ASSERTION
,
E
XCEPTION
_NONCONTINUABLE
};
setup_exception
(
sigcontext
,
&
rec
);
}
...
...
dlls/ntdll/unix/signal_i386.c
View file @
97259a30
...
...
@@ -1753,7 +1753,7 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, vo
case
0x29
:
/* __fastfail: process state is corrupted */
rec
->
ExceptionCode
=
STATUS_STACK_BUFFER_OVERRUN
;
rec
->
ExceptionFlags
=
E
H
_NONCONTINUABLE
;
rec
->
ExceptionFlags
=
E
XCEPTION
_NONCONTINUABLE
;
rec
->
NumberParameters
=
1
;
rec
->
ExceptionInformation
[
0
]
=
context
->
Ecx
;
NtRaiseException
(
rec
,
context
,
FALSE
);
...
...
@@ -2081,7 +2081,7 @@ static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/
static
void
abrt_handler
(
int
signal
,
siginfo_t
*
siginfo
,
void
*
sigcontext
)
{
EXCEPTION_RECORD
rec
=
{
EXCEPTION_WINE_ASSERTION
,
E
H
_NONCONTINUABLE
};
EXCEPTION_RECORD
rec
=
{
EXCEPTION_WINE_ASSERTION
,
E
XCEPTION
_NONCONTINUABLE
};
setup_exception
(
sigcontext
,
&
rec
);
}
...
...
dlls/ntdll/unix/signal_x86_64.c
View file @
97259a30
...
...
@@ -1794,7 +1794,7 @@ static inline BOOL handle_interrupt( ucontext_t *sigcontext, EXCEPTION_RECORD *r
case
0x29
:
/* __fastfail: process state is corrupted */
rec
->
ExceptionCode
=
STATUS_STACK_BUFFER_OVERRUN
;
rec
->
ExceptionFlags
=
E
H
_NONCONTINUABLE
;
rec
->
ExceptionFlags
=
E
XCEPTION
_NONCONTINUABLE
;
rec
->
NumberParameters
=
1
;
rec
->
ExceptionInformation
[
0
]
=
context
->
Rcx
;
NtRaiseException
(
rec
,
context
,
FALSE
);
...
...
@@ -2117,7 +2117,7 @@ static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
static
void
abrt_handler
(
int
signal
,
siginfo_t
*
siginfo
,
void
*
sigcontext
)
{
ucontext_t
*
ucontext
=
init_handler
(
sigcontext
);
EXCEPTION_RECORD
rec
=
{
EXCEPTION_WINE_ASSERTION
,
E
H
_NONCONTINUABLE
};
EXCEPTION_RECORD
rec
=
{
EXCEPTION_WINE_ASSERTION
,
E
XCEPTION
_NONCONTINUABLE
};
setup_exception
(
ucontext
,
&
rec
);
}
...
...
dlls/ntdll/unix/thread.c
View file @
97259a30
...
...
@@ -1545,7 +1545,7 @@ NTSTATUS WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL
if
(
first_chance
)
return
call_user_exception_dispatcher
(
rec
,
context
);
if
(
rec
->
ExceptionFlags
&
E
H
_STACK_INVALID
)
if
(
rec
->
ExceptionFlags
&
E
XCEPTION
_STACK_INVALID
)
ERR_
(
seh
)(
"Exception frame is not in stack limits => unable to dispatch exception.
\n
"
);
else
if
(
rec
->
ExceptionCode
==
STATUS_NONCONTINUABLE_EXCEPTION
)
ERR_
(
seh
)(
"Process attempted to continue execution after noncontinuable exception.
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment