Click to See Complete Forum and Search --> : Windows NT Services


C Jaiprakash
July 28th, 2000, 05:42 AM
Hi..
I have written NT Service.. which actually depends on other service which is running on other machine.. I want my service not to start if other service is not running.. how can i do that..?
I will appreciate any response from u..
Jaiprakash

philpax
April 9th, 2001, 02:19 PM
This is easy, you need to specify the other services when you call CreateService.

The second from the last parameter (lpDependencies) is a NULL separated list of services. Example: _T("RPCSS\0MSMQ\0")

One warning, you need to service name, not the displayed name (Fax Service is the displayed name, Fax is the service name). You can get the service name by looking at a services properties.

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
);