Message to Windows logon screen when services started
Asked Answered
E

1

1

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.

Endodermis answered 6/8, 2015 at 1:21 Comment(2)
Hi TonyG, have you worked out a solution for your problem? Could you share this with me? I have a service that monitors the insertion of a USB dongle. If the user insert the dongle a local user account will be activated and can be used for login.Partnership
For that application, see Option #2 from @vivek. I did not write my code because even with the CP it seems we still don't know when Windows is done. We only know when specific services are started. I would need to monitor the list of all services that start at boot/login and then remove each from the list as they started, to make a good guess as to whether the boot is complete. I was hoping to find a flag that Windows itself might set when it has exhausted the startup list. Then I wouldn't need to maintain my list separately and manually.Endodermis
B
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.

Bedfast answered 17/1, 2016 at 0:19 Comment(4)
Thank you VERY much for responding to this older inquiry. I'll get into code for this over the next few weeks. Will flag this as the accepted answer if no one else posts for a while. I'm only concerned now that I won't be using this after an upgrade to Windows 10, but that's another topic and you Did answer This question.Endodermis
According to MSDN, the V1 CP also works on Windows 10. However, there seem to be some bugs with it. For your purposes, it might be alright.Bedfast
@Endodermis have you been able to resolve this requirement? Would it be possible to get an example of this? I have the exact same issue.Clarissa
@FranzKiermaier I never did create a good solution to that challenge. It seems the solution is somewhere between a wait for delayed services to start, and monitoring the disk and CPU for the post-startup lull in activity. See this other thread on the topic: #10502353Endodermis

© 2022 - 2024 — McMap. All rights reserved.