hi,
this is the code that i was written for getting the service ststus.i am not getting the status with this code .problem is
QueryServiceStatus(schs,TServiceStatus) function fails(returning zero).any bidy have idea regading this help me.
DWORD ServiceGetStatus(char *sService)
{
SC_HANDLE schm;
SC_HANDLE schs;
LPSERVICE_STATUS TServiceStatus = NULL;
DWORD dwStat = -1;
//dwStat = -1;
// connect to the service control manager
//schm = OpenSCManager(NULL,NULL,SC_MANAGER_CONNECT);
schm = OpenSCManager(NULL,NULL,SC_MANAGER_CONNECT);
if(schm > 0)
{
schs = OpenService(schm,sService,SERVICE_QUERY_STATUS);
if(schs > 0)
{
if(QueryServiceStatus(schs,TServiceStatus))
{
dwStat = TServiceStatus->dwCurrentState;
CloseServiceHandle(schs);
CloseServiceHandle(schm);
}
std::cout<<"status is false"<