I have a forever-running process running in a system session. There is a need where I impersonate a thread (let's call it t1) to the current standard user session to access certain files in the mapped drive, and also other file operations, etc.
From the impersonated thread, another thread is invoked (let's call it t2). t2 uses CreateProcess() to create a process with default values. The created process from t2 runs in the system session.
I don't want to know how to run the child process in the user session. Rather I am trying to understand why the child process runs in the system session even though the invoker thread is in user session.
Does CreateProcess() take the token of the parent process rather than the thread?