Hello,
The current public Win32 API documentation does not explicitly guarantee your proposed all-or-nothing outcome when the creating process terminates before ********CreateProcessW returns.
What Microsoft does document is below:
PROC_THREAD_ATTRIBUTE_JOB_LIST supplies an ordered list of jobs to which the child is assigned. It is supported on Windows 10 and later and Windows Server 2016 and later. The backing attribute value must remain valid for the lifetime described by the attribute-list documentation. UpdateProcThreadAttribute
Microsoft engineering guidance explains that the assignments are performed sequentially and before the initial thread is permitted to run. This removes the ordinary race in the traditional “create suspended, assign to job, resume” sequence. A more direct and mistake-free way of creating a process in a job object
For a completed call, CreateProcessW reports success or failure and, on success, returns the process and initial-thread identities in PROCESS_INFORMATION. The documentation does not describe cancellation or result delivery when the caller itself disappears before observing the return. CreateProcessW
The published contract does not state:
that caller termination cancels the creation operation;
that assignment to several jobs is transactional;
that earlier assignments are rolled back if a later assignment cannot be completed;
that a partially constructed process must be terminated;
or that another process receives the missing PROCESS_INFORMATION.
Therefore, if the creator terminates before the call returns, the independent supervisor must treat the launch result as indeterminate under the public contract. This does not prove that Windows can allow an executable child outside the requested jobs. It means the cited documentation is insufficient to use your proposed disjunction as a formal correctness guarantee or to enumerate every possible intermediate state.
The ordered-list wording also does not establish externally observable partial association or rollback semantics. Multiple associations must form a valid nested-job hierarchy, with the assignments ordered accordingly, but the public documentation does not define interruption-time behavior between those assignments. Nested Jobs
Regarding recovery by an independent supervisor:
-
QueryInformationJobObjectwithJobObjectBasicProcessIdListcan return the job’s current process IDs, including processes in child jobs. This is a current-membership query, not an atomic record of a particular creation attempt. JOBOBJECT_BASIC_PROCESS_ID_LIST - Job completion-port notifications are not generally guaranteed, and Microsoft warns that PID-bearing notifications are subject to races and PID reuse unless an open process handle is retained. JOBOBJECT_ASSOCIATE_COMPLETION_PORT
- A process handle provides stable object identity; a PID by itself does not provide equivalent lifetime protection. Process handles and identifiers
Consequently, job enumeration or completion-port notification is not a reliable replacement for the process handle returned by CreateProcessW. The robust supported architecture is for the long-lived supervisor to perform CreateProcessW itself and retain hProcess. A dedicated per-launch job may reduce ambiguity operationally, but it does not create a documented atomic identity handoff.
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE can terminate processes that successfully reached job membership when the last job handle closes. In your scenario, an independent supervisor deliberately retains a handle, so termination of the creator is not the last-handle event and does not activate that limit. Job Objects
If this interruption invariant is required for a security boundary or formal correctness argument, the public documentation is presently insufficient. It would require an explicit Windows API contract clarification from Microsoft, preferably through a Windows SDK developer-support case.