M
Marco Mechelli
Hello,
i'm facing with the following problem while using the Job API during an
impersonation.
I have a main process that needs to do the following:
1. Creates a new Job Object that will be used to handle its children.
2. Create a new process (either by CreateProcessW() or by
CreateProcessWithLogonW() for user impersonation).
3. Assign the newly created process to the previously created Job Object.
Now, if the main process uses the CreateProcessW() (i.e.: no impersonation)
everything works ok. The child process's parent is actually the main process
and the child is successfully assigned to the Job Object.
However, if the main process uses CreateProcessWithLogonW(), the child process
has 2 strange characteristics:
a. The parent is svchost.exe, not my main process
b. It is already part of a Job Object
In particular, because of b., since a process can belong to only one Job
Object, step 3 of the main process fails.
Now, the question is: how can I accomplish my need to have the process part of
my job object? Otherwise: is it safe to use the existing Job Object (made by
svchost) to manage the job (e.g. kill all the processes, get statistics, etc.)?
How can i obtain an handle to that job object?
This problem happens on all recent Windows versions (2k, XP, 2003).
Thanks,
marco
i'm facing with the following problem while using the Job API during an
impersonation.
I have a main process that needs to do the following:
1. Creates a new Job Object that will be used to handle its children.
2. Create a new process (either by CreateProcessW() or by
CreateProcessWithLogonW() for user impersonation).
3. Assign the newly created process to the previously created Job Object.
Now, if the main process uses the CreateProcessW() (i.e.: no impersonation)
everything works ok. The child process's parent is actually the main process
and the child is successfully assigned to the Job Object.
However, if the main process uses CreateProcessWithLogonW(), the child process
has 2 strange characteristics:
a. The parent is svchost.exe, not my main process
b. It is already part of a Job Object
In particular, because of b., since a process can belong to only one Job
Object, step 3 of the main process fails.
Now, the question is: how can I accomplish my need to have the process part of
my job object? Otherwise: is it safe to use the existing Job Object (made by
svchost) to manage the job (e.g. kill all the processes, get statistics, etc.)?
How can i obtain an handle to that job object?
This problem happens on all recent Windows versions (2k, XP, 2003).
Thanks,
marco