Home All Groups Group Topic Archive Search About

Messagebox and Windows Service

Author
12 Jan 2005 7:00 PM
Patrick Jox
Hi,
I have my .NET application that is registered as as windows service. This
application exposes an interface to a third party library. During login to
the third party application I get a Messagebox when a wrong password is
used.

How does Windows handle such a messagebox? I heard, that messageboxes in
services are quit by the system and the message is stored in the event log.
This would be great, but as far as I experienced the application hangs.

How could I treat this?

Any suggestions?

Thanks a lot - Patrick

Author
12 Jan 2005 9:01 PM
William DePalo [MVP VC++]
"Patrick Jox" <Patr***@softwerk-n-o-s-p-a-m-technologies.com> wrote in
message news:uZ52hkN%23EHA.3908@TK2MSFTNGP12.phx.gbl...
> I have my .NET application that is registered as as windows service. This
> application exposes an interface to a third party library. During login to
> the third party application I get a Messagebox when a wrong password is
> used.

In the presence of a decent security policy services run on a non-visible
desktop. Further, well designed services don't have any UI but rather leave
the UI to a client application which runs on the visible desktop and which
uses some IPC mechanism to communicate with the service.

That said, there are a couple of hacks available if you must. One, check the
docs for the flags MB_SERVICE_NOTIFICATION and MB_ DEFAULT_DESKTOP and with
your vendor to see if he'd consider using them in his call to MessageBox().
Two, in the control panel properties for the service you can mark the
service as one which is allowed to interact with the desktop.

The latter opens up a security vulnerability - google for Shatter attack for
the details. I hear the option may be pulled in a future version of Windows.

Regards,
Will

AddThis Social Bookmark Button