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
11e71ede
Commit
11e71ede
authored
Nov 10, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Don't call vectored exception handlers under the critical section.
parent
177a7e56
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
exception.c
dlls/ntdll/exception.c
+22
-3
No files found.
dlls/ntdll/exception.c
View file @
11e71ede
...
...
@@ -44,6 +44,7 @@ typedef struct
{
struct
list
entry
;
PVECTORED_EXCEPTION_HANDLER
func
;
ULONG
count
;
}
VECTORED_HANDLER
;
static
struct
list
vectored_handlers
=
LIST_INIT
(
vectored_handlers
);
...
...
@@ -158,21 +159,37 @@ LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
struct
list
*
ptr
;
LONG
ret
=
EXCEPTION_CONTINUE_SEARCH
;
EXCEPTION_POINTERS
except_ptrs
;
VECTORED_HANDLER
*
handler
,
*
to_free
=
NULL
;
except_ptrs
.
ExceptionRecord
=
rec
;
except_ptrs
.
ContextRecord
=
context
;
RtlEnterCriticalSection
(
&
vectored_handlers_section
);
LIST_FOR_EACH
(
ptr
,
&
vectored_handlers
)
ptr
=
list_head
(
&
vectored_handlers
);
while
(
ptr
)
{
VECTORED_HANDLER
*
handler
=
LIST_ENTRY
(
ptr
,
VECTORED_HANDLER
,
entry
);
handler
=
LIST_ENTRY
(
ptr
,
VECTORED_HANDLER
,
entry
);
handler
->
count
++
;
RtlLeaveCriticalSection
(
&
vectored_handlers_section
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
to_free
);
to_free
=
NULL
;
TRACE
(
"calling handler at %p code=%x flags=%x
\n
"
,
handler
->
func
,
rec
->
ExceptionCode
,
rec
->
ExceptionFlags
);
ret
=
handler
->
func
(
&
except_ptrs
);
TRACE
(
"handler at %p returned %x
\n
"
,
handler
->
func
,
ret
);
RtlEnterCriticalSection
(
&
vectored_handlers_section
);
ptr
=
list_next
(
&
vectored_handlers
,
ptr
);
if
(
!--
handler
->
count
)
/* removed during execution */
{
list_remove
(
&
handler
->
entry
);
to_free
=
handler
;
}
if
(
ret
==
EXCEPTION_CONTINUE_EXECUTION
)
break
;
}
RtlLeaveCriticalSection
(
&
vectored_handlers_section
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
to_free
);
return
ret
;
}
...
...
@@ -214,6 +231,7 @@ PVOID WINAPI RtlAddVectoredExceptionHandler( ULONG first, PVECTORED_EXCEPTION_HA
if
(
handler
)
{
handler
->
func
=
func
;
handler
->
count
=
1
;
RtlEnterCriticalSection
(
&
vectored_handlers_section
);
if
(
first
)
list_add_head
(
&
vectored_handlers
,
&
handler
->
entry
);
else
list_add_tail
(
&
vectored_handlers
,
&
handler
->
entry
);
...
...
@@ -237,7 +255,8 @@ ULONG WINAPI RtlRemoveVectoredExceptionHandler( PVOID handler )
VECTORED_HANDLER
*
curr_handler
=
LIST_ENTRY
(
ptr
,
VECTORED_HANDLER
,
entry
);
if
(
curr_handler
==
handler
)
{
list_remove
(
ptr
);
if
(
!--
curr_handler
->
count
)
list_remove
(
ptr
);
else
handler
=
NULL
;
/* don't free it yet */
ret
=
TRUE
;
break
;
}
...
...
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