Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
d74b084e
Commit
d74b084e
authored
Feb 21, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Pass the NtCreateNamedPipeFile disposition to the server.
parent
2436964d
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
13 deletions
+87
-13
sync.c
dlls/kernelbase/sync.c
+2
-2
om.c
dlls/ntdll/tests/om.c
+58
-1
pipe.c
dlls/ntdll/tests/pipe.c
+3
-3
file.c
dlls/ntdll/unix/file.c
+1
-0
server_protocol.h
include/wine/server_protocol.h
+2
-2
named_pipe.c
server/named_pipe.c
+15
-2
protocol.def
server/protocol.def
+1
-0
request.h
server/request.h
+4
-3
trace.c
server/trace.c
+1
-0
No files found.
dlls/kernelbase/sync.c
View file @
d74b084e
...
...
@@ -1307,7 +1307,7 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateNamedPipeW( LPCWSTR name, DWORD open_mode,
time
.
QuadPart
=
(
ULONGLONG
)
timeout
*
-
10000
;
SetLastError
(
0
);
status
=
NtCreateNamedPipeFile
(
&
handle
,
access
,
&
attr
,
&
iosb
,
sharing
,
FILE_O
VERWRITE
_IF
,
options
,
pipe_type
,
FILE_O
PEN
_IF
,
options
,
pipe_type
,
read_mode
,
non_block
,
instances
,
in_buff
,
out_buff
,
&
time
);
RtlFreeUnicodeString
(
&
nt_name
);
if
(
!
set_ntstatus
(
status
))
return
INVALID_HANDLE_VALUE
;
...
...
@@ -1348,7 +1348,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreatePipe( HANDLE *read_pipe, HANDLE *write_pipe,
GetCurrentProcessId
(),
++
index
);
RtlInitUnicodeString
(
&
nt_name
,
name
);
if
(
!
NtCreateNamedPipeFile
(
read_pipe
,
GENERIC_READ
|
FILE_WRITE_ATTRIBUTES
|
SYNCHRONIZE
,
&
attr
,
&
iosb
,
FILE_SHARE_WRITE
,
FILE_O
VERWRITE
_IF
,
&
attr
,
&
iosb
,
FILE_SHARE_WRITE
,
FILE_O
PEN
_IF
,
FILE_SYNCHRONOUS_IO_NONALERT
,
FALSE
,
FALSE
,
FALSE
,
1
,
size
,
size
,
&
timeout
))
break
;
...
...
dlls/ntdll/tests/om.c
View file @
d74b084e
...
...
@@ -272,7 +272,8 @@ static void test_name_collisions(void)
OBJECT_ATTRIBUTES
attr
;
HANDLE
dir
,
h
,
h1
,
h2
;
DWORD
winerr
;
LARGE_INTEGER
size
;
LARGE_INTEGER
size
,
timeout
;
IO_STATUS_BLOCK
iosb
;
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
RtlInitUnicodeString
(
&
str
,
L"
\\
"
);
...
...
@@ -362,6 +363,62 @@ static void test_name_collisions(void)
pNtClose
(
h2
);
pNtClose
(
dir
);
RtlInitUnicodeString
(
&
str
,
L"
\\
??
\\
PIPE
\\
named_pipe"
);
attr
.
RootDirectory
=
0
;
timeout
.
QuadPart
=
-
10000
;
status
=
pNtCreateNamedPipeFile
(
&
h
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
10
,
256
,
256
,
&
timeout
);
ok
(
status
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"failed to create pipe %08lx
\n
"
,
status
);
memset
(
&
iosb
,
0xcc
,
sizeof
(
iosb
)
);
status
=
pNtCreateNamedPipeFile
(
&
h
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN_IF
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
10
,
256
,
256
,
&
timeout
);
ok
(
status
==
STATUS_SUCCESS
,
"failed to create pipe %08lx
\n
"
,
status
);
todo_wine
ok
(
iosb
.
Information
==
FILE_CREATED
,
"wrong info %Ix
\n
"
,
iosb
.
Information
);
pNtClose
(
h
);
memset
(
&
iosb
,
0xcc
,
sizeof
(
iosb
)
);
status
=
pNtCreateNamedPipeFile
(
&
h
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
10
,
256
,
256
,
&
timeout
);
ok
(
status
==
STATUS_SUCCESS
,
"failed to create pipe %08lx
\n
"
,
status
);
todo_wine
ok
(
iosb
.
Information
==
FILE_CREATED
,
"wrong info %Ix
\n
"
,
iosb
.
Information
);
memset
(
&
iosb
,
0xcc
,
sizeof
(
iosb
)
);
status
=
pNtCreateNamedPipeFile
(
&
h1
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
10
,
256
,
256
,
&
timeout
);
ok
(
status
==
STATUS_SUCCESS
,
"failed to create pipe %08lx
\n
"
,
status
);
todo_wine
ok
(
iosb
.
Information
==
FILE_OPENED
,
"wrong info %Ix
\n
"
,
iosb
.
Information
);
pNtClose
(
h1
);
memset
(
&
iosb
,
0xcc
,
sizeof
(
iosb
)
);
status
=
pNtCreateNamedPipeFile
(
&
h1
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN_IF
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
10
,
256
,
256
,
&
timeout
);
ok
(
status
==
STATUS_SUCCESS
,
"failed to create pipe %08lx
\n
"
,
status
);
todo_wine
ok
(
iosb
.
Information
==
FILE_OPENED
,
"wrong info %Ix
\n
"
,
iosb
.
Information
);
pNtClose
(
h1
);
h1
=
CreateNamedPipeA
(
"
\\\\
.
\\
pipe
\\
named_pipe"
,
PIPE_ACCESS_DUPLEX
,
PIPE_READMODE_BYTE
,
10
,
256
,
256
,
1000
,
NULL
);
winerr
=
GetLastError
();
todo_wine
ok
(
h1
!=
0
&&
winerr
==
ERROR_ALREADY_EXISTS
,
"CreateNamedPipeA got ret=%p (%ld)
\n
"
,
h1
,
winerr
);
pNtClose
(
h1
);
pNtClose
(
h
);
}
static
void
test_all_kernel_objects
(
UINT
line
,
OBJECT_ATTRIBUTES
*
attr
,
...
...
dlls/ntdll/tests/pipe.c
View file @
d74b084e
...
...
@@ -260,14 +260,14 @@ static void test_create_invalid(void)
/* create a pipe with FILE_OVERWRITE */
res
=
pNtCreateNamedPipeFile
(
&
handle
,
FILE_READ_ATTRIBUTES
|
SYNCHRONIZE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
,
4
/*FILE_OVERWRITE*/
,
0
,
1
,
0
,
0
,
0xFFFFFFFF
,
500
,
500
,
&
timeout
);
todo_wine
ok
(
res
==
STATUS_INVALID_PARAMETER
,
"NtCreateNamedPipeFile returned %lx
\n
"
,
res
);
ok
(
res
==
STATUS_INVALID_PARAMETER
,
"NtCreateNamedPipeFile returned %lx
\n
"
,
res
);
if
(
!
res
)
CloseHandle
(
handle
);
/* create a pipe with FILE_OVERWRITE_IF */
res
=
pNtCreateNamedPipeFile
(
&
handle
,
FILE_READ_ATTRIBUTES
|
SYNCHRONIZE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
,
5
/*FILE_OVERWRITE_IF*/
,
0
,
1
,
0
,
0
,
0xFFFFFFFF
,
500
,
500
,
&
timeout
);
todo_wine
ok
(
res
==
STATUS_INVALID_PARAMETER
,
"NtCreateNamedPipeFile returned %lx
\n
"
,
res
);
ok
(
res
==
STATUS_INVALID_PARAMETER
,
"NtCreateNamedPipeFile returned %lx
\n
"
,
res
);
if
(
!
res
)
CloseHandle
(
handle
);
...
...
@@ -289,7 +289,7 @@ static void test_create_invalid(void)
/* test FILE_CREATE creation disposition */
res
=
pNtCreateNamedPipeFile
(
&
handle2
,
SYNCHRONIZE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
2
/*FILE_CREATE*/
,
0
,
1
,
0
,
0
,
0xFFFFFFFF
,
500
,
500
,
&
timeout
);
todo_wine
ok
(
res
==
STATUS_ACCESS_DENIED
,
"NtCreateNamedPipeFile returned %lx
\n
"
,
res
);
ok
(
res
==
STATUS_ACCESS_DENIED
,
"NtCreateNamedPipeFile returned %lx
\n
"
,
res
);
if
(
!
res
)
CloseHandle
(
handle2
);
...
...
dlls/ntdll/unix/file.c
View file @
d74b084e
...
...
@@ -4138,6 +4138,7 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( HANDLE *handle, ULONG access, OBJECT_ATTR
(
pipe_type
?
NAMED_PIPE_MESSAGE_STREAM_WRITE
:
0
)
|
(
read_mode
?
NAMED_PIPE_MESSAGE_STREAM_READ
:
0
)
|
(
completion_mode
?
NAMED_PIPE_NONBLOCKING_MODE
:
0
);
req
->
disposition
=
dispo
;
req
->
maxinstances
=
max_inst
;
req
->
outsize
=
outbound_quota
;
req
->
insize
=
inbound_quota
;
...
...
include/wine/server_protocol.h
View file @
d74b084e
...
...
@@ -3073,10 +3073,10 @@ struct create_named_pipe_request
unsigned
int
access
;
unsigned
int
options
;
unsigned
int
sharing
;
unsigned
int
disposition
;
unsigned
int
maxinstances
;
unsigned
int
outsize
;
unsigned
int
insize
;
char
__pad_36
[
4
];
timeout_t
timeout
;
unsigned
int
flags
;
/* VARARG(objattr,object_attributes); */
...
...
@@ -6356,7 +6356,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 75
8
#define SERVER_PROTOCOL_VERSION 75
9
/* ### protocol_version end ### */
...
...
server/named_pipe.c
View file @
d74b084e
...
...
@@ -1403,12 +1403,25 @@ DECL_HANDLER(create_named_pipe)
if
(
!
(
root
=
get_handle_obj
(
current
->
process
,
objattr
->
rootdir
,
0
,
NULL
)))
return
;
}
switch
(
req
->
disposition
)
{
case
FILE_OPEN
:
pipe
=
open_named_object
(
root
,
&
named_pipe_ops
,
&
name
,
objattr
->
attributes
);
break
;
case
FILE_CREATE
:
case
FILE_OPEN_IF
:
pipe
=
create_named_object
(
root
,
&
named_pipe_ops
,
&
name
,
objattr
->
attributes
|
OBJ_OPENIF
,
NULL
);
break
;
default
:
pipe
=
NULL
;
set_error
(
STATUS_INVALID_PARAMETER
);
break
;
}
if
(
root
)
release_object
(
root
);
if
(
!
pipe
)
return
;
if
(
get_error
()
!=
STATUS_OBJECT_NAME_EXISTS
)
if
(
get_error
()
!=
STATUS_OBJECT_NAME_EXISTS
&&
req
->
disposition
!=
FILE_OPEN
)
{
/* initialize it if it didn't already exist */
pipe
->
instances
=
0
;
...
...
@@ -1433,7 +1446,7 @@ DECL_HANDLER(create_named_pipe)
release_object
(
pipe
);
return
;
}
if
(
pipe
->
sharing
!=
req
->
sharing
)
if
(
pipe
->
sharing
!=
req
->
sharing
||
req
->
disposition
==
FILE_CREATE
)
{
set_error
(
STATUS_ACCESS_DENIED
);
release_object
(
pipe
);
...
...
server/protocol.def
View file @
d74b084e
...
...
@@ -2270,6 +2270,7 @@ enum message_type
unsigned int access;
unsigned int options;
unsigned int sharing;
unsigned int disposition;
unsigned int maxinstances;
unsigned int outsize;
unsigned int insize;
...
...
server/request.h
View file @
d74b084e
...
...
@@ -1451,9 +1451,10 @@ C_ASSERT( sizeof(struct set_irp_result_request) == 24 );
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
access
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
options
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
sharing
)
==
20
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
maxinstances
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
outsize
)
==
28
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
insize
)
==
32
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
disposition
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
maxinstances
)
==
28
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
outsize
)
==
32
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
insize
)
==
36
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
timeout
)
==
40
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_named_pipe_request
,
flags
)
==
48
);
C_ASSERT
(
sizeof
(
struct
create_named_pipe_request
)
==
56
);
...
...
server/trace.c
View file @
d74b084e
...
...
@@ -2861,6 +2861,7 @@ static void dump_create_named_pipe_request( const struct create_named_pipe_reque
fprintf
(
stderr
,
" access=%08x"
,
req
->
access
);
fprintf
(
stderr
,
", options=%08x"
,
req
->
options
);
fprintf
(
stderr
,
", sharing=%08x"
,
req
->
sharing
);
fprintf
(
stderr
,
", disposition=%08x"
,
req
->
disposition
);
fprintf
(
stderr
,
", maxinstances=%08x"
,
req
->
maxinstances
);
fprintf
(
stderr
,
", outsize=%08x"
,
req
->
outsize
);
fprintf
(
stderr
,
", insize=%08x"
,
req
->
insize
);
...
...
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