NT Service When the service is installed, select Start Service Service Process in the MMC, the entry is the main () function main () call startServiceCtrldispatcher () and hangs multiple services because a service process can support multiple services because a service process can support multiple services. For each Services StartServiceCtrlDispatcher () Generate a thread to perform the service
The entry address of each service is called when calling startservicectrldispatcher ()
Assume that the entrance to a service is service_main ()
Service_main () Calls RegisterServiceCtrlHandler () to register the service control handler, the service control handler calls the thread that executes main () instead of executing the thread of service_main ().
Assume that the entry of the service handler is service_ctrl ()
Service_ctrl () Controls the operation of the service based on the control command passed by the parameter such as service_control_pause, service_control_stopue or service_control_stop.
Service_main () starts the truly work of the service after registering the service control handler