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
f1276b25
Commit
f1276b25
authored
Jun 04, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move the keyed event functions to the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
65edacf9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
109 additions
and
54 deletions
+109
-54
sync.c
dlls/ntdll/sync.c
+4
-53
loader.c
dlls/ntdll/unix/loader.c
+4
-0
sync.c
dlls/ntdll/unix/sync.c
+90
-0
thread.c
dlls/ntdll/unix/thread.c
+1
-0
unix_private.h
dlls/ntdll/unix/unix_private.h
+1
-0
unixlib.h
dlls/ntdll/unixlib.h
+9
-1
No files found.
dlls/ntdll/sync.c
View file @
f1276b25
...
...
@@ -775,23 +775,7 @@ NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeou
NTSTATUS
WINAPI
NtCreateKeyedEvent
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
ULONG
flags
)
{
NTSTATUS
ret
;
data_size_t
len
;
struct
object_attributes
*
objattr
;
if
((
ret
=
alloc_object_attributes
(
attr
,
&
objattr
,
&
len
)))
return
ret
;
SERVER_START_REQ
(
create_keyed_event
)
{
req
->
access
=
access
;
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
;
return
unix_funcs
->
NtCreateKeyedEvent
(
handle
,
access
,
attr
,
flags
);
}
/******************************************************************************
...
...
@@ -799,22 +783,7 @@ NTSTATUS WINAPI NtCreateKeyedEvent( HANDLE *handle, ACCESS_MASK access,
*/
NTSTATUS
WINAPI
NtOpenKeyedEvent
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
)
{
NTSTATUS
ret
;
if
((
ret
=
validate_open_object_attributes
(
attr
)))
return
ret
;
SERVER_START_REQ
(
open_keyed_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
->
NtOpenKeyedEvent
(
handle
,
access
,
attr
);
}
/******************************************************************************
...
...
@@ -823,16 +792,7 @@ NTSTATUS WINAPI NtOpenKeyedEvent( HANDLE *handle, ACCESS_MASK access, const OBJE
NTSTATUS
WINAPI
NtWaitForKeyedEvent
(
HANDLE
handle
,
const
void
*
key
,
BOOLEAN
alertable
,
const
LARGE_INTEGER
*
timeout
)
{
select_op_t
select_op
;
UINT
flags
=
SELECT_INTERRUPTIBLE
;
if
(
!
handle
)
handle
=
keyed_event
;
if
((
ULONG_PTR
)
key
&
1
)
return
STATUS_INVALID_PARAMETER_1
;
if
(
alertable
)
flags
|=
SELECT_ALERTABLE
;
select_op
.
keyed_event
.
op
=
SELECT_KEYED_EVENT_WAIT
;
select_op
.
keyed_event
.
handle
=
wine_server_obj_handle
(
handle
);
select_op
.
keyed_event
.
key
=
wine_server_client_ptr
(
key
);
return
unix_funcs
->
server_wait
(
&
select_op
,
sizeof
(
select_op
.
keyed_event
),
flags
,
timeout
);
return
unix_funcs
->
NtWaitForKeyedEvent
(
handle
,
key
,
alertable
,
timeout
);
}
/******************************************************************************
...
...
@@ -841,16 +801,7 @@ NTSTATUS WINAPI NtWaitForKeyedEvent( HANDLE handle, const void *key,
NTSTATUS
WINAPI
NtReleaseKeyedEvent
(
HANDLE
handle
,
const
void
*
key
,
BOOLEAN
alertable
,
const
LARGE_INTEGER
*
timeout
)
{
select_op_t
select_op
;
UINT
flags
=
SELECT_INTERRUPTIBLE
;
if
(
!
handle
)
handle
=
keyed_event
;
if
((
ULONG_PTR
)
key
&
1
)
return
STATUS_INVALID_PARAMETER_1
;
if
(
alertable
)
flags
|=
SELECT_ALERTABLE
;
select_op
.
keyed_event
.
op
=
SELECT_KEYED_EVENT_RELEASE
;
select_op
.
keyed_event
.
handle
=
wine_server_obj_handle
(
handle
);
select_op
.
keyed_event
.
key
=
wine_server_client_ptr
(
key
);
return
unix_funcs
->
server_wait
(
&
select_op
,
sizeof
(
select_op
.
keyed_event
),
flags
,
timeout
);
return
unix_funcs
->
NtReleaseKeyedEvent
(
handle
,
key
,
alertable
,
timeout
);
}
/******************************************************************
...
...
dlls/ntdll/unix/loader.c
View file @
f1276b25
...
...
@@ -989,6 +989,7 @@ static struct unix_funcs unix_funcs =
NtClearEvent
,
NtClose
,
NtCreateEvent
,
NtCreateKeyedEvent
,
NtCreateMutant
,
NtCreateSemaphore
,
NtCreateTimer
,
...
...
@@ -1002,6 +1003,7 @@ static struct unix_funcs unix_funcs =
NtLockVirtualMemory
,
NtMapViewOfSection
,
NtOpenEvent
,
NtOpenKeyedEvent
,
NtOpenMutant
,
NtOpenSemaphore
,
NtOpenTimer
,
...
...
@@ -1014,6 +1016,7 @@ static struct unix_funcs unix_funcs =
NtQueryTimer
,
NtQueryVirtualMemory
,
NtReadVirtualMemory
,
NtReleaseKeyedEvent
,
NtReleaseMutant
,
NtReleaseSemaphore
,
NtResetEvent
,
...
...
@@ -1025,6 +1028,7 @@ static struct unix_funcs unix_funcs =
NtSignalAndWaitForSingleObject
,
NtUnlockVirtualMemory
,
NtUnmapViewOfSection
,
NtWaitForKeyedEvent
,
NtWaitForMultipleObjects
,
NtWaitForSingleObject
,
NtWriteVirtualMemory
,
...
...
dlls/ntdll/unix/sync.c
View file @
f1276b25
...
...
@@ -68,6 +68,9 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
sync
);
HANDLE
keyed_event
=
0
;
/* create a struct security_descriptor and contained information in one contiguous piece of memory */
static
NTSTATUS
alloc_object_attributes
(
const
OBJECT_ATTRIBUTES
*
attr
,
struct
object_attributes
**
ret
,
data_size_t
*
ret_len
)
...
...
@@ -781,3 +784,90 @@ NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeou
}
return
STATUS_SUCCESS
;
}
/******************************************************************************
* NtCreateKeyedEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtCreateKeyedEvent
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
ULONG
flags
)
{
NTSTATUS
ret
;
data_size_t
len
;
struct
object_attributes
*
objattr
;
if
((
ret
=
alloc_object_attributes
(
attr
,
&
objattr
,
&
len
)))
return
ret
;
SERVER_START_REQ
(
create_keyed_event
)
{
req
->
access
=
access
;
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
;
}
/******************************************************************************
* NtOpenKeyedEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtOpenKeyedEvent
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
)
{
NTSTATUS
ret
;
if
((
ret
=
validate_open_object_attributes
(
attr
)))
return
ret
;
SERVER_START_REQ
(
open_keyed_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
;
}
/******************************************************************************
* NtWaitForKeyedEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtWaitForKeyedEvent
(
HANDLE
handle
,
const
void
*
key
,
BOOLEAN
alertable
,
const
LARGE_INTEGER
*
timeout
)
{
select_op_t
select_op
;
UINT
flags
=
SELECT_INTERRUPTIBLE
;
if
(
!
handle
)
handle
=
keyed_event
;
if
((
ULONG_PTR
)
key
&
1
)
return
STATUS_INVALID_PARAMETER_1
;
if
(
alertable
)
flags
|=
SELECT_ALERTABLE
;
select_op
.
keyed_event
.
op
=
SELECT_KEYED_EVENT_WAIT
;
select_op
.
keyed_event
.
handle
=
wine_server_obj_handle
(
handle
);
select_op
.
keyed_event
.
key
=
wine_server_client_ptr
(
key
);
return
server_wait
(
&
select_op
,
sizeof
(
select_op
.
keyed_event
),
flags
,
timeout
);
}
/******************************************************************************
* NtReleaseKeyedEvent (NTDLL.@)
*/
NTSTATUS
WINAPI
NtReleaseKeyedEvent
(
HANDLE
handle
,
const
void
*
key
,
BOOLEAN
alertable
,
const
LARGE_INTEGER
*
timeout
)
{
select_op_t
select_op
;
UINT
flags
=
SELECT_INTERRUPTIBLE
;
if
(
!
handle
)
handle
=
keyed_event
;
if
((
ULONG_PTR
)
key
&
1
)
return
STATUS_INVALID_PARAMETER_1
;
if
(
alertable
)
flags
|=
SELECT_ALERTABLE
;
select_op
.
keyed_event
.
op
=
SELECT_KEYED_EVENT_RELEASE
;
select_op
.
keyed_event
.
handle
=
wine_server_obj_handle
(
handle
);
select_op
.
keyed_event
.
key
=
wine_server_client_ptr
(
key
);
return
server_wait
(
&
select_op
,
sizeof
(
select_op
.
keyed_event
),
flags
,
timeout
);
}
dlls/ntdll/unix/thread.c
View file @
f1276b25
...
...
@@ -108,6 +108,7 @@ TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZ
server_init_process
();
info_size
=
server_init_thread
(
teb
->
Peb
,
suspend
);
virtual_map_user_shared_data
();
NtCreateKeyedEvent
(
&
keyed_event
,
GENERIC_READ
|
GENERIC_WRITE
,
NULL
,
0
);
if
(
size
)
*
size
=
info_size
;
if
(
cpus
)
*
cpus
=
server_cpus
;
...
...
dlls/ntdll/unix/unix_private.h
View file @
f1276b25
...
...
@@ -112,6 +112,7 @@ extern const char *build_dir DECLSPEC_HIDDEN;
extern
const
char
*
config_dir
DECLSPEC_HIDDEN
;
extern
unsigned
int
server_cpus
DECLSPEC_HIDDEN
;
extern
BOOL
is_wow64
DECLSPEC_HIDDEN
;
extern
HANDLE
keyed_event
DECLSPEC_HIDDEN
;
extern
timeout_t
server_start_time
DECLSPEC_HIDDEN
;
extern
sigset_t
server_block_set
DECLSPEC_HIDDEN
;
extern
SIZE_T
signal_stack_size
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/unixlib.h
View file @
f1276b25
...
...
@@ -28,7 +28,7 @@ struct ldt_copy;
struct
msghdr
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 2
5
#define NTDLL_UNIXLIB_VERSION 2
6
struct
unix_funcs
{
...
...
@@ -41,6 +41,8 @@ struct unix_funcs
NTSTATUS
(
WINAPI
*
NtClose
)(
HANDLE
handle
);
NTSTATUS
(
WINAPI
*
NtCreateEvent
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
EVENT_TYPE
type
,
BOOLEAN
state
);
NTSTATUS
(
WINAPI
*
NtCreateKeyedEvent
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
ULONG
flags
);
NTSTATUS
(
WINAPI
*
NtCreateMutant
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
BOOLEAN
owned
);
NTSTATUS
(
WINAPI
*
NtCreateSemaphore
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
...
...
@@ -66,6 +68,8 @@ struct unix_funcs
SECTION_INHERIT
inherit
,
ULONG
alloc_type
,
ULONG
protect
);
NTSTATUS
(
WINAPI
*
NtOpenEvent
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
);
NTSTATUS
(
WINAPI
*
NtOpenKeyedEvent
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
);
NTSTATUS
(
WINAPI
*
NtOpenMutant
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
);
NTSTATUS
(
WINAPI
*
NtOpenSemaphore
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
...
...
@@ -90,6 +94,8 @@ struct unix_funcs
PVOID
buffer
,
SIZE_T
len
,
SIZE_T
*
res_len
);
NTSTATUS
(
WINAPI
*
NtReadVirtualMemory
)(
HANDLE
process
,
const
void
*
addr
,
void
*
buffer
,
SIZE_T
size
,
SIZE_T
*
bytes_read
);
NTSTATUS
(
WINAPI
*
NtReleaseKeyedEvent
)(
HANDLE
handle
,
const
void
*
key
,
BOOLEAN
alertable
,
const
LARGE_INTEGER
*
timeout
);
NTSTATUS
(
WINAPI
*
NtReleaseMutant
)(
HANDLE
handle
,
LONG
*
prev_count
);
NTSTATUS
(
WINAPI
*
NtReleaseSemaphore
)(
HANDLE
handle
,
ULONG
count
,
ULONG
*
previous
);
NTSTATUS
(
WINAPI
*
NtResetEvent
)(
HANDLE
handle
,
LONG
*
prev_state
);
...
...
@@ -105,6 +111,8 @@ struct unix_funcs
NTSTATUS
(
WINAPI
*
NtUnlockVirtualMemory
)(
HANDLE
process
,
PVOID
*
addr
,
SIZE_T
*
size
,
ULONG
unknown
);
NTSTATUS
(
WINAPI
*
NtUnmapViewOfSection
)(
HANDLE
process
,
PVOID
addr
);
NTSTATUS
(
WINAPI
*
NtWaitForKeyedEvent
)(
HANDLE
handle
,
const
void
*
key
,
BOOLEAN
alertable
,
const
LARGE_INTEGER
*
timeout
);
NTSTATUS
(
WINAPI
*
NtWaitForMultipleObjects
)(
DWORD
count
,
const
HANDLE
*
handles
,
BOOLEAN
wait_any
,
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