We have a service that runs as LocalSystem. We use CreateProcessAsUser and LoadUserProfile to start a working app as a specific user. Works just great. But if we try to use CreateProcessWithTokenW to avoid explicitly loading and managing user profile, it fails, and the following is recorded in event log:
Faulting application name: SomeApp.exe, version: 1.0.0.0, time stamp: 0x578a7819
Faulting module name: KERNELBASE.dll, version: 10.0.10586.494, time stamp: 0x5775e4c5
Exception code: 0xc06d007e
Fault offset: 0x0000000000071f28
Faulting process id: 0x24e4
Faulting application start time: 0x01d1df8d223316a6
Faulting application path: C:\SomePath\SomeApp.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: a2310c0d-7ddf-4241-92c9-de03e8de71e8
Faulting package full name:
Faulting package-relative application ID:
Is there a trick to get CreateProcessWithTokenW to work?