Windows NT ( 2)



         

SRVCTRL - 4


SERVICE_ALL_ACCESS);

if(!schService)

break;

//

StartService(schService, 0, NULL);

//

//

CloseServiceHandle(schSCManager);

break;

}

case ID_SERVICE_STOP:

{

//

schSCManager = OpenSCManager(NULL, NULL,

SC_MANAGER_ALL_ACCESS);

if(!schSCManager)

break;

// MYServiceName

schService = OpenService(

schSCManager, MYServiceName,

SERVICE_ALL_ACCESS);

//

ControlService(schService,

SERVICE_CONTROL_STOP, &ss);

//

//

CloseServiceHandle(schSCManager);

break;

}

case ID_SERVICE_GETCONFIGURATION:

{

//

schSCManager = OpenSCManager(NULL, NULL,

SC_MANAGER_ALL_ACCESS);

if(!schSCManager)

break;

// MYServiceName

schService = OpenService(

schSCManager, MYServiceName,

SERVICE_ALL_ACCESS);

if(!schService)

break;

//

lpBuf = (LPQUERY_SERVICE_CONFIG)malloc(4096);

if(lpBuf != NULL)

{

//

QueryServiceConfig(schService,

lpBuf, 4096, &dwBytesNeeded);

//

wsprintf(szBuf, "Binary path: %s\n"

"Start Name: %s\n"

"Display Name: %s\n",

lpBuf->lpBinaryPathName,

lpBuf->lpServiceStartName,

lpBuf->lpDisplayName);

MessageBox(hWnd, szBuf, szAppTitle,