473,705 Members | 6,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use a service to start a regular windows application

Hi all, I have a service that needs to start a regular windows
application.

I'm running the service as ServiceAccount. LocalSystem.

But, when it starts the process (using Process.Start) the GUI for the
application doesn't appear - however, I can see the process in the
TaskManager.

Now, feel free to mention that starting a regular windows application
using the LocalSystem account is a security risk and therefore I
shouldn't be doing this. But, what I'm more interested in is why the
GUI for this application isn't appearing in the current architecture.

I read in a few different places something about:
INTERACT WITH DESKTOP
and
RUN INTERACTIVE

Is it possible that the LocalSystem account doesn't have those flags
and that is why the GUI for this application doesn't appear? If so,
can I use impersonation or something to use an account that will show
the GUI for this application?

Thanks,
Novice

Nov 24 '06 #1
3 6137
What is the goal? Do you want to start a specific program at a specific time?
just put an entry into Task Scheduler to run it on whatever schedule you want.

If you want to start the program when the OS starts, there are a slew of
registry entries you can look up that will enable you to do that, too.

If that's the goal, the general advice you'll get here is not to have the
overhead of a windows service to do this. Especially since services are
designed to start when the OS starts BEFORE any "Real user" has logged on and
would be able to see UI dialogs.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"il***********@ gmail.com" wrote:
Hi all, I have a service that needs to start a regular windows
application.

I'm running the service as ServiceAccount. LocalSystem.

But, when it starts the process (using Process.Start) the GUI for the
application doesn't appear - however, I can see the process in the
TaskManager.

Now, feel free to mention that starting a regular windows application
using the LocalSystem account is a security risk and therefore I
shouldn't be doing this. But, what I'm more interested in is why the
GUI for this application isn't appearing in the current architecture.

I read in a few different places something about:
INTERACT WITH DESKTOP
and
RUN INTERACTIVE

Is it possible that the LocalSystem account doesn't have those flags
and that is why the GUI for this application doesn't appear? If so,
can I use impersonation or something to use an account that will show
the GUI for this application?

Thanks,
Novice

Nov 25 '06 #2
You cant do what you are trying to do with Process.Start.
You would have to PInvoke CreateProcess() Win32 API and set the Desktop of
the process to the default interactive desktop.
Process.Start sets the desktop to the desktop of whatever process started it
(which in this case is not interactive)

Here is the code.
http://sayala.com/?page_id=126
<il***********@ gmail.comwrote in message
news:11******** **************@ 14g2000cws.goog legroups.com...
Hi all, I have a service that needs to start a regular windows
application.

I'm running the service as ServiceAccount. LocalSystem.

But, when it starts the process (using Process.Start) the GUI for the
application doesn't appear - however, I can see the process in the
TaskManager.

Now, feel free to mention that starting a regular windows application
using the LocalSystem account is a security risk and therefore I
shouldn't be doing this. But, what I'm more interested in is why the
GUI for this application isn't appearing in the current architecture.

I read in a few different places something about:
INTERACT WITH DESKTOP
and
RUN INTERACTIVE

Is it possible that the LocalSystem account doesn't have those flags
and that is why the GUI for this application doesn't appear? If so,
can I use impersonation or something to use an account that will show
the GUI for this application?

Thanks,
Novice
Nov 26 '06 #3
il***********@g mail.com wrote:
Hi all, I have a service that needs to start a regular windows
application.

I'm running the service as ServiceAccount. LocalSystem.

But, when it starts the process (using Process.Start) the GUI for the
application doesn't appear - however, I can see the process in the
TaskManager.

Now, feel free to mention that starting a regular windows application
using the LocalSystem account is a security risk and therefore I
shouldn't be doing this. But, what I'm more interested in is why the
GUI for this application isn't appearing in the current architecture.

I read in a few different places something about:
INTERACT WITH DESKTOP
and
RUN INTERACTIVE

Is it possible that the LocalSystem account doesn't have those flags
and that is why the GUI for this application doesn't appear? If so,
can I use impersonation or something to use an account that will show
the GUI for this application?
And keep in mind that under Windows Vista, services will no longer be
able to interact with the desktop. If you intend to use this app on
Vista, you will have to use a different approach.

This is a good link:

http://tinyurl.com/y8s7l7
>From the article:
Session 0 Isolation

Brief Description

In Windows XP, Windows Server 2003, and earlier versions of the Windows
operating system, all services run in the same session as the first
user who logs on to the console. This session is called Session 0.
Running services and user applications together in Session 0 poses a
security risk because services run at elevated privilege and therefore
are targets for malicious agents who are looking for a means to elevate
their own privilege level.

The Microsoft Windows Vista operating system mitigates this security
risk by isolating services in Session 0 and making Session 0
non-interactive. In Windows Vista, only system processes and services
run in Session 0. The first user logs on to Session 1, and subsequent
users log on to subsequent sessions. This means that services never run
in the same session as users' applications and are therefore protected
from attacks that originate in application code.

Specific examples of affected driver classes include:

* Printer drivers, which are loaded by the spooler service.
* All drivers authored with the User Mode Driver Framework (UMDF),
because these drivers are hosted by a process in Session 0.

Application classes affected by this feature:

* Services that create UI.
* A service that tries to use window message functions such as
SendMessage and PostMessage to communicate with an application.
* Applications creating globally named objects.

Nov 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2663
by: Michael | last post by:
Hi, I have a windows service developed using c# and it needs to lunch another windows application. I have been trying to use Process class to do it but the problem is becase windows service running at background and using system account, so the applcation it lunchs is also running at the background. is there a way to lunch the windows application as current logged in user? Thanks
1
3512
by: Mike | last post by:
I have written a windows service that has a few methods which have a return type of dataset. I also have an application that I have written which I would like to 'hook' into my service and use the dataset functions I have developed. My service and application are two seperate projects under the same solution. My problem comes in when I try to 'hook' into the service and call anything from it. I have tried using the ExecuteCommand...
17
6438
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
3
3163
by: Trevor | last post by:
In C++ you can allow your Windows program to act as a Windows Service by implementing some functions required by the Service Control Manager. This same application could be written in such a way that the application could run as a regular Windows Application or as a Windows Service. How can I do this in C#? I am using Visual Studio 2003.
0
8768
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8690
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7895
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6606
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.