我已经成功创建了一个服务:
hService = CreateService(hSCManager,lpServiceName,lpDisplayName,
SERVICE_ALL_ACCESS,
SERVICE_KERNEL_DRIVER,
dwStartType,
SERVICE_ERROR_NORMAL,
lpFilePath,
NULL,
NULL,
NULL,
NULL,
NULL);
但是当我尝试启动服务时:
hService = OpenService(hSCManager, lpServiceName, SERVICE_ALL_ACCESS);
if (StartService(hService,0,NULL)== NULL){
DWORD error = GetLastError();
}
误差等于ERROR_SERVICE_DISABLED
。如何启用服务?这在 Windows API 文档中并不是很明显。