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
275ee4b3
Commit
275ee4b3
authored
Nov 14, 2014
by
Sebastian Lackner
Committed by
Alexandre Julliard
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement Rtl[Add|Remove]VectoredContinueHandler semi-stubs.
parent
009b6a25
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
41 deletions
+49
-41
exception.c
dlls/ntdll/exception.c
+49
-36
exception.c
dlls/ntdll/tests/exception.c
+0
-5
No files found.
dlls/ntdll/exception.c
View file @
275ee4b3
...
...
@@ -47,7 +47,8 @@ typedef struct
ULONG
count
;
}
VECTORED_HANDLER
;
static
struct
list
vectored_handlers
=
LIST_INIT
(
vectored_handlers
);
static
struct
list
vectored_exception_handlers
=
LIST_INIT
(
vectored_exception_handlers
);
static
struct
list
vectored_continue_handlers
=
LIST_INIT
(
vectored_continue_handlers
);
static
RTL_CRITICAL_SECTION
vectored_handlers_section
;
static
RTL_CRITICAL_SECTION_DEBUG
critsect_debug
=
...
...
@@ -58,6 +59,47 @@ static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
};
static
RTL_CRITICAL_SECTION
vectored_handlers_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
VECTORED_HANDLER
*
add_vectored_handler
(
struct
list
*
handler_list
,
ULONG
first
,
PVECTORED_EXCEPTION_HANDLER
func
)
{
VECTORED_HANDLER
*
handler
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
handler
)
);
if
(
handler
)
{
handler
->
func
=
RtlEncodePointer
(
func
);
handler
->
count
=
1
;
RtlEnterCriticalSection
(
&
vectored_handlers_section
);
if
(
first
)
list_add_head
(
handler_list
,
&
handler
->
entry
);
else
list_add_tail
(
handler_list
,
&
handler
->
entry
);
RtlLeaveCriticalSection
(
&
vectored_handlers_section
);
}
return
handler
;
}
static
ULONG
remove_vectored_handler
(
struct
list
*
handler_list
,
VECTORED_HANDLER
*
handler
)
{
struct
list
*
ptr
;
ULONG
ret
=
FALSE
;
RtlEnterCriticalSection
(
&
vectored_handlers_section
);
LIST_FOR_EACH
(
ptr
,
handler_list
)
{
VECTORED_HANDLER
*
curr_handler
=
LIST_ENTRY
(
ptr
,
VECTORED_HANDLER
,
entry
);
if
(
curr_handler
==
handler
)
{
if
(
!--
curr_handler
->
count
)
list_remove
(
ptr
);
else
handler
=
NULL
;
/* don't free it yet */
ret
=
TRUE
;
break
;
}
}
RtlLeaveCriticalSection
(
&
vectored_handlers_section
);
if
(
ret
)
RtlFreeHeap
(
GetProcessHeap
(),
0
,
handler
);
return
ret
;
}
/**********************************************************************
* wait_suspend
*
...
...
@@ -165,7 +207,7 @@ LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
except_ptrs
.
ContextRecord
=
context
;
RtlEnterCriticalSection
(
&
vectored_handlers_section
);
ptr
=
list_head
(
&
vectored_handlers
);
ptr
=
list_head
(
&
vectored_
exception_
handlers
);
while
(
ptr
)
{
handler
=
LIST_ENTRY
(
ptr
,
VECTORED_HANDLER
,
entry
);
...
...
@@ -181,7 +223,7 @@ LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
TRACE
(
"handler at %p returned %x
\n
"
,
func
,
ret
);
RtlEnterCriticalSection
(
&
vectored_handlers_section
);
ptr
=
list_next
(
&
vectored_handlers
,
ptr
);
ptr
=
list_next
(
&
vectored_
exception_
handlers
,
ptr
);
if
(
!--
handler
->
count
)
/* removed during execution */
{
list_remove
(
&
handler
->
entry
);
...
...
@@ -228,8 +270,7 @@ void WINAPI RtlRaiseStatus( NTSTATUS status )
*/
PVOID
WINAPI
RtlAddVectoredContinueHandler
(
ULONG
first
,
PVECTORED_EXCEPTION_HANDLER
func
)
{
FIXME
(
"%u %p stub
\n
"
,
first
,
func
);
return
NULL
;
return
add_vectored_handler
(
&
vectored_continue_handlers
,
first
,
func
);
}
...
...
@@ -238,8 +279,7 @@ PVOID WINAPI RtlAddVectoredContinueHandler( ULONG first, PVECTORED_EXCEPTION_HAN
*/
ULONG
WINAPI
RtlRemoveVectoredContinueHandler
(
PVOID
handler
)
{
FIXME
(
"%p stub
\n
"
,
handler
);
return
FALSE
;
return
remove_vectored_handler
(
&
vectored_continue_handlers
,
handler
);
}
...
...
@@ -248,17 +288,7 @@ ULONG WINAPI RtlRemoveVectoredContinueHandler( PVOID handler )
*/
PVOID
WINAPI
RtlAddVectoredExceptionHandler
(
ULONG
first
,
PVECTORED_EXCEPTION_HANDLER
func
)
{
VECTORED_HANDLER
*
handler
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
handler
)
);
if
(
handler
)
{
handler
->
func
=
RtlEncodePointer
(
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
);
RtlLeaveCriticalSection
(
&
vectored_handlers_section
);
}
return
handler
;
return
add_vectored_handler
(
&
vectored_exception_handlers
,
first
,
func
);
}
...
...
@@ -267,24 +297,7 @@ PVOID WINAPI RtlAddVectoredExceptionHandler( ULONG first, PVECTORED_EXCEPTION_HA
*/
ULONG
WINAPI
RtlRemoveVectoredExceptionHandler
(
PVOID
handler
)
{
struct
list
*
ptr
;
ULONG
ret
=
FALSE
;
RtlEnterCriticalSection
(
&
vectored_handlers_section
);
LIST_FOR_EACH
(
ptr
,
&
vectored_handlers
)
{
VECTORED_HANDLER
*
curr_handler
=
LIST_ENTRY
(
ptr
,
VECTORED_HANDLER
,
entry
);
if
(
curr_handler
==
handler
)
{
if
(
!--
curr_handler
->
count
)
list_remove
(
ptr
);
else
handler
=
NULL
;
/* don't free it yet */
ret
=
TRUE
;
break
;
}
}
RtlLeaveCriticalSection
(
&
vectored_handlers_section
);
if
(
ret
)
RtlFreeHeap
(
GetProcessHeap
(),
0
,
handler
);
return
ret
;
return
remove_vectored_handler
(
&
vectored_exception_handlers
,
handler
);
}
...
...
dlls/ntdll/tests/exception.c
View file @
275ee4b3
...
...
@@ -1803,13 +1803,10 @@ static void test_vectored_continue_handler(void)
}
handler1
=
pRtlAddVectoredContinueHandler
(
TRUE
,
(
void
*
)
0xdeadbeef
);
todo_wine
ok
(
handler1
!=
0
,
"RtlAddVectoredContinueHandler failed
\n
"
);
handler2
=
pRtlAddVectoredContinueHandler
(
TRUE
,
(
void
*
)
0xdeadbeef
);
todo_wine
ok
(
handler2
!=
0
,
"RtlAddVectoredContinueHandler failed
\n
"
);
todo_wine
ok
(
handler1
!=
handler2
,
"RtlAddVectoredContinueHandler returned same handler
\n
"
);
if
(
pRtlRemoveVectoredExceptionHandler
)
...
...
@@ -1819,11 +1816,9 @@ static void test_vectored_continue_handler(void)
}
ret
=
pRtlRemoveVectoredContinueHandler
(
handler1
);
todo_wine
ok
(
ret
,
"RtlRemoveVectoredContinueHandler failed
\n
"
);
ret
=
pRtlRemoveVectoredContinueHandler
(
handler2
);
todo_wine
ok
(
ret
,
"RtlRemoveVectoredContinueHandler failed
\n
"
);
ret
=
pRtlRemoveVectoredContinueHandler
(
handler1
);
...
...
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