Re: Make a Windows Service start a windows program.



Well I mean that it's possible for the program that gets launched from a
Windows Service session, to load the environment and profile of an
interactive user, it's also possible to migrate the current desktop to the
(visble) interactive desktop, but this is not a trivial task and requires
some thorough understanding of the OS security system.

I see.

| I have a similar situation where a service needs to instantiate an object
| contained in a WinForms app. The service and the app are installed as a
| pair; the UI is used to define the action taken by the service at
| pre-defined intervals.
|

I suppose you mean instantiate an object through remoting right? This is not
a problem as long as the WinForms app is started from an interactive logon
session and not from the service.

Well, that's the key question - can I do this without remoting?

The service in question will run as a Local Service since it requires full system privaleges, but it gets launced (only) when a particular user logs in. The UI is run in the user's security context so only that user can adjust the parameters of the app's "projects" which are launched by the service. The "projects" are designed to run silently in the background in a separate thread and require no interaction with the UI (that's why I am using a service).

However, the service needs to instantiate the Project object in the WinForms application - this contains all the business logic. So the service needs to pass parameters to the Project class's constructor. That's why I thought the service and the app should be in the same assembly.

So do I really need Remoting here? I just want to instantiate the app's Project object from the service to allow the app's "project" to run in the service's thread and security context, while the app's UI is run in the users's thread and security context.

Does this sound correct?

.