kernel32: Use proper access flags in CreatePipe.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-08-20 19:29:30 +02:00 committed by Alexandre Julliard
parent 8db78eccab
commit 8712db6f55
2 changed files with 8 additions and 3 deletions

View File

@ -2085,8 +2085,8 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe,
snprintfW(name, ARRAY_SIZE(name), nameFmt, GetCurrentProcessId(), ++index); snprintfW(name, ARRAY_SIZE(name), nameFmt, GetCurrentProcessId(), ++index);
RtlInitUnicodeString(&nt_name, name); RtlInitUnicodeString(&nt_name, name);
status = NtCreateNamedPipeFile(&hr, GENERIC_READ | SYNCHRONIZE, &attr, &iosb, status = NtCreateNamedPipeFile(&hr, GENERIC_READ | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE,
FILE_SHARE_WRITE, FILE_OVERWRITE_IF, &attr, &iosb, FILE_SHARE_WRITE, FILE_OVERWRITE_IF,
FILE_SYNCHRONOUS_IO_NONALERT, FILE_SYNCHRONOUS_IO_NONALERT,
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
1, size, size, &timeout); 1, size, size, &timeout);
@ -2099,7 +2099,7 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe,
/* from completion sakeness, I think system resources might be exhausted before this happens !! */ /* from completion sakeness, I think system resources might be exhausted before this happens !! */
if (hr == INVALID_HANDLE_VALUE) return FALSE; 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); FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE);
if (status) if (status)

View File

@ -1534,6 +1534,11 @@ static void test_CreatePipe(void)
ok(CreatePipe(&piperead, &pipewrite, &pipe_attr, 0) != 0, "CreatePipe failed\n"); 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(piperead, FILE_PIPE_SERVER_END, 4096, 4096, 1);
test_pipe_info(pipewrite, 0, 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(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); ok(written == sizeof(PIPENAME), "Write to anonymous pipe wrote %d bytes\n", written);