Jacek Caban : kernel32: Use proper access flags in CreatePipe.

Alexandre Julliard julliard at winehq.org
Thu Nov 29 15:09:37 CST 2018


Module: wine
Branch: stable
Commit: 863dc430fcd6fd535fddd036f57117cc5f4fb783
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=863dc430fcd6fd535fddd036f57117cc5f4fb783

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Aug 20 19:29:30 2018 +0200

kernel32: Use proper access flags in CreatePipe.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 8712db6f554349728663bff0ff2b03334aa905b3)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/kernel32/sync.c       | 6 +++---
 dlls/kernel32/tests/pipe.c | 5 +++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c
index d3d46b7..62fc8bc 100644
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -1945,8 +1945,8 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe,
         snprintfW(name, sizeof(name) / sizeof(name[0]), nameFmt,
                   GetCurrentProcessId(), ++index);
         RtlInitUnicodeString(&nt_name, name);
-        status = NtCreateNamedPipeFile(&hr, GENERIC_READ | SYNCHRONIZE, &attr, &iosb,
-                                       FILE_SHARE_WRITE, FILE_OVERWRITE_IF,
+        status = NtCreateNamedPipeFile(&hr, GENERIC_READ | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE,
+                                       &attr, &iosb, FILE_SHARE_WRITE, FILE_OVERWRITE_IF,
                                        FILE_SYNCHRONOUS_IO_NONALERT,
                                        FALSE, FALSE, FALSE, 
                                        1, size, size, &timeout);
@@ -1959,7 +1959,7 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe,
     /* from completion sakeness, I think system resources might be exhausted before this happens !! */
     if (hr == INVALID_HANDLE_VALUE) return FALSE;
 
-    status = NtOpenFile(&hw, GENERIC_WRITE | SYNCHRONIZE, &attr, &iosb, 0,
+    status = NtOpenFile(&hw, GENERIC_WRITE | FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb, 0,
                         FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE);
 
     if (status) 
diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index 1824b05..b44cce8 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -1473,6 +1473,11 @@ static void test_CreatePipe(void)
     ok(CreatePipe(&piperead, &pipewrite, &pipe_attr, 0) != 0, "CreatePipe failed\n");
     test_pipe_info(piperead, FILE_PIPE_SERVER_END, 4096, 4096, 1);
     test_pipe_info(pipewrite, 0, 4096, 4096, 1);
+    test_file_access(piperead, SYNCHRONIZE | READ_CONTROL | FILE_WRITE_ATTRIBUTES
+                     | FILE_READ_ATTRIBUTES | FILE_READ_PROPERTIES | FILE_READ_DATA);
+    test_file_access(pipewrite, SYNCHRONIZE | READ_CONTROL | FILE_WRITE_ATTRIBUTES
+                     | FILE_READ_ATTRIBUTES | FILE_WRITE_PROPERTIES | FILE_APPEND_DATA
+                     | FILE_WRITE_DATA);
 
     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);




More information about the wine-cvs mailing list