OOT: Message box in a service

Hi everyone!

I know that this question is rising over and over again but I couldn’t find
the answer in archives. So I apologize and would like to ask again:
How can I make my service (written using ATL) GUI-enabled so I can display
messages directly from the service?

TIA,

Vladimir


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

OOT: Message box in a serviceHello, Vladimir.

By default Win32 services associated with non-visible windows station (for services which run in the local system account it is Service-0x0-3e7$) and they can’t (without using special flag MB_SERVICE_NOTIFICATION or MB_DEFAULT_DESKTOP_ONLY in the MessageBox function) interact with user. However, you may configure a service to have GUI capabilities. Just set Type field of the registry service entry equal SERVICE_INTERACTIVE_PROCESS. When this key is specified SCM will connect the service with WinSta0 instead Service-0x0-3e7$ and it will alow to display windows and dialog boxes.

Regards, Vadim.
----- Original Message -----
From: Chtchetkine, Vladimir
To: File Systems Developers
Sent: Tuesday, May 15, 2001 9:35 PM
Subject: [ntfsd] OOT: Message box in a service

Hi everyone!

I know that this question is rising over and over again but I couldn’t find the answer in archives. So I apologize and would like to ask again:

How can I make my service (written using ATL) GUI-enabled so I can display messages directly from the service?

TIA,

Vladimir


You are currently subscribed to ntfsd as: xxxxx@ntkernel.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

There is a special CONSTANT for MessageBox API. CHeck the Win32 SDK
Help.
You may also want to check the ms kernel-mode NG, as the question
was also posted there.

Regards, Dejan.

“Chtchetkine, Vladimir” wrote:

Hi everyone!

I know that this question is rising over and over again but I couldn’t
find the answer in archives. So I apologize and would like to ask
again:

How can I make my service (written using ATL) GUI-enabled so I can
display messages directly from the service?

TIA,

Vladimir

You are currently subscribed to ntfsd as: xxxxx@ptt.yu
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


Kind regards, Dejan M. CEO Alfa Co. www.alfaunits.co.yu and
www.register.co.yu
E-mail : xxxxx@ptt.yu, xxxxx@register.co.yu and
xxxxx@alfaunits.co.yu
ICQ# : 56570367
Professional file&system related components and libraries for Win32
developers.
Alfa File Monitor - #1 file monitoring system for Win32 developers.
Alfa File Protector - #1 file protection and hiding system for Win32
developers.
Alfa Units - #1 file and system handling units for Delphi.


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

actually the service has to interact with the user’s windows
station(“WinSta0”) and desktop (“Default”). If the service account is other
than local system, first must impersonate the user. For example if there is
a RPC request from a user application, you can do like this:
-GetDesktopWindow
-GetProcessWindowStation
-GetCurrentThreadId
-GetThreadDesktop
-RpcImpersonateClient
-OpenWindowStation
-SetProcessWindowStation
-OpenDesktop
-RpcRevertToSelf
-SetThreadDesktop
-MessageBox
-SetThreadDesktop
-SetProcessWindowStation
-CloseDesktop
-CloseWindowStation

You can get a better explanation from MSDN.

Zsolt


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You can also set the flag in the service registry entry indicating that you
would like the service to interact with the desktop (WinSta0).

There are some drawbacks; too many for me to go into right now. The general
design practice is to develop an application that is tied to the service.
The service and application can then communicate and the application can
handle displaying any user messages or dialogs.

It is important to separate the concept of services from applications. It is
also advisable to NOT use MFC in your service; this too can lead to
unexpected issues and problems.

Just my .02

Jamey
Kernel driver developer; not user developer.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@xtra.co.nz
Sent: Tuesday, May 15, 2001 9:17 PM
To: File Systems Developers
Subject: [ntfsd] Re: OOT: Message box in a service

actually the service has to interact with the user’s windows
station(“WinSta0”) and desktop (“Default”). If the service
account is other
than local system, first must impersonate the user. For example
if there is
a RPC request from a user application, you can do like this:
-GetDesktopWindow
-GetProcessWindowStation
-GetCurrentThreadId
-GetThreadDesktop
-RpcImpersonateClient
-OpenWindowStation
-SetProcessWindowStation
-OpenDesktop
-RpcRevertToSelf
-SetThreadDesktop
-MessageBox
-SetThreadDesktop
-SetProcessWindowStation
-CloseDesktop
-CloseWindowStation

You can get a better explanation from MSDN.

Zsolt


You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com