Windows NT ( 2)



         


, QueryServiceConfig:

BOOL QueryServiceConfig(

SC_HANDLEschService, //

LPQUERY_SERVICE_CONFIG lpqscServConfig, //

// QUERY_SERVICE_CONFIG,

//

DWORD cbBufSize, //

LPDWORD lpcbBytesNeeded); // ,

// ,

//

QUERY_SERVICE_CONFIG :

typedef struct _QUERY_SERVICE_CONFIG

{

DWORD dwServiceType;

DWORD dwStartType;

DWORD dwErrorControl;

LPTSTR lpBinaryPathName;

LPTSTR lpLoadOrderGroup;

DWORD dwTagId;

LPTSTR lpDependencies;

LPTSTR lpServiceStartName;

LPTSTR lpDisplayName;

} QUERY_SERVICE_CONFIG, LPQUERY_SERVICE_CONFIG;

CreateService, .

, :

schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);

schService = OpenService(

schSCManager, MYServiceName, SERVICE_ALL_ACCESS);

lpBuf = (LPQUERY_SERVICE_CONFIG)malloc(4096);

if(lpBuf != NULL)

{

QueryServiceConfig(schService, lpBuf, 4096, &dwBytesNeeded);

. . .

free(lpBuf);

}