Commit 89bb2622 authored by Alexandre Julliard's avatar Alexandre Julliard

kernelbase: Set ERROR_ALREADY_EXISTS for existing pipe in CreateNamedPipeW().

Reported by Dávid Török.
parent 1b9db994
......@@ -1305,12 +1305,12 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateNamedPipeW( LPCWSTR name, DWORD open_mode,
if (instances >= PIPE_UNLIMITED_INSTANCES) instances = ~0U;
time.QuadPart = (ULONGLONG)timeout * -10000;
SetLastError( 0 );
status = NtCreateNamedPipeFile( &handle, access, &attr, &iosb, sharing,
FILE_OPEN_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;
SetLastError( iosb.Information == FILE_CREATED ? ERROR_SUCCESS : ERROR_ALREADY_EXISTS );
return handle;
}
......
......@@ -411,7 +411,6 @@ static void test_name_collisions(void)
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment