GetServiceHandle

This function returns the handle to a service instance based on its prefix.

HANDLE GetServiceHandle(
  LPWSTR szPrefix,
  LPWSTR szDllName,
  DWORD pdwDllBuf
);

Parameters

  • szPrefix
    [in] String that specifies the prefix of the service whose handle must be retrieved. This string is in the form XXXN:, where XXX is the prefix specified on either RegisterService or the prefix registry value read during ActivateService, and N is the index number. For example, the prefix HTP0: specifies the Web server.
  • szDllName
    [out] Optional. String that contains the name of the service DLL associated with szPrefix.
  • pdwDllBuf
    [in, out] Optional. Pointer to the DWORD that specifies the number of bytes in the szDllName buffer. On return, specifies the number of bytes written or the number of bytes required if the buffer is not large enough. This value includes the terminating NULL character.

Return Values

Returns a handle to the requested service on success and INVALID_HANDLE_VALUE on failure. To get extended error information, call GetLastError.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Service.h.
Link Library: Coredll.lib.

See Also

RegisterService | ActivateService | Services.exe

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.