I would like to create a new process of an exe from within the code itself, so that I can have two parallel processes.
But, I would like to them to be separate processes and not parent-child.
Is there a way to do this in C (Windows)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Windows, processes don’t have parents. Some tools read the
InheritedFromUniqueProcessIdvalue, but this does not tell you which process started your process. It only tells you where handles and other attributes were inherited from. In practice however, this value is usually set to the ID of the process that started the child process.On Vista and above, you can change the
InheritedFromUniqueProcessIdvalue by callingCreateProcesswith theSTARTUPINFOEXstructure filled in appropriately: create an attribute list withInitializeProcThreadAttributeList, and add aattribute withPROC_THREAD_ATTRIBUTE_PARENT_PROCESS
UpdateProcThreadAttribute.On XP, there is no official way of doing this. You can try to use
NtCreateProcessorRtlCreateUserProcess, but these don’t set up the Win32 subsystem properly so your program might not run.