Module: wine Branch: master Commit: 89bb2622d2b8ca7f58267f2958084a82a0cb68c5 URL: https://gitlab.winehq.org/wine/wine/-/commit/89bb2622d2b8ca7f58267f2958084a8...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Feb 21 11:18:13 2023 +0100
kernelbase: Set ERROR_ALREADY_EXISTS for existing pipe in CreateNamedPipeW().
Reported by Dávid Török.
---
dlls/kernelbase/sync.c | 2 +- dlls/ntdll/tests/om.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/kernelbase/sync.c b/dlls/kernelbase/sync.c index a5cda6bb49e..eabde0530d9 100644 --- a/dlls/kernelbase/sync.c +++ b/dlls/kernelbase/sync.c @@ -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; }
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index 3f42b7d045d..fb6deb19fa9 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -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);