[Bug 43036] SetNamedPipeHandleState returns ERROR_ACCESS_DENIED when setting PIPE_NOWAIT

wine-bugs at winehq.org wine-bugs at winehq.org
Tue May 16 12:10:20 CDT 2017


https://bugs.winehq.org/show_bug.cgi?id=43036

--- Comment #1 from dan-wine at berrange.com ---
Investigating the code I've learnt that the '_pipe' function calls
"CreatePipe". This method then uses  NtCreateNamedPipeFile() to create the
HANDLE for the read end of the pipe, passing GENERIC_READ for the access
control bits, while using NtOpenFile() to create the HANDLE for the write end
of the pipe, passing GENERIC_WRITE for the access control bits.



Next, the SetNamedPipeHandleState() method ultimately ends up calling 
set_named_pipe_info() in the wineserver. This method calls
get_pipe_server_obj() passing FILE_WRITE_ATTRIBUTES for the required access
control bits.

Since the read end of the pipe was opened with GENERIC_READ,
get_pipe_server_obj() fails with ERROR_ACCESS_DENIED. So the read end of the
pipe created by CreatePipe() will never be able to have attributes set.


Interestingly, when we call SetNamedPipeHandleState() with the write end of the
pipe, the get_pipe_server_obj() fails because the handle is not actually a
pipe, causing set_named_pipe_info() to fall back to get_handle_obj() passing 0
as the required access control check. Thus, even though the write end of the
pipe has GENERIC_WRITE permissions (which include FILE_WRITE_ATTRIBUTES), this
never gets checked !

I'm unclear on what the best way to fix all this is, but as a test I modified
CreatePipe to set FILE_WRITE_ATTRIBUTES for the read pipe and that was
sufficient to fix GNULIB (and libvirt) when running under Wine.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list