BOOL ControlService(
SC_HANDLE hService, // handle to service
DWORD dwControl, // control code
LPSERVICE_STATUS lpServiceStatus // status information
);
dwControl 赋值为SERVICE_CONTROL_PAUSE 暂停
即 Notifies a service that it should pause. The hService handle must have SERVICE_PAUSE_CONTINUE access.
SC_HANDLE CreateService(
SC_HANDLE hSCManager, // handle to SCM database
LPCTSTR lpServiceName, // name of service to start
LPCTSTR lpDisplayName, // display name
DWORD dwDesiredAccess, // type of access to service
DWORD dwServiceType, // type of service
DWORD dwStartType, // when to start service
DWORD dwErrorControl, // severity of service failure
LPCTSTR lpBinaryPathName, // name of binary file
LPCTSTR lpLoadOrderGroup, // name of load ordering group
LPDWORD lpdwTagId, // tag identifier
LPCTSTR lpDependencies, // array of dependency names
LPCTSTR lpServiceStartName, // account name
LPCTSTR lpPassword // account password
);
dwStartType 赋值为SERVICE_AUTO_START 开机自动运行
即A service started automatically by the service control manager during system startup.