From a1713a521f79ca0051940fef023ab49aa12ad103 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Wed, 9 Nov 2005 04:53:32 +0000 Subject: [PATCH] - Fix error spotted by winetest: some status codes need to be normalized in CreateNamedPipeW - Fix some bugs in CreatePipe: use correct directory, use right access mask, use correct define name for blocking type, and use correct file sharing flags. Results of "kernel32_winetest pipe": 418 tests executed, 0 todo, 0 failures. (with NT NPFS, of course). svn path=/trunk/; revision=19089 --- reactos/lib/kernel32/file/npipe.c | 7 +++++++ reactos/lib/kernel32/file/pipe.c | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/reactos/lib/kernel32/file/npipe.c b/reactos/lib/kernel32/file/npipe.c index 1ba72cfa5c8..a3e47c5de0a 100644 --- a/reactos/lib/kernel32/file/npipe.c +++ b/reactos/lib/kernel32/file/npipe.c @@ -207,6 +207,13 @@ CreateNamedPipeW(LPCWSTR lpName, nOutBufferSize, &DefaultTimeOut); + /* Normalize special error codes */ + if ((Status == STATUS_INVALID_DEVICE_REQUEST) || + (Status == STATUS_NOT_SUPPORTED)) + { + Status = STATUS_OBJECT_NAME_INVALID; + } + /* Free the name */ RtlFreeUnicodeString(&NamedPipeName); diff --git a/reactos/lib/kernel32/file/pipe.c b/reactos/lib/kernel32/file/pipe.c index b53ea14a9ef..fac8693ad59 100644 --- a/reactos/lib/kernel32/file/pipe.c +++ b/reactos/lib/kernel32/file/pipe.c @@ -54,7 +54,7 @@ CreatePipe(PHANDLE hReadPipe, /* Create the pipe name */ swprintf(Buffer, - L"\\\\.\\PIPE\\Win32Pipes.%08x.%08x", + L"\\Device\\NamedPipe\\Win32Pipes.%08x.%08x", NtCurrentTeb()->Cid.UniqueProcess, PipeId); RtlInitUnicodeString(&PipeName, Buffer); @@ -81,15 +81,15 @@ CreatePipe(PHANDLE hReadPipe, /* Create the named pipe */ Status = NtCreateNamedPipeFile(&ReadPipeHandle, - FILE_GENERIC_READ |FILE_WRITE_ATTRIBUTES | SYNCHRONIZE, + GENERIC_READ |FILE_WRITE_ATTRIBUTES | SYNCHRONIZE, &ObjectAttributes, &StatusBlock, - FILE_SHARE_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_CREATE, FILE_SYNCHRONOUS_IO_NONALERT, FILE_PIPE_BYTE_STREAM_TYPE, FILE_PIPE_BYTE_STREAM_MODE, - FILE_PIPE_BYTE_STREAM_MODE, + FILE_PIPE_QUEUE_OPERATION, 1, nSize, nSize, @@ -97,6 +97,7 @@ CreatePipe(PHANDLE hReadPipe, if (!NT_SUCCESS(Status)) { /* Convert error and fail */ + DPRINT1("Status: %lx\n", Status); SetLastErrorByStatus(Status); return FALSE; } @@ -111,6 +112,7 @@ CreatePipe(PHANDLE hReadPipe, if (!NT_SUCCESS(Status)) { /* Convert error and fail */ + DPRINT1("Status: %lx\n", Status); NtClose(ReadPipeHandle); SetLastErrorByStatus(Status); return FALSE; -- 2.17.1