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
8b87d6b8
Commit
8b87d6b8
authored
Jun 04, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move the mutex functions to the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
efd59e37
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
78 deletions
+123
-78
sync.c
dlls/ntdll/sync.c
+7
-77
loader.c
dlls/ntdll/unix/loader.c
+4
-0
sync.c
dlls/ntdll/unix/sync.c
+104
-0
unixlib.h
dlls/ntdll/unixlib.h
+8
-1
No files found.
dlls/ntdll/sync.c
View file @
8b87d6b8
...
...
@@ -357,29 +357,10 @@ NTSTATUS WINAPI NtQueryEvent( HANDLE handle, EVENT_INFORMATION_CLASS class,
* NtCreateMutant [NTDLL.@]
* ZwCreateMutant [NTDLL.@]
*/
NTSTATUS
WINAPI
NtCreateMutant
(
OUT
HANDLE
*
MutantHandle
,
IN
ACCESS_MASK
access
,
IN
const
OBJECT_ATTRIBUTES
*
attr
OPTIONAL
,
IN
BOOLEAN
InitialOwner
)
NTSTATUS
WINAPI
NtCreateMutant
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
BOOLEAN
owned
)
{
NTSTATUS
status
;
data_size_t
len
;
struct
object_attributes
*
objattr
;
if
((
status
=
alloc_object_attributes
(
attr
,
&
objattr
,
&
len
)))
return
status
;
SERVER_START_REQ
(
create_mutex
)
{
req
->
access
=
access
;
req
->
owned
=
InitialOwner
;
wine_server_add_data
(
req
,
objattr
,
len
);
status
=
wine_server_call
(
req
);
*
MutantHandle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
objattr
);
return
status
;
return
unix_funcs
->
NtCreateMutant
(
handle
,
access
,
attr
,
owned
);
}
/**************************************************************************
...
...
@@ -388,40 +369,16 @@ NTSTATUS WINAPI NtCreateMutant(OUT HANDLE* MutantHandle,
*/
NTSTATUS
WINAPI
NtOpenMutant
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
)
{
NTSTATUS
status
;
if
((
status
=
validate_open_object_attributes
(
attr
)))
return
status
;
SERVER_START_REQ
(
open_mutex
)
{
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
);
status
=
wine_server_call
(
req
);
*
handle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
return
status
;
return
unix_funcs
->
NtOpenMutant
(
handle
,
access
,
attr
);
}
/**************************************************************************
* NtReleaseMutant [NTDLL.@]
* ZwReleaseMutant [NTDLL.@]
*/
NTSTATUS
WINAPI
NtReleaseMutant
(
IN
HANDLE
handle
,
OUT
PLONG
prev_count
OPTIONAL
)
NTSTATUS
WINAPI
NtReleaseMutant
(
HANDLE
handle
,
LONG
*
prev_count
)
{
NTSTATUS
status
;
SERVER_START_REQ
(
release_mutex
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
status
=
wine_server_call
(
req
);
if
(
prev_count
)
*
prev_count
=
1
-
reply
->
prev_count
;
}
SERVER_END_REQ
;
return
status
;
return
unix_funcs
->
NtReleaseMutant
(
handle
,
prev_count
);
}
/******************************************************************
...
...
@@ -431,34 +388,7 @@ NTSTATUS WINAPI NtReleaseMutant( IN HANDLE handle, OUT PLONG prev_count OPTIONAL
NTSTATUS
WINAPI
NtQueryMutant
(
HANDLE
handle
,
MUTANT_INFORMATION_CLASS
class
,
void
*
info
,
ULONG
len
,
ULONG
*
ret_len
)
{
NTSTATUS
ret
;
MUTANT_BASIC_INFORMATION
*
out
=
info
;
TRACE
(
"(%p, %u, %p, %u, %p)
\n
"
,
handle
,
class
,
info
,
len
,
ret_len
);
if
(
class
!=
MutantBasicInformation
)
{
FIXME
(
"(%p, %d, %d) Unknown class
\n
"
,
handle
,
class
,
len
);
return
STATUS_INVALID_INFO_CLASS
;
}
if
(
len
!=
sizeof
(
MUTANT_BASIC_INFORMATION
))
return
STATUS_INFO_LENGTH_MISMATCH
;
SERVER_START_REQ
(
query_mutex
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
if
(
!
(
ret
=
wine_server_call
(
req
)))
{
out
->
CurrentCount
=
1
-
reply
->
count
;
out
->
OwnedByCaller
=
reply
->
owned
;
out
->
AbandonedState
=
reply
->
abandoned
;
if
(
ret_len
)
*
ret_len
=
sizeof
(
MUTANT_BASIC_INFORMATION
);
}
}
SERVER_END_REQ
;
return
ret
;
return
unix_funcs
->
NtQueryMutant
(
handle
,
class
,
info
,
len
,
ret_len
);
}
/*
...
...
dlls/ntdll/unix/loader.c
View file @
8b87d6b8
...
...
@@ -988,6 +988,7 @@ static struct unix_funcs unix_funcs =
NtClearEvent
,
NtClose
,
NtCreateEvent
,
NtCreateMutant
,
NtCreateSemaphore
,
NtCurrentTeb
,
NtDelayExecution
,
...
...
@@ -999,14 +1000,17 @@ static struct unix_funcs unix_funcs =
NtLockVirtualMemory
,
NtMapViewOfSection
,
NtOpenEvent
,
NtOpenMutant
,
NtOpenSemaphore
,
NtProtectVirtualMemory
,
NtPulseEvent
,
NtQueryEvent
,
NtQueryMutant
,
NtQuerySection
,
NtQuerySemaphore
,
NtQueryVirtualMemory
,
NtReadVirtualMemory
,
NtReleaseMutant
,
NtReleaseSemaphore
,
NtResetEvent
,
NtResetWriteWatch
,
...
...
dlls/ntdll/unix/sync.c
View file @
8b87d6b8
...
...
@@ -428,6 +428,110 @@ NTSTATUS WINAPI NtQueryEvent( HANDLE handle, EVENT_INFORMATION_CLASS class,
}
/******************************************************************************
* NtCreateMutant (NTDLL.@)
*/
NTSTATUS
WINAPI
NtCreateMutant
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
BOOLEAN
owned
)
{
NTSTATUS
ret
;
data_size_t
len
;
struct
object_attributes
*
objattr
;
if
((
ret
=
alloc_object_attributes
(
attr
,
&
objattr
,
&
len
)))
return
ret
;
SERVER_START_REQ
(
create_mutex
)
{
req
->
access
=
access
;
req
->
owned
=
owned
;
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
;
}
/**************************************************************************
* NtOpenMutant (NTDLL.@)
*/
NTSTATUS
WINAPI
NtOpenMutant
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
)
{
NTSTATUS
ret
;
if
((
ret
=
validate_open_object_attributes
(
attr
)))
return
ret
;
SERVER_START_REQ
(
open_mutex
)
{
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
;
}
/**************************************************************************
* NtReleaseMutant (NTDLL.@)
*/
NTSTATUS
WINAPI
NtReleaseMutant
(
HANDLE
handle
,
LONG
*
prev_count
)
{
NTSTATUS
ret
;
SERVER_START_REQ
(
release_mutex
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
ret
=
wine_server_call
(
req
);
if
(
prev_count
)
*
prev_count
=
1
-
reply
->
prev_count
;
}
SERVER_END_REQ
;
return
ret
;
}
/******************************************************************
* NtQueryMutant (NTDLL.@)
*/
NTSTATUS
WINAPI
NtQueryMutant
(
HANDLE
handle
,
MUTANT_INFORMATION_CLASS
class
,
void
*
info
,
ULONG
len
,
ULONG
*
ret_len
)
{
NTSTATUS
ret
;
MUTANT_BASIC_INFORMATION
*
out
=
info
;
TRACE
(
"(%p, %u, %p, %u, %p)
\n
"
,
handle
,
class
,
info
,
len
,
ret_len
);
if
(
class
!=
MutantBasicInformation
)
{
FIXME
(
"(%p, %d, %d) Unknown class
\n
"
,
handle
,
class
,
len
);
return
STATUS_INVALID_INFO_CLASS
;
}
if
(
len
!=
sizeof
(
MUTANT_BASIC_INFORMATION
))
return
STATUS_INFO_LENGTH_MISMATCH
;
SERVER_START_REQ
(
query_mutex
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
if
(
!
(
ret
=
wine_server_call
(
req
)))
{
out
->
CurrentCount
=
1
-
reply
->
count
;
out
->
OwnedByCaller
=
reply
->
owned
;
out
->
AbandonedState
=
reply
->
abandoned
;
if
(
ret_len
)
*
ret_len
=
sizeof
(
MUTANT_BASIC_INFORMATION
);
}
}
SERVER_END_REQ
;
return
ret
;
}
/******************************************************************
* NtWaitForMultipleObjects (NTDLL.@)
*/
...
...
dlls/ntdll/unixlib.h
View file @
8b87d6b8
...
...
@@ -28,7 +28,7 @@ struct ldt_copy;
struct
msghdr
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 2
3
#define NTDLL_UNIXLIB_VERSION 2
4
struct
unix_funcs
{
...
...
@@ -40,6 +40,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
*
NtCreateMutant
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
BOOLEAN
owned
);
NTSTATUS
(
WINAPI
*
NtCreateSemaphore
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
LONG
initial
,
LONG
max
);
TEB
*
(
WINAPI
*
NtCurrentTeb
)(
void
);
...
...
@@ -61,6 +63,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
*
NtOpenMutant
)(
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
,
...
...
@@ -68,6 +72,8 @@ struct unix_funcs
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
*
NtQueryMutant
)(
HANDLE
handle
,
MUTANT_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
,
...
...
@@ -77,6 +83,7 @@ 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
*
NtReleaseMutant
)(
HANDLE
handle
,
LONG
*
prev_count
);
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
);
...
...
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