I am trying to build a windows service that automates the running of an 3rd party application, let's call it BlackBox.exe. BlackBox.exe runs fine when run from the current user's session but fails when executed from the service. BlackBox.exe has a UI but it can be automated by passing it command line parameters. In the automated mode it shows some UI, reads input files, writes output files and then exits without any user interaction. We only have binaries for BlackBox.exe.
The service is configured to use the same user as BlackBox.exe was installed and registered under.
I've run a comparison of a the events captured by Process Monitor interactive session vs service session. There's no registry or file operations that are failing for the service session and succeeding for the service session. Notably, the registry keys for the license activation are read successfully in both cases.
When run from the service BlackBox.exe is visible in the Task Manager with 0% cpu and will remain there until killed.
I guess the lack of access to the desktop is causing BlackBox.exe to fail - maybe there's a way to fool BlackBox.exe to think it has access to the desktop without having a user logged in?
How can I run BlackBox.exe from a service?
UPDATE: If I:
- start the "Interactive Services Detection" service,
- click "View Message" from the Interactive Services Detection dialog,
- watch BlackBox.exe gui do its processing until I see the Interactive Serivces Detection message "the application is no longer requesting your attention"
- click "Return Now"
...it works fine. So it might be related to Session 0 isolation