recommend way to do IPC between app and service RRS feed

  • Question

  • Hi guys,

    until now I've used (unnamed) Pipes to communicate between apps and services. For that to work I used OpenProcess(serviceProcessHandle, PROCESS_DUP_HANDLE), so that I can duplicate the pipe handle from the service to the app. This still works in Vista with UAP turned off - even from a guest account. But as soon as I turn UAP on, OpenProcess fails with "access denied" - even in elevated mode. I guess that's intended? 

    So since my old IPC method doesn't work now, anymore, I'd like to know which IPC method Microsoft now recommends to be used for communication between apps and services.

    Sunday, January 22, 2006 7:29 PM

All replies

  • The service should create a randomly named pipe, and then store that name in a field in the registry that has been appropriately secured by ACLs, such that only the service account can write to it, and only authorised users can read the name of the pipe.

    This allows the service to be sure that while it is active, only authorised users are communicating with it, and that noone has hijacked the name for their own pipe.  Unfortunately, it doesn't prevent the possibility that an authorised user has created a pipe with the same name as the last pipe used by the service if the service is not currently running, so your apps that connect to this pipe must first ensure that the service is running before trying to connect.

    Thursday, January 26, 2006 10:53 PM
  • Thanks, I'll look into this. Last time I checked out named pipes I didn't like them at all for whatever reason (don't remember). But if there's no other way...
    Friday, January 27, 2006 8:41 AM
  • Another choice might be to use COM, although I'm not sure if it would work. Configure the ACLs on the service COM object (through DCOMCNFG) to accept requests from account(s) of your choice.
    Thursday, March 23, 2006 6:12 AM
  • Thanks for the suggestion.

    In the meanwhile I successfully solved the problem by using LPC. I think LPC is used internally by COM.
    Thursday, March 23, 2006 7:31 AM
  • Hi madshi,

    Could you send me a sample for making a client interact with a service in Vista?

    Thanks in Advance.

    Thursday, February 8, 2007 9:34 AM
  • Hi madshi,

    Could you also share with me how die you made use of LSP in making the application interact with the service?

    In other words is waht is the alternative for send message/post message in vista and how to do that?

    A sample would be a great help to me.

    Thursday, February 8, 2007 9:38 AM
  • I assume madshi meant RPC (which I would recommend over pipes any time).

    This is an old sample but it should get you started:


    Other articles imply that this sample (RPCSVC) is also included in the platform SDK.

    Thursday, February 8, 2007 10:09 PM