0

We have a native GUI application which runs on a windows machine, and recently we have found out that the application terminates unexpectedly. After days I have found that this is happening because the application is run by explorer.exe and it gets killed unexpectedly, random somehow, so it causes termination of all child processes including our application.

Is there a way to invoke/call our app as system process (not with explorer.exe)?

Also assume that application/user has administrator access too.

Thanks in advance.

kunal
  • 956
  • 9
  • 16
  • 4
    Killing explorer does not kill child processes. More likely is that whatever is randomly killing explorer is also randomly killing you. – Raymond Chen Oct 26 '13 at 14:13
  • @RaymondChen is correct, and you can test this easily by killing explorer in the task manager and observing what happens to launched apps. You actually need to add special code if you want the "kill child on parent shutdown": http://stackoverflow.com/questions/53208/how-do-i-automatically-destroy-child-processes-in-windows – holtavolt Oct 26 '13 at 14:19
  • I tested, it exits with the `explorer.exe`, generally is there anyway to invoke the application by system process when user logs on the system?! –  Oct 26 '13 at 14:26
  • Getting "child" processes killed requires using Job objects. Vista used them for apps started from a shortcut, implementing some sort of appcompat feature. Should be obvious by now that your environment is different from what just about everybody is familiar with, you'll need to find out why. Disabling your virus scanner is usually a good idea as well. – Hans Passant Oct 26 '13 at 14:46
  • You should also check whether Explorer dies periodically if your application is not running. If so, there's something badly messed up on your machine, which should be fixed before proceeding. – Harry Johnston Oct 28 '13 at 06:56

2 Answers2

3

Killing explorer does not in general kill other processes. This is very easy to verify yourself by killing explorer from the task manager. Notice that other processes stay alive when you kill explorer. Something else is killing your process.

If killing explorer leads to your process dying, then the obvious explanation is that something in your process is leading to its death. In other words the problem is most likely in your code, and you need to work out what that problem is.

Also note that explorer isn't really a special "system process" as such. It's just a normal process that that runs under the logged on user's token.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
1

You may need to give some hand of a OS services, then run the service as admin(run as system boot), then start he application from the service ,this will ensures you the app will started as admin and without the explorer.exe(as child)