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
efd59e37
Commit
efd59e37
authored
Jun 04, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move the event functions to the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
39915c9b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
181 additions
and
97 deletions
+181
-97
sync.c
dlls/ntdll/sync.c
+9
-96
loader.c
dlls/ntdll/unix/loader.c
+7
-0
sync.c
dlls/ntdll/unix/sync.c
+154
-0
unixlib.h
dlls/ntdll/unixlib.h
+11
-1
No files found.
dlls/ntdll/sync.c
View file @
efd59e37
...
...
@@ -285,28 +285,10 @@ NTSTATUS WINAPI NtReleaseSemaphore( HANDLE handle, ULONG count, PULONG previous
* NtCreateEvent (NTDLL.@)
* ZwCreateEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtCreateEvent
(
PHANDLE
EventHandle
,
ACCESS_MASK
DesiredAccess
,
const
OBJECT_ATTRIBUTES
*
attr
,
EVENT_TYPE
type
,
BOOLEAN
InitialState
)
NTSTATUS
WINAPI
NtCreateEvent
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
EVENT_TYPE
type
,
BOOLEAN
state
)
{
NTSTATUS
ret
;
data_size_t
len
;
struct
object_attributes
*
objattr
;
if
((
ret
=
alloc_object_attributes
(
attr
,
&
objattr
,
&
len
)))
return
ret
;
SERVER_START_REQ
(
create_event
)
{
req
->
access
=
DesiredAccess
;
req
->
manual_reset
=
(
type
==
NotificationEvent
);
req
->
initial_state
=
InitialState
;
wine_server_add_data
(
req
,
objattr
,
len
);
ret
=
wine_server_call
(
req
);
*
EventHandle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
objattr
);
return
ret
;
return
unix_funcs
->
NtCreateEvent
(
handle
,
access
,
attr
,
type
,
state
);
}
/******************************************************************************
...
...
@@ -315,22 +297,7 @@ NTSTATUS WINAPI NtCreateEvent( PHANDLE EventHandle, ACCESS_MASK DesiredAccess,
*/
NTSTATUS
WINAPI
NtOpenEvent
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
)
{
NTSTATUS
ret
;
if
((
ret
=
validate_open_object_attributes
(
attr
)))
return
ret
;
SERVER_START_REQ
(
open_event
)
{
req
->
access
=
access
;
req
->
attributes
=
attr
->
Attributes
;
req
->
rootdir
=
wine_server_obj_handle
(
attr
->
RootDirectory
);
if
(
attr
->
ObjectName
)
wine_server_add_data
(
req
,
attr
->
ObjectName
->
Buffer
,
attr
->
ObjectName
->
Length
);
ret
=
wine_server_call
(
req
);
*
handle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
return
ret
;
return
unix_funcs
->
NtOpenEvent
(
handle
,
access
,
attr
);
}
...
...
@@ -340,16 +307,7 @@ NTSTATUS WINAPI NtOpenEvent( HANDLE *handle, ACCESS_MASK access, const OBJECT_AT
*/
NTSTATUS
WINAPI
NtSetEvent
(
HANDLE
handle
,
LONG
*
prev_state
)
{
NTSTATUS
ret
;
SERVER_START_REQ
(
event_op
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
op
=
SET_EVENT
;
ret
=
wine_server_call
(
req
);
if
(
!
ret
&&
prev_state
)
*
prev_state
=
reply
->
state
;
}
SERVER_END_REQ
;
return
ret
;
return
unix_funcs
->
NtSetEvent
(
handle
,
prev_state
);
}
/******************************************************************************
...
...
@@ -357,16 +315,7 @@ NTSTATUS WINAPI NtSetEvent( HANDLE handle, LONG *prev_state )
*/
NTSTATUS
WINAPI
NtResetEvent
(
HANDLE
handle
,
LONG
*
prev_state
)
{
NTSTATUS
ret
;
SERVER_START_REQ
(
event_op
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
op
=
RESET_EVENT
;
ret
=
wine_server_call
(
req
);
if
(
!
ret
&&
prev_state
)
*
prev_state
=
reply
->
state
;
}
SERVER_END_REQ
;
return
ret
;
return
unix_funcs
->
NtResetEvent
(
handle
,
prev_state
);
}
/******************************************************************************
...
...
@@ -377,7 +326,7 @@ NTSTATUS WINAPI NtResetEvent( HANDLE handle, LONG *prev_state )
*/
NTSTATUS
WINAPI
NtClearEvent
(
HANDLE
handle
)
{
return
NtResetEvent
(
handle
,
NULL
);
return
unix_funcs
->
NtClearEvent
(
handle
);
}
/******************************************************************************
...
...
@@ -388,17 +337,7 @@ NTSTATUS WINAPI NtClearEvent ( HANDLE handle )
*/
NTSTATUS
WINAPI
NtPulseEvent
(
HANDLE
handle
,
LONG
*
prev_state
)
{
NTSTATUS
ret
;
SERVER_START_REQ
(
event_op
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
op
=
PULSE_EVENT
;
ret
=
wine_server_call
(
req
);
if
(
!
ret
&&
prev_state
)
*
prev_state
=
reply
->
state
;
}
SERVER_END_REQ
;
return
ret
;
return
unix_funcs
->
NtPulseEvent
(
handle
,
prev_state
);
}
/******************************************************************************
...
...
@@ -407,33 +346,7 @@ NTSTATUS WINAPI NtPulseEvent( HANDLE handle, LONG *prev_state )
NTSTATUS
WINAPI
NtQueryEvent
(
HANDLE
handle
,
EVENT_INFORMATION_CLASS
class
,
void
*
info
,
ULONG
len
,
ULONG
*
ret_len
)
{
NTSTATUS
ret
;
EVENT_BASIC_INFORMATION
*
out
=
info
;
TRACE
(
"(%p, %u, %p, %u, %p)
\n
"
,
handle
,
class
,
info
,
len
,
ret_len
);
if
(
class
!=
EventBasicInformation
)
{
FIXME
(
"(%p, %d, %d) Unknown class
\n
"
,
handle
,
class
,
len
);
return
STATUS_INVALID_INFO_CLASS
;
}
if
(
len
!=
sizeof
(
EVENT_BASIC_INFORMATION
))
return
STATUS_INFO_LENGTH_MISMATCH
;
SERVER_START_REQ
(
query_event
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
if
(
!
(
ret
=
wine_server_call
(
req
)))
{
out
->
EventType
=
reply
->
manual_reset
?
NotificationEvent
:
SynchronizationEvent
;
out
->
EventState
=
reply
->
state
;
if
(
ret_len
)
*
ret_len
=
sizeof
(
EVENT_BASIC_INFORMATION
);
}
}
SERVER_END_REQ
;
return
ret
;
return
unix_funcs
->
NtQueryEvent
(
handle
,
class
,
info
,
len
,
ret_len
);
}
/*
...
...
dlls/ntdll/unix/loader.c
View file @
efd59e37
...
...
@@ -985,7 +985,9 @@ static struct unix_funcs unix_funcs =
{
NtAllocateVirtualMemory
,
NtAreMappedFilesTheSame
,
NtClearEvent
,
NtClose
,
NtCreateEvent
,
NtCreateSemaphore
,
NtCurrentTeb
,
NtDelayExecution
,
...
...
@@ -996,15 +998,20 @@ static struct unix_funcs unix_funcs =
NtGetWriteWatch
,
NtLockVirtualMemory
,
NtMapViewOfSection
,
NtOpenEvent
,
NtOpenSemaphore
,
NtProtectVirtualMemory
,
NtPulseEvent
,
NtQueryEvent
,
NtQuerySection
,
NtQuerySemaphore
,
NtQueryVirtualMemory
,
NtReadVirtualMemory
,
NtReleaseSemaphore
,
NtResetEvent
,
NtResetWriteWatch
,
NtSetContextThread
,
NtSetEvent
,
NtSetLdtEntries
,
NtSignalAndWaitForSingleObject
,
NtUnlockVirtualMemory
,
...
...
dlls/ntdll/unix/sync.c
View file @
efd59e37
...
...
@@ -274,6 +274,160 @@ NTSTATUS WINAPI NtReleaseSemaphore( HANDLE handle, ULONG count, ULONG *previous
}
/**************************************************************************
* NtCreateEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtCreateEvent
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
EVENT_TYPE
type
,
BOOLEAN
state
)
{
NTSTATUS
ret
;
data_size_t
len
;
struct
object_attributes
*
objattr
;
if
((
ret
=
alloc_object_attributes
(
attr
,
&
objattr
,
&
len
)))
return
ret
;
SERVER_START_REQ
(
create_event
)
{
req
->
access
=
access
;
req
->
manual_reset
=
(
type
==
NotificationEvent
);
req
->
initial_state
=
state
;
wine_server_add_data
(
req
,
objattr
,
len
);
ret
=
wine_server_call
(
req
);
*
handle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
objattr
);
return
ret
;
}
/******************************************************************************
* NtOpenEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtOpenEvent
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
)
{
NTSTATUS
ret
;
if
((
ret
=
validate_open_object_attributes
(
attr
)))
return
ret
;
SERVER_START_REQ
(
open_event
)
{
req
->
access
=
access
;
req
->
attributes
=
attr
->
Attributes
;
req
->
rootdir
=
wine_server_obj_handle
(
attr
->
RootDirectory
);
if
(
attr
->
ObjectName
)
wine_server_add_data
(
req
,
attr
->
ObjectName
->
Buffer
,
attr
->
ObjectName
->
Length
);
ret
=
wine_server_call
(
req
);
*
handle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
return
ret
;
}
/******************************************************************************
* NtSetEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtSetEvent
(
HANDLE
handle
,
LONG
*
prev_state
)
{
NTSTATUS
ret
;
SERVER_START_REQ
(
event_op
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
op
=
SET_EVENT
;
ret
=
wine_server_call
(
req
);
if
(
!
ret
&&
prev_state
)
*
prev_state
=
reply
->
state
;
}
SERVER_END_REQ
;
return
ret
;
}
/******************************************************************************
* NtResetEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtResetEvent
(
HANDLE
handle
,
LONG
*
prev_state
)
{
NTSTATUS
ret
;
SERVER_START_REQ
(
event_op
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
op
=
RESET_EVENT
;
ret
=
wine_server_call
(
req
);
if
(
!
ret
&&
prev_state
)
*
prev_state
=
reply
->
state
;
}
SERVER_END_REQ
;
return
ret
;
}
/******************************************************************************
* NtClearEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtClearEvent
(
HANDLE
handle
)
{
/* FIXME: same as NtResetEvent ??? */
return
NtResetEvent
(
handle
,
NULL
);
}
/******************************************************************************
* NtPulseEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtPulseEvent
(
HANDLE
handle
,
LONG
*
prev_state
)
{
NTSTATUS
ret
;
SERVER_START_REQ
(
event_op
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
op
=
PULSE_EVENT
;
ret
=
wine_server_call
(
req
);
if
(
!
ret
&&
prev_state
)
*
prev_state
=
reply
->
state
;
}
SERVER_END_REQ
;
return
ret
;
}
/******************************************************************************
* NtQueryEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtQueryEvent
(
HANDLE
handle
,
EVENT_INFORMATION_CLASS
class
,
void
*
info
,
ULONG
len
,
ULONG
*
ret_len
)
{
NTSTATUS
ret
;
EVENT_BASIC_INFORMATION
*
out
=
info
;
TRACE
(
"(%p, %u, %p, %u, %p)
\n
"
,
handle
,
class
,
info
,
len
,
ret_len
);
if
(
class
!=
EventBasicInformation
)
{
FIXME
(
"(%p, %d, %d) Unknown class
\n
"
,
handle
,
class
,
len
);
return
STATUS_INVALID_INFO_CLASS
;
}
if
(
len
!=
sizeof
(
EVENT_BASIC_INFORMATION
))
return
STATUS_INFO_LENGTH_MISMATCH
;
SERVER_START_REQ
(
query_event
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
if
(
!
(
ret
=
wine_server_call
(
req
)))
{
out
->
EventType
=
reply
->
manual_reset
?
NotificationEvent
:
SynchronizationEvent
;
out
->
EventState
=
reply
->
state
;
if
(
ret_len
)
*
ret_len
=
sizeof
(
EVENT_BASIC_INFORMATION
);
}
}
SERVER_END_REQ
;
return
ret
;
}
/******************************************************************
* NtWaitForMultipleObjects (NTDLL.@)
*/
...
...
dlls/ntdll/unixlib.h
View file @
efd59e37
...
...
@@ -28,7 +28,7 @@ struct ldt_copy;
struct
msghdr
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 2
2
#define NTDLL_UNIXLIB_VERSION 2
3
struct
unix_funcs
{
...
...
@@ -36,7 +36,10 @@ struct unix_funcs
NTSTATUS
(
WINAPI
*
NtAllocateVirtualMemory
)(
HANDLE
process
,
PVOID
*
ret
,
ULONG_PTR
zero_bits
,
SIZE_T
*
size_ptr
,
ULONG
type
,
ULONG
protect
);
NTSTATUS
(
WINAPI
*
NtAreMappedFilesTheSame
)(
PVOID
addr1
,
PVOID
addr2
);
NTSTATUS
(
WINAPI
*
NtClearEvent
)(
HANDLE
handle
);
NTSTATUS
(
WINAPI
*
NtClose
)(
HANDLE
handle
);
NTSTATUS
(
WINAPI
*
NtCreateEvent
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
EVENT_TYPE
type
,
BOOLEAN
state
);
NTSTATUS
(
WINAPI
*
NtCreateSemaphore
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
LONG
initial
,
LONG
max
);
TEB
*
(
WINAPI
*
NtCurrentTeb
)(
void
);
...
...
@@ -56,10 +59,15 @@ struct unix_funcs
ULONG_PTR
zero_bits
,
SIZE_T
commit_size
,
const
LARGE_INTEGER
*
offset_ptr
,
SIZE_T
*
size_ptr
,
SECTION_INHERIT
inherit
,
ULONG
alloc_type
,
ULONG
protect
);
NTSTATUS
(
WINAPI
*
NtOpenEvent
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
);
NTSTATUS
(
WINAPI
*
NtOpenSemaphore
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
);
NTSTATUS
(
WINAPI
*
NtProtectVirtualMemory
)(
HANDLE
process
,
PVOID
*
addr_ptr
,
SIZE_T
*
size_ptr
,
ULONG
new_prot
,
ULONG
*
old_prot
);
NTSTATUS
(
WINAPI
*
NtPulseEvent
)(
HANDLE
handle
,
LONG
*
prev_state
);
NTSTATUS
(
WINAPI
*
NtQueryEvent
)(
HANDLE
handle
,
EVENT_INFORMATION_CLASS
class
,
void
*
info
,
ULONG
len
,
ULONG
*
ret_len
);
NTSTATUS
(
WINAPI
*
NtQuerySection
)(
HANDLE
handle
,
SECTION_INFORMATION_CLASS
class
,
void
*
ptr
,
SIZE_T
size
,
SIZE_T
*
ret_size
);
NTSTATUS
(
WINAPI
*
NtQuerySemaphore
)(
HANDLE
handle
,
SEMAPHORE_INFORMATION_CLASS
class
,
...
...
@@ -70,8 +78,10 @@ struct unix_funcs
NTSTATUS
(
WINAPI
*
NtReadVirtualMemory
)(
HANDLE
process
,
const
void
*
addr
,
void
*
buffer
,
SIZE_T
size
,
SIZE_T
*
bytes_read
);
NTSTATUS
(
WINAPI
*
NtReleaseSemaphore
)(
HANDLE
handle
,
ULONG
count
,
ULONG
*
previous
);
NTSTATUS
(
WINAPI
*
NtResetEvent
)(
HANDLE
handle
,
LONG
*
prev_state
);
NTSTATUS
(
WINAPI
*
NtResetWriteWatch
)(
HANDLE
process
,
PVOID
base
,
SIZE_T
size
);
NTSTATUS
(
WINAPI
*
NtSetContextThread
)(
HANDLE
handle
,
const
CONTEXT
*
context
);
NTSTATUS
(
WINAPI
*
NtSetEvent
)(
HANDLE
handle
,
LONG
*
prev_state
);
NTSTATUS
(
WINAPI
*
NtSetLdtEntries
)(
ULONG
sel1
,
LDT_ENTRY
entry1
,
ULONG
sel2
,
LDT_ENTRY
entry2
);
NTSTATUS
(
WINAPI
*
NtSignalAndWaitForSingleObject
)(
HANDLE
signal
,
HANDLE
wait
,
BOOLEAN
alertable
,
const
LARGE_INTEGER
*
timeout
);
...
...
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