If you just want to find out what quotas / limits are you using or list all the other processes in the task, you do not need to get the Job object for the current process.
You can call QueryInformationJobObject with NULL, which will be the Job object of the current process.
To answer a specific question, call IsProcessInJob to see if you work.
You can learn all about the job by passing NULL to QueryInformationJobObject
Your child processes automatically inherit your job if you do not pass CREATE_BREAKAWAY_FROM_JOB and job JOB_OBJECT_LIMIT_BREAKAWAY_OK or JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK . In these cases, you can assign the process to a new task if you wish.
Thus, without knowing the descriptor, you can find out everything about your current task and assign child processes in the current task, or if you have permission, without the current work. That is, you can do almost anything that a pen allows you to do.
The only exception is to duplicate it to another marriage process. If you need to do this, you will have to somehow tell the parent process the value of the handle.
Ben
source share