请问,通过CreateService函数创建的服务,在window的服务列表中已经可见,但是通过服务时启动总是报1053错误,服务不能启动
请问,通过CreateService函数创建的服务,在window的服务列表中已经可见,但是通过服务时启动总是报1053错误,服务不能启动,显示服务不能响应请求,代码如下:
SC_HANDLE sc1, sc2;
sc1 = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if(sc1==NULL)
{
//MessageBox("系统服务数据采集失败", "Error", MB_OK|MB_ICONWARNING);
OutputDebugString("系统服务数据采集失败");
return FALSE;
}
else
{
OutputDebugString("系统服务数据采集成功");
}
LPCTSTR lpszDisplayName = "PMC Service";
LPCTSTR lpszBinaryPathName = sFilePath;
sc2 = CreateService(
sc1, // SCManager database
"PMC Service for SGM", // name of service
lpszDisplayName, // service name to display
SERVICE_ALL_ACCESS, // desired access
SERVICE_WIN32_OWN_PROCESS, // service type
SERVICE_AUTO_START, // start type
SERVICE_ERROR_NORMAL, // error control type
lpszBinaryPathName, // service's binary
NULL, // no load ordering group
NULL, // no tag identifier
NULL, // no dependencies
NULL, // LocalSystem account
NULL); // no password
if (sc2 == NULL)
{
OutputDebugString("失败");
}
else
{
OutputDebugString("SUCCESS");
}
CloseServiceHandle(sc2);
return TRUE;
}
是不是还有其他设置函数调用的问题,谢谢大家,在线等候