c# - Starting process as NETWORK SERVICE -


i trying start process user network service, service running under local system. using following sequence of pinvoke operations:

  1. logonuser()
  2. duplicatetokenex()
  3. loaduserprofile()
  4. createenvironmentblock()
  5. 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

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -