Create GUI from Windows Service with a Network Log on

百般思念 提交于 2019-12-06 00:34:59
casperOne

Your approach is completely wrong, and will not work when deployed on Vista.

Services should NEVER assume a login session with a desktop to interact with.

Rather, you should have a second application which is run when the user logs in (or some other point in time) which communicates with the service and then displays UI elements when it receives notifications/responses from the service.

See this other question (and answers) for further information:

How to detect if a Window can be Shown?

Short answer: No, you can't do this

Long answer: Noooooo.

Basically, Microsoft are making changes to further prevent this. As casperOne stated, you'll need to separate your UI components away from the service.

And even on XP it didn't work on non domain joined machines (if you have multiple users using Fast User Switching the popups showed up on either the wrong desktop or no desktop at all).

As to why Microsoft changed this, do a quick search for "Shatter Attack" - by isolating service code from the desktop they completely cut off this entire family of security vulnerabilities.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!