c# - Starting process as NETWORK SERVICE -
i trying start process user network service, service running under local system. using following sequence of pinvoke operations:
logonuser()duplicatetokenex()loaduserprofile()createenvironmentblock()createprocessasuser()
using steps above able process launch - see process creation event in event viewer. process creating c# application spawns conhost.exe child process , crashes due possibly conhost.exe child process crashing (also shows in event log - crash reason dll initialization failure).
i have found if give network service administrator privileges on machine, able use steps above start process successfully.
finally, have tried launching same process directly service running under network service user, , in case starts successfully. makes me suspect context in trying start new process incomplete , missing operation prime environment.
is there wrong approach? missing step somewhere?
the issue incorrect setting of lpdesktop field of startup_info structure. if value not set string.empty, new process attempt use desktop of parent process, not have access to.
Comments
Post a Comment