Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create named pipe on certain WS2012, Win 10 Pro machines #280

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

rcarman-r7
Copy link
Contributor

In a lab setting of multiple Windows machines, several machines were unable to create a named pipe server:

  • Windows Server 2012 R2 build 9600
  • Windows 10 Pro build 10240
    It is unclear why some of these machines failed, because other machines with the same OS were not affected.

This issue was solved by modifying the ObjectAttributes.Attributes flag being passed to NtCreateNamedPipeFile. This change did not impact previously working machines so it appears safe for general use.

Background:
Inspecting the output from the system call, ntCreateNamedPipeFile() returned the following:
image
Retval: 3221225530
Status: -1073741766
There was no named pipe present in the PowerShell output: Get-ChildItem -Path "\\.\pipe\"

To rule out machine specific issues, an alternate named pipe server was built from the Named Pipe C++ example from Microsoft: https://learn.microsoft.com/en-us/windows/win32/ipc/multithreaded-pipe-server
Notably, this example uses CreateNamedPipeW versus NtCreateNamedPipeFile. The named pipe was successfully created with retval=0, and the pipe was observed in the PowerShell output: Get-ChildItem -Path "\\.\pipe\"

Now, there were 2 executables with different retvals from the same machine.
Knowing that CreateNamedPipeW eventually calls NtCreateNamedPipeFile, WinDBG was used to trace the call.
The outcome of the investigation was that CreateNamedPipeW was passing a 0x40 in ObjectAttributes.Attributes flag, whereas go-winio was passing 0x0. The issue was resolved by setting ObjectAttributes.Attributes to 0x40, corresponding to OBJ_CASE_INSENSITIVE.

@helsaawy
Copy link
Contributor

overall this looks good, DCO task happy you will have to sign your commits:
git rebase HEAD~7 --signoff may work, or you squash all the commits and sign that

@helsaawy helsaawy merged commit 41915dc into microsoft:main Mar 16, 2023
@rcarman-r7 rcarman-r7 deleted the main-fix-named-pipe branch March 16, 2023 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants