Hi,
When a machine reboots, do all the services which are run under the accounts (system/service/network service) get run before a user logs on?
JD.
Hi,
When a machine reboots, do all the services which are run under the accounts (system/service/network service) get run before a user logs on?
JD.
Yes, using (by default) a built-in Windows account. In Services (run services.msc) there is a "Log On As" column that tells you the user that the service logs in as.
I do not think so. This should be asynchronous. If you are fast enough to log on, some of the services will still be coming up. This does not include "system" services
Services have a "start type" defined per-service, those types are boot, system, auto, demand, disabled.
Services also have dependencies on each other, defined in the registry.
Services with boot
and system
start type are started during the time period when only NT Native binaries can run (the Win32 API is not yet ready). For example, these services include such as csrss.exe
which provides some of the Win32 API.
Once Win32 has been initialized, the services with start type automatic
are started. During this time, the service which allows the user to log in runs -- this displays the login prompt and does allow the user to log in.
In every case, if the service being start depends on other services, then the other services will be started in advance.
So, yes, it is possible for users to log in prior to the execution of a service. However, if the login service were to depend on your service... Better, though, if you detect that your service has started. Considering using a named global event with CreateEvent() api. Your service creates the event, your application awaits the event before calling the service. Also, your app can use the ServiceControl API to start the service only when in use.
The windows "Services.msc" management plug-in hides the boot
and system
services. To learn more about these startup types, refer to this API documentation: MSDN: ChangeServiceConfig Function .