Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can a Service process Window Messages?

0 views
Skip to first unread message

Jeff Lanzarotta

unread,
Jan 7, 2004, 1:52:55 PM1/7/04
to
Hello,

Can a Service process/handle Window Messages? For example, if the
Service starts a new process, can the Service send and receive Windows
messages from that process? How about if a window is minimized, can
the Service intercept the Minimize message and process it?

Thanks for your help.

Regards,

----
Jeff

Tim Robinson

unread,
Jan 7, 2004, 2:33:43 PM1/7/04
to
A service can create windows like any other Win32 application, and these
windows can handle messages as normal. However, the windows that a service
creates won't be visible, and service windows and windows on the screen
can't interact*. This means that you can't send messages to a service window
from a normal application, and a service can't hook the desktop that the
user sees.

--
* The exception is if you enable "allow the service to interact with the
desktop" in Control Panel. But don't do this, since it provides a back door
into your service to any user logged onto the computer.

--
Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/

"Jeff Lanzarotta" <jefflan...@hotmail.com> wrote in message
news:1cc2fed6.04010...@posting.google.com...

lev

unread,
Jan 8, 2004, 5:26:34 AM1/8/04
to
As far as I remember you can allow service to interract with a desktop.
If you check properties of the service there is a n appropriate checkbox.
It also can be specified when server is installed programmatically.


"Tim Robinson" <tim.at.gaat.f...@invalid.com> wrote in message
news:bthmup$7jpls$1...@ID-103400.news.uni-berlin.de...

Tim Robinson

unread,
Jan 8, 2004, 3:09:58 PM1/8/04
to
Right, though read the footnote in my message as to why you should avoid
doing this. Also Google for "shatter attack".

All you need to do to get your own code to run in a vunerable service is:

1. Get the service to accept some machine code of your choosing, maybe
insert it into a configuration file
2. Obtain an address to that code
3. Post a WM_TIMER message to one of the service's windows, with the address
of the code in LPARAM
4. Watch as the service's DispatchMessage calls your code from the service's
message loop

The easy way to get around this is to disable the "interact with desktop"
option. I believe it's possible to enable a Windows policy which prevents
the user from having "interact with desktop" processes.

--
Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/

"lev" <ltsen...@brandsoft.com> wrote in message
news:tfaLb.87353$I07.421197@attbi_s53...

Jordy Hall

unread,
Jan 8, 2004, 5:37:30 PM1/8/04
to
Does this mean that an ActiveX object running server-side in a webserver
(e.g. IIS 5.x which runs as a service and not as an regular application)
can't send messages (using SendMessage()) to a regular windowed
application??

Coincidentally, I have just done that (already before reading this post).
I've created such an ActiveX (COM) object which does send messages to other
windows. When the object is used from within a VB application it works
flawlessy, but when the ActiveX object is used within an ASP webpage hosted
on IIS, the object gets called and gets executed as it should, except for
the the SendMessage() call. The sent messages are never received.

Is it possible to use SendMessage within an ActiveX object when it's running
in an ASP webpage??

Regards,


"Tim Robinson" <tim.at.gaat.f...@invalid.com> schreef in bericht
news:bthmup$7jpls$1...@ID-103400.news.uni-berlin.de...

Tim Robinson

unread,
Jan 9, 2004, 2:44:48 AM1/9/04
to
"Jordy Hall" <no@mail_for_me.com> wrote in message
news:KYkLb.5510$6B5....@amsnews02.chello.com...

> Does this mean that an ActiveX object running server-side in a webserver
> (e.g. IIS 5.x which runs as a service and not as an regular application)
> can't send messages (using SendMessage()) to a regular windowed
> application??

Yes, and the interaction with desktop thing is why.

[...]


> Is it possible to use SendMessage within an ActiveX object when it's
running
> in an ASP webpage??

Yes, just not to an interactive window on the user's screen.

0 new messages