Thanks Blake Miller: CreateProcess and process groups (2)
-
Hello everybody! First of all, thanks for your answer Blake Miller!!! I didn´t explain the situation correctly. I mixed up with the example!! :sigh: I´ll try to explain it correctly... I´m using CreateProcess to create a new process, with the CREATE_NEW_PROCESS_GROUP flag set in the argument "dwCreationFlags", to create a new process group. Let´s suppose that PROCESS_A creates a new process, with CREATE_NEW_PROCESS_GROUP flag set. This new created process (PROCESS_B) is the 1º process of the process group. It´s true that both the 1º process of a process group and the process group itself have the same ID. So the ID of the process group and the PID of PROCESS_B are the same. If the PROCESS_B creates a new process (PROCESS_C) with CREATE_NEW_PROCESS_GROUP flag cleared, both PROCESS_B and PROCESS_C will belong to the same group. PROCESS_B knows the ID of its process group, as it´s its own PID. But... -How can PROCESS_C get the process group ID? (without using IPC or passing it through command line arguments) -Is there any function which returns the process group ID of the calling process? Summing up... I only what to know how to get the ID of the process group, to which a process belongs. Thanks and bye. :)