Help with Windows Named Pipes

Ken Gibson 0 Reputation points
2024-11-13T15:36:38.7066667+00:00

Win32 experts,

I'm writing an app that includes a master process written in C# that forks a subprocess written in Python and compiled into an exe. I am attempting to open named pipe between the two and despite working through all online tips and all of copilot's suggestions for getting this to work, am still getting 'The system cannot find the file specified.' error in the child process.

I have:

  1. Used the correct pipe naming format. In this case: "\.\pipe\derPipe"
  2. Confirmed the child process receives and uses the correct pipe name;
  3. In the parent, confirmed the pipe is successfully created;
  4. In the parent, insure the child is authorized to open the pipe using copilot's suggested code: PipeSecurity pipeSecurity = new PipeSecurity(); pipeSecurity.AddAccessRule(new PipeAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), PipeAccessRights.FullControl, AccessControlType.Allow));
  5. I then pass this PipeSecurity object in the call to create the NamedPipeServerStream;
  6. In the Python child, wait for the pipe to be ready with: win32pipe.WaitNamedPipe(pipeName, 2000) - after confirming pipeName contains the correct name. This function is where I actually get the 'system cannot find the file specified' error.

At this point I've run out of ideas, online suggestions, & copilot suggestions for getting this to work. Any additional tips are greatly appreciated.

Thanks!

Windows development Windows API - Win32
Windows for business Windows Client for IT Pros User experience Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.