locked
DuplicateHandle() and OpenProcess() across session boundaries RRS feed

  • Question

  • Hello everyone,

    I am having a bit of fun trying to make my own super fast IPC mechanism (I know, there are tons of ready made IPC mechanisms out there, but the point of this is for ME to do it) and I plan on using file mappings to get it done (since it's pretty much the fastest type of IPC). I have a central service (running under LOCAL_SERVICE but eventually which will run under it's own custom user account) which creates a file mapping (call it MAPPING_A) in the Global Name Space (i.e. name of the mapping is "Global\\SomeName" that everyone can connect to (ACL of the mapping is set for everyone). Since the way I am implementing things (to be ridiculously fast) means that each mapping hosts a unidirectional conversation, I need for the processes connecting to the global file mapping to hand over a duplicated handle to a file mapping THEY created (call it MAPPING_B) so that the central service may send responses back to them. In order words, processes use MAPPING_A to send requests over to the central service and the central service uses MAPPING_B to send back responses. I want to know the following:

    1. If I know the process id of the central service, can any process on a machine call OpenProcess(process id) using dwDesiredAccess = PROCESS_DUP_HANDLE?
    2. If (1) is possible, can I then call DuplicateHandle() to duplicate MAPPING_B using the target process whose handle was opened in (1)?

    In other words, can the processes connecting to the central service pass duplicated handles to their MAPPING_B by sending the information across using MAPPING_A?

    cheers,
    Abbey


    Thursday, August 18, 2011 12:14 PM

All replies

  • Um.... I'm still hoping that someone will answer the question. I am stumbling on using OpenProcess() and getting access denied when trying to open processes that were created by other users.

    cheers,
    Abbey

    Monday, August 29, 2011 5:32 PM