ActivateService (Compact 2013)

3/26/2014

This function is called to load a service.

Syntax

HANDLE ActivateService(
  LPCWSTR lpszDevKey,
  DWORD dwClientInfo
);

Parameters

  • lpszDevKey
    [in] Pointer to the string that contains the name of the service to load. Information concerning the service's DLL name and other parameters is specified in the registry key HKEY_LOCAL_MACHINE\Services\lpszDevKey.
  • dwClientInfo
    [in] Reserved; set to 0 (zero).

Return Value

A handle to the service is returned on success. A NULL value is returned on failure. For extended error information, call GetLastError.

Remarks

Once ActivateService has been called, Servicesd.exe retrieves information about the service in HKEY_LOCAL_MACHINE\Services\lpszDevKey and loads the service as if it were being loaded upon system initialization.

For more information about setting up a service registry key for ActivateService or for use at system initialization, see Servicesd.exe Registry Settings.

Ee501277.security(en-us,WinEmbedded.80).gifSecurity Note:
ActivateService can be called from either privileged or normal applications, regardless of the setting of the DEVFLAGS_TRUSTEDCALLERONLY registry flag for the service. If a privileged application activates a service, a normal application cannot unload the service. However, if a normal application activates the service, then either a privileged application or a normal application can unload the service.

Requirements

Header

service.h

Library

coredll.lib

See Also

Reference

Servicesd.exe Functions
Servicesd.exe Registry Settings

Other Resources

Servicesd.exe