Windows 11 Win32: can the actual process primary token have a protected DACL at creation?
For a third-party Win32 service running as LocalSystem under the Service Control Manager (SCM) on Windows 11 x64, I am looking for a supported way to give both a controller process and its actual assigned primary access token explicit DACLs marked SE_DACL_PROTECTED when the objects are created. The controller can be a child process while the existing SCM service remains the lifecycle and stop entry point. The creator needs to verify the original objects before the controller starts privileged work, with protection already in effect before any unapproved handle grant is possible.
In a separate isolated Windows 10 test, DuplicateTokenEx produced an input primary token with a protected DACL. CreateProcessAsUserW accepted protected descriptors for a suspended process and its initial thread. Before resuming the thread, OpenProcessToken on the returned process showed the same AuthenticationId but a different TokenId and an actual primary token without SE_DACL_PROTECTED. This observation is limited to that test and does not establish what Windows 11 guarantees.
Does a documented Windows 11 API guarantee that the independently held input token is assigned unchanged, or allow the actual primary token object's protected DACL to be supplied atomically at creation? If so, how should the creator verify the original process and token and tie them to the existing SCM service instance? If supported Win32 APIs cannot provide these guarantees for a third-party service, a confirmation of that boundary or a supported alternative that preserves the guarantees would be helpful.
References: