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
06fa3d32
Commit
06fa3d32
authored
Jun 13, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move the IO completion functions to the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
948a6a47
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
223 additions
and
210 deletions
+223
-210
sync.c
dlls/ntdll/sync.c
+14
-209
loader.c
dlls/ntdll/unix/loader.c
+6
-0
sync.c
dlls/ntdll/unix/sync.c
+189
-0
unixlib.h
dlls/ntdll/unixlib.h
+14
-1
No files found.
dlls/ntdll/sync.c
View file @
06fa3d32
This diff is collapsed.
Click to expand it.
dlls/ntdll/unix/loader.c
View file @
06fa3d32
...
...
@@ -826,6 +826,7 @@ static struct unix_funcs unix_funcs =
NtContinue
,
NtCreateEvent
,
NtCreateFile
,
NtCreateIoCompletion
,
NtCreateKeyedEvent
,
NtCreateMailslotFile
,
NtCreateMutant
,
...
...
@@ -846,6 +847,7 @@ static struct unix_funcs unix_funcs =
NtMapViewOfSection
,
NtOpenEvent
,
NtOpenFile
,
NtOpenIoCompletion
,
NtOpenKeyedEvent
,
NtOpenMutant
,
NtOpenSection
,
...
...
@@ -858,6 +860,7 @@ static struct unix_funcs unix_funcs =
NtQueryDirectoryFile
,
NtQueryEvent
,
NtQueryFullAttributesFile
,
NtQueryIoCompletion
,
NtQueryMutant
,
NtQueryPerformanceCounter
,
NtQuerySection
,
...
...
@@ -871,11 +874,14 @@ static struct unix_funcs unix_funcs =
NtReleaseKeyedEvent
,
NtReleaseMutant
,
NtReleaseSemaphore
,
NtRemoveIoCompletion
,
NtRemoveIoCompletionEx
,
NtResetEvent
,
NtResetWriteWatch
,
NtResumeThread
,
NtSetContextThread
,
NtSetEvent
,
NtSetIoCompletion
,
NtSetLdtEntries
,
NtSetSystemTime
,
NtSetTimer
,
...
...
dlls/ntdll/unix/sync.c
View file @
06fa3d32
...
...
@@ -1100,6 +1100,195 @@ NTSTATUS WINAPI NtReleaseKeyedEvent( HANDLE handle, const void *key,
/***********************************************************************
* NtCreateIoCompletion (NTDLL.@)
*/
NTSTATUS
WINAPI
NtCreateIoCompletion
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
OBJECT_ATTRIBUTES
*
attr
,
ULONG
threads
)
{
NTSTATUS
status
;
data_size_t
len
;
struct
object_attributes
*
objattr
;
TRACE
(
"(%p, %x, %p, %d)
\n
"
,
handle
,
access
,
attr
,
threads
);
if
(
!
handle
)
return
STATUS_INVALID_PARAMETER
;
if
((
status
=
alloc_object_attributes
(
attr
,
&
objattr
,
&
len
)))
return
status
;
SERVER_START_REQ
(
create_completion
)
{
req
->
access
=
access
;
req
->
concurrent
=
threads
;
wine_server_add_data
(
req
,
objattr
,
len
);
if
(
!
(
status
=
wine_server_call
(
req
)))
*
handle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
objattr
);
return
status
;
}
/***********************************************************************
* NtOpenIoCompletion (NTDLL.@)
*/
NTSTATUS
WINAPI
NtOpenIoCompletion
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
)
{
NTSTATUS
status
;
if
(
!
handle
)
return
STATUS_INVALID_PARAMETER
;
if
((
status
=
validate_open_object_attributes
(
attr
)))
return
status
;
SERVER_START_REQ
(
open_completion
)
{
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
;
}
/***********************************************************************
* NtSetIoCompletion (NTDLL.@)
*/
NTSTATUS
WINAPI
NtSetIoCompletion
(
HANDLE
handle
,
ULONG_PTR
key
,
ULONG_PTR
value
,
NTSTATUS
status
,
SIZE_T
count
)
{
NTSTATUS
ret
;
TRACE
(
"(%p, %lx, %lx, %x, %lx)
\n
"
,
handle
,
key
,
value
,
status
,
count
);
SERVER_START_REQ
(
add_completion
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
ckey
=
key
;
req
->
cvalue
=
value
;
req
->
status
=
status
;
req
->
information
=
count
;
ret
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
return
ret
;
}
/***********************************************************************
* NtRemoveIoCompletion (NTDLL.@)
*/
NTSTATUS
WINAPI
NtRemoveIoCompletion
(
HANDLE
handle
,
ULONG_PTR
*
key
,
ULONG_PTR
*
value
,
IO_STATUS_BLOCK
*
io
,
LARGE_INTEGER
*
timeout
)
{
NTSTATUS
status
;
TRACE
(
"(%p, %p, %p, %p, %p)
\n
"
,
handle
,
key
,
value
,
io
,
timeout
);
for
(;;)
{
SERVER_START_REQ
(
remove_completion
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
if
(
!
(
status
=
wine_server_call
(
req
)))
{
*
key
=
reply
->
ckey
;
*
value
=
reply
->
cvalue
;
io
->
Information
=
reply
->
information
;
io
->
u
.
Status
=
reply
->
status
;
}
}
SERVER_END_REQ
;
if
(
status
!=
STATUS_PENDING
)
return
status
;
status
=
NtWaitForSingleObject
(
handle
,
FALSE
,
timeout
);
if
(
status
!=
WAIT_OBJECT_0
)
return
status
;
}
}
/***********************************************************************
* NtRemoveIoCompletionEx (NTDLL.@)
*/
NTSTATUS
WINAPI
NtRemoveIoCompletionEx
(
HANDLE
handle
,
FILE_IO_COMPLETION_INFORMATION
*
info
,
ULONG
count
,
ULONG
*
written
,
LARGE_INTEGER
*
timeout
,
BOOLEAN
alertable
)
{
NTSTATUS
status
;
ULONG
i
=
0
;
TRACE
(
"%p %p %u %p %p %u
\n
"
,
handle
,
info
,
count
,
written
,
timeout
,
alertable
);
for
(;;)
{
while
(
i
<
count
)
{
SERVER_START_REQ
(
remove_completion
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
if
(
!
(
status
=
wine_server_call
(
req
)))
{
info
[
i
].
CompletionKey
=
reply
->
ckey
;
info
[
i
].
CompletionValue
=
reply
->
cvalue
;
info
[
i
].
IoStatusBlock
.
Information
=
reply
->
information
;
info
[
i
].
IoStatusBlock
.
u
.
Status
=
reply
->
status
;
}
}
SERVER_END_REQ
;
if
(
status
!=
STATUS_SUCCESS
)
break
;
++
i
;
}
if
(
i
||
status
!=
STATUS_PENDING
)
{
if
(
status
==
STATUS_PENDING
)
status
=
STATUS_SUCCESS
;
break
;
}
status
=
NtWaitForSingleObject
(
handle
,
alertable
,
timeout
);
if
(
status
!=
WAIT_OBJECT_0
)
break
;
}
*
written
=
i
?
i
:
1
;
return
status
;
}
/***********************************************************************
* NtQueryIoCompletion (NTDLL.@)
*/
NTSTATUS
WINAPI
NtQueryIoCompletion
(
HANDLE
handle
,
IO_COMPLETION_INFORMATION_CLASS
class
,
void
*
buffer
,
ULONG
len
,
ULONG
*
ret_len
)
{
NTSTATUS
status
;
TRACE
(
"(%p, %d, %p, 0x%x, %p)
\n
"
,
handle
,
class
,
buffer
,
len
,
ret_len
);
if
(
!
buffer
)
return
STATUS_INVALID_PARAMETER
;
switch
(
class
)
{
case
IoCompletionBasicInformation
:
{
ULONG
*
info
=
buffer
;
if
(
ret_len
)
*
ret_len
=
sizeof
(
*
info
);
if
(
len
==
sizeof
(
*
info
))
{
SERVER_START_REQ
(
query_completion
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
if
(
!
(
status
=
wine_server_call
(
req
)))
*
info
=
reply
->
depth
;
}
SERVER_END_REQ
;
}
else
status
=
STATUS_INFO_LENGTH_MISMATCH
;
break
;
}
default:
return
STATUS_INVALID_PARAMETER
;
}
return
status
;
}
/***********************************************************************
* NtCreateSection (NTDLL.@)
*/
NTSTATUS
WINAPI
NtCreateSection
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
...
...
dlls/ntdll/unixlib.h
View file @
06fa3d32
...
...
@@ -28,7 +28,7 @@ struct ldt_copy;
struct
msghdr
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 4
3
#define NTDLL_UNIXLIB_VERSION 4
4
struct
unix_funcs
{
...
...
@@ -48,6 +48,8 @@ struct unix_funcs
IO_STATUS_BLOCK
*
io
,
LARGE_INTEGER
*
alloc_size
,
ULONG
attributes
,
ULONG
sharing
,
ULONG
disposition
,
ULONG
options
,
void
*
ea_buffer
,
ULONG
ea_length
);
NTSTATUS
(
WINAPI
*
NtCreateIoCompletion
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
OBJECT_ATTRIBUTES
*
attr
,
ULONG
threads
);
NTSTATUS
(
WINAPI
*
NtCreateKeyedEvent
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
ULONG
flags
);
NTSTATUS
(
WINAPI
*
NtCreateMailslotFile
)(
HANDLE
*
handle
,
ULONG
access
,
OBJECT_ATTRIBUTES
*
attr
,
...
...
@@ -94,6 +96,8 @@ struct unix_funcs
const
OBJECT_ATTRIBUTES
*
attr
);
NTSTATUS
(
WINAPI
*
NtOpenFile
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
OBJECT_ATTRIBUTES
*
attr
,
IO_STATUS_BLOCK
*
io
,
ULONG
sharing
,
ULONG
options
);
NTSTATUS
(
WINAPI
*
NtOpenIoCompletion
)(
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
,
...
...
@@ -119,6 +123,8 @@ struct unix_funcs
void
*
info
,
ULONG
len
,
ULONG
*
ret_len
);
NTSTATUS
(
WINAPI
*
NtQueryFullAttributesFile
)(
const
OBJECT_ATTRIBUTES
*
attr
,
FILE_NETWORK_OPEN_INFORMATION
*
info
);
NTSTATUS
(
WINAPI
*
NtQueryIoCompletion
)(
HANDLE
handle
,
IO_COMPLETION_INFORMATION_CLASS
class
,
void
*
buffer
,
ULONG
len
,
ULONG
*
ret_len
);
NTSTATUS
(
WINAPI
*
NtQueryMutant
)(
HANDLE
handle
,
MUTANT_INFORMATION_CLASS
class
,
void
*
info
,
ULONG
len
,
ULONG
*
ret_len
);
NTSTATUS
(
WINAPI
*
NtQueryPerformanceCounter
)(
LARGE_INTEGER
*
counter
,
LARGE_INTEGER
*
frequency
);
...
...
@@ -141,11 +147,18 @@ struct unix_funcs
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
*
NtRemoveIoCompletion
)(
HANDLE
handle
,
ULONG_PTR
*
key
,
ULONG_PTR
*
value
,
IO_STATUS_BLOCK
*
io
,
LARGE_INTEGER
*
timeout
);
NTSTATUS
(
WINAPI
*
NtRemoveIoCompletionEx
)(
HANDLE
handle
,
FILE_IO_COMPLETION_INFORMATION
*
info
,
ULONG
count
,
ULONG
*
written
,
LARGE_INTEGER
*
timeout
,
BOOLEAN
alertable
);
NTSTATUS
(
WINAPI
*
NtResetEvent
)(
HANDLE
handle
,
LONG
*
prev_state
);
NTSTATUS
(
WINAPI
*
NtResetWriteWatch
)(
HANDLE
process
,
PVOID
base
,
SIZE_T
size
);
NTSTATUS
(
WINAPI
*
NtResumeThread
)(
HANDLE
handle
,
ULONG
*
count
);
NTSTATUS
(
WINAPI
*
NtSetContextThread
)(
HANDLE
handle
,
const
CONTEXT
*
context
);
NTSTATUS
(
WINAPI
*
NtSetEvent
)(
HANDLE
handle
,
LONG
*
prev_state
);
NTSTATUS
(
WINAPI
*
NtSetIoCompletion
)(
HANDLE
handle
,
ULONG_PTR
key
,
ULONG_PTR
value
,
NTSTATUS
status
,
SIZE_T
count
);
NTSTATUS
(
WINAPI
*
NtSetLdtEntries
)(
ULONG
sel1
,
LDT_ENTRY
entry1
,
ULONG
sel2
,
LDT_ENTRY
entry2
);
NTSTATUS
(
WINAPI
*
NtSetSystemTime
)(
const
LARGE_INTEGER
*
new
,
LARGE_INTEGER
*
old
);
NTSTATUS
(
WINAPI
*
NtSetTimer
)(
HANDLE
handle
,
const
LARGE_INTEGER
*
when
,
...
...
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