Message to Windows logon screen when services started

試著忘記壹切 提交于 2019-12-13 01:34:33

问题


When I boot my Windows 8.1 laptop, I want to display a message on the Windows logon screen so that I know when all services and startup processes have started. Aside from just waiting some number of minutes, with the assumption that all services that can start have done so, how can I code a process to query for a "startup complete" condition and then update the UI?

Would detection of startup-complete be possible with a group policy startup script or a task scheduler routine that triggers on some "services started" condition? Should I look for a specific message in the Event Log?

To message the logon screen, I'm guessing I need to write a Windows Credential Provider, and as a C# developer I believe I should be looking at PGina?

Before I start writing code from scratch, might there already be a canned solution for this somewhere?

I'm currently looking to Add message to logon screen windows 7 where by updating a registry entry I should be able to warn if it's safe to do a logon or not ... once I find out how to determine that condition.


[edit] Removed extensive irrelevant text with reasoning about why I'm doing this. Hoping for a response to a concise and focused question.


回答1:


Yes, you would need to use a Credential Provider (CP). I am more familiar with C++ and Credential Provider V1, so the terminology below is from there. You can easily find the equivalent C# code or use native interop.

The check for Services needs to be in the SetSelected method of the CP.

You have two options -

  1. If you are waiting for Windows Services, use the Service Control Manager to query status as "Started".

  2. If you are waiting for your own services, add a "ready" event to each of those services and trigger a SetEvent from there. On the Credential Provider end, use WaitForSingleObject for each service in sequence. It's quite possible some services will start before others. That's fine. However, if you need to show a UI indicated as each service starts, you can use WaitForMultipleObjects in a loop and keep removing the handles of events that get signaled.



来源:https://stackoverflow.com/questions/31845319/message-to-windows-logon-screen-when-services-started

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