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
3623b9d4
Commit
3623b9d4
authored
Aug 22, 2011
by
Bernhard Loos
Committed by
Alexandre Julliard
Aug 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Create(Named)Pipe uses an nonalertable io mode.
parent
4e4bdbe5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
sync.c
dlls/kernel32/sync.c
+3
-3
pipe.c
dlls/kernel32/tests/pipe.c
+27
-1
No files found.
dlls/kernel32/sync.c
View file @
3623b9d4
...
...
@@ -1396,7 +1396,7 @@ HANDLE WINAPI CreateNamedPipeW( LPCWSTR name, DWORD dwOpenMode,
}
access
|=
SYNCHRONIZE
;
if
(
dwOpenMode
&
FILE_FLAG_WRITE_THROUGH
)
options
|=
FILE_WRITE_THROUGH
;
if
(
!
(
dwOpenMode
&
FILE_FLAG_OVERLAPPED
))
options
|=
FILE_SYNCHRONOUS_IO_ALERT
;
if
(
!
(
dwOpenMode
&
FILE_FLAG_OVERLAPPED
))
options
|=
FILE_SYNCHRONOUS_IO_
NON
ALERT
;
pipe_type
=
(
dwPipeMode
&
PIPE_TYPE_MESSAGE
)
?
TRUE
:
FALSE
;
read_mode
=
(
dwPipeMode
&
PIPE_READMODE_MESSAGE
)
?
TRUE
:
FALSE
;
non_block
=
(
dwPipeMode
&
PIPE_NOWAIT
)
?
TRUE
:
FALSE
;
...
...
@@ -1848,7 +1848,7 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe,
RtlInitUnicodeString
(
&
nt_name
,
name
);
status
=
NtCreateNamedPipeFile
(
&
hr
,
GENERIC_READ
|
SYNCHRONIZE
,
&
attr
,
&
iosb
,
0
,
FILE_OVERWRITE_IF
,
FILE_SYNCHRONOUS_IO_ALERT
|
FILE_PIPE_INBOUND
,
FILE_SYNCHRONOUS_IO_
NON
ALERT
|
FILE_PIPE_INBOUND
,
FALSE
,
FALSE
,
FALSE
,
1
,
size
,
size
,
&
timeout
);
if
(
status
)
...
...
@@ -1861,7 +1861,7 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe,
if
(
hr
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
status
=
NtOpenFile
(
&
hw
,
GENERIC_WRITE
|
SYNCHRONIZE
,
&
attr
,
&
iosb
,
0
,
FILE_SYNCHRONOUS_IO_ALERT
|
FILE_NON_DIRECTORY_FILE
);
FILE_SYNCHRONOUS_IO_
NON
ALERT
|
FILE_NON_DIRECTORY_FILE
);
if
(
status
)
{
...
...
dlls/kernel32/tests/pipe.c
View file @
3623b9d4
...
...
@@ -37,7 +37,13 @@
static
HANDLE
alarm_event
;
static
BOOL
(
WINAPI
*
pDuplicateTokenEx
)(
HANDLE
,
DWORD
,
LPSECURITY_ATTRIBUTES
,
SECURITY_IMPERSONATION_LEVEL
,
TOKEN_TYPE
,
PHANDLE
);
static
DWORD
WINAPI
(
*
pQueueUserAPC
)(
PAPCFUNC
pfnAPC
,
HANDLE
hThread
,
ULONG_PTR
dwData
);
static
BOOL
user_apc_ran
;
static
void
CALLBACK
user_apc
(
ULONG_PTR
param
)
{
user_apc_ran
=
TRUE
;
}
static
void
test_CreateNamedPipe
(
int
pipemode
)
{
...
...
@@ -471,6 +477,12 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
DWORD
readden
;
DWORD
success
;
user_apc_ran
=
FALSE
;
if
(
i
==
0
&&
pQueueUserAPC
)
{
trace
(
"Queueing an user APC
\n
"
);
/* verify the pipe is non alerable */
ok
(
pQueueUserAPC
(
&
user_apc
,
GetCurrentThread
(),
0
),
"QueueUserAPC failed: %d
\n
"
,
GetLastError
());
}
/* Wait for client to connect */
trace
(
"Server calling ConnectNamedPipe...
\n
"
);
ok
(
ConnectNamedPipe
(
hnp
,
NULL
)
...
...
@@ -494,6 +506,11 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
ok
(
FlushFileBuffers
(
hnp
),
"FlushFileBuffers
\n
"
);
ok
(
DisconnectNamedPipe
(
hnp
),
"DisconnectNamedPipe
\n
"
);
ok
(
user_apc_ran
==
FALSE
,
"UserAPC ran, pipe using alertable io mode
\n
"
);
if
(
i
==
0
&&
pQueueUserAPC
)
SleepEx
(
0
,
TRUE
);
/* get rid of apc */
/* Set up next echo server */
hnpNext
=
CreateNamedPipe
(
PIPENAME
"serverThreadMain2"
,
PIPE_ACCESS_DUPLEX
,
...
...
@@ -916,9 +933,13 @@ static void test_CreatePipe(void)
BYTE
*
buffer
;
char
readbuf
[
32
];
user_apc_ran
=
FALSE
;
if
(
pQueueUserAPC
)
ok
(
pQueueUserAPC
(
user_apc
,
GetCurrentThread
(),
0
),
"couldn't create user apc
\n
"
);
pipe_attr
.
nLength
=
sizeof
(
SECURITY_ATTRIBUTES
);
pipe_attr
.
bInheritHandle
=
TRUE
;
pipe_attr
.
lpSecurityDescriptor
=
NULL
;
pipe_attr
.
lpSecurityDescriptor
=
NULL
;
ok
(
CreatePipe
(
&
piperead
,
&
pipewrite
,
&
pipe_attr
,
0
)
!=
0
,
"CreatePipe failed
\n
"
);
ok
(
WriteFile
(
pipewrite
,
PIPENAME
,
sizeof
(
PIPENAME
),
&
written
,
NULL
),
"Write to anonymous pipe failed
\n
"
);
ok
(
written
==
sizeof
(
PIPENAME
),
"Write to anonymous pipe wrote %d bytes
\n
"
,
written
);
...
...
@@ -956,6 +977,9 @@ static void test_CreatePipe(void)
ok
(
ReadFile
(
piperead
,
readbuf
,
sizeof
(
readbuf
),
&
read
,
NULL
)
==
0
,
"Broken pipe not detected
\n
"
);
ok
(
CloseHandle
(
piperead
),
"CloseHandle for the read pipe failed
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
ok
(
user_apc_ran
==
FALSE
,
"user apc ran, pipe using alertable io mode
\n
"
);
SleepEx
(
0
,
TRUE
);
/* get rid of apc */
}
struct
named_pipe_client_params
...
...
@@ -1588,6 +1612,8 @@ START_TEST(pipe)
hmod
=
GetModuleHandle
(
"advapi32.dll"
);
pDuplicateTokenEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"DuplicateTokenEx"
);
hmod
=
GetModuleHandle
(
"kernel32.dll"
);
pQueueUserAPC
=
(
void
*
)
GetProcAddress
(
hmod
,
"QueueUserAPC"
);
if
(
test_DisconnectNamedPipe
())
return
;
...
...
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