How to get a handle to a JobObject without knowing its name, or how to get a JobObject's name?


My application is running in a job. I want to get a Handle to this Jobobject using OpenJobObject so i can later use this handle. The problem is, that i don't know the jobs name(because i didn't create it), and with passing NULL to the Job name it gives error 87 ( The parameter is incorrect ) back.

This is how i tried it:
if ( !handle ) printf( "\nError %d", GetLastError() );
else printf( "\nOK" );

I also found this on MSDN: An application cannot obtain a handle to the job object in which it is running unless it has the name of the job object. However, an application can call the QueryInformationJobObject function with NULL to obtain information about the job object.

So my question is, is it possible to get somehow a handle to the JobObject in which my application is running? Or get the name of the job my application is running in?

Last edited on
This is Windows-specific stuff, so you should post in the Windows Programming forum.
Topic archived. No new replies allowed.