1

I was reading anonymous pipes on MSDN. they say: "The process can also duplicate a pipe handle using the DuplicateHandle function and send it to an unrelated process using some form of interprocess communication, such as DDE or shared memory."

I was not convinced with the statement. As we already know, pipes are useful to communicate between parent child and the duplicate handle refers to the same object as the original handle. http://msdn.microsoft.com/en-us/library/windows/desktop/aa365141%28v=vs.85%29.aspx

HDJEMAI
  • 9,436
  • 46
  • 67
  • 93
ks2
  • 43
  • 1
  • 8
  • 1
    And your question is? Also, it would be a good idea to include the URL to the MSDN information; it saves people having to search it for themselves. Please take a little time to read the [FAQ]; it explains how to ask questions here and what makes a good question. – Jonathan Leffler Jan 09 '13 at 16:02
  • What is it you're unconvinced of? Using pipes to communicate between processes is very common. – Carey Gregory Jan 09 '13 at 16:39
  • Why not *try it* and either a) show that the MSDN docs are inaccurate, or b) discover a new use for pipes? – Beta Jan 09 '13 at 16:41
  • @Carey: anonymous pipes cant communicate between unrelated processes. Then how DuplicateHandle function can change the behavior? I am not here to prove anyone wrong. I want to understand how is it possible. – ks2 Jan 10 '13 at 09:16
  • 1
    Anonymous pipes _can_ be used between unrelated processes, just like the article says. Note that one parameter to CreatePipe is a SECURITY_ATTRIBUTES struct. Set that appropriately and any process can access the pipe. Note also that DuplicateHandle requires a handle to the process receiving the pipe handle. These mechanisms allow anonymous pipes to be used between unrelated processes. – Carey Gregory Jan 10 '13 at 23:45
  • @CareyGregory Can you show us a example to create an anonymous pipe between unrelated processes. I have been searching the way to duplicate the created unnamed pipe. Turns out, the handle of the pipe cannot be duplicated successfully. An example will help a lot. Thanks! – Romantic Amaj Feb 27 '23 at 03:38
  • @RomanticAmaj That's a 10-year old comment. I haven't written code for stuff like that for at least 5 years so I'm afraid I can't help you, but I know it can be done. The security attributes struct is the key to doing it. – Carey Gregory Feb 27 '23 at 04:05
  • @CareyGregory What a shame...If the security attributes struct is the key to this solution, then I can go deep again to figure it out. Thanks anyway – Romantic Amaj Feb 28 '23 at 07:38

0 Answers0