Named objects which can be accessed by child processes only


  • Hi,


    My program spawns a number of child processes (CreateProcess() without handle inheritance) and communicates with these processes via shared memory.

    Shared memory is allocated by CreateFileMapping(...,"MySharedMemory") and is opened later by each of the child processes.

    I need to run several instances of the program. Unfortunately they all try to use the same block of shared memory:(. Is there any way around it?


    The only possible solution I see is for a parent process to check for existing file mappings with names "MySharedMemory", "MySharedMemory 1", "MySharedMemory 2",... "MySharedMemory n" and create a new mapping named "MySharedMemory n+1". But I'd like to use a less ugly way...


    Thanks in advance

    2. února 2012 17:03