GetServiceHandle (Windows CE 5.0)
This function returns the handle to a service instance based on its prefix.
This function is deprecated. To obtain a service handle, call CreateFile with the same prefix of the service whose handle must be retrieved.
Note Do not use CreateFile to get the service handle if DeregisterService is called to unload the specified service. In this case, call GetServiceHandle to obtain the handle.
HANDLE GetServiceHandle(LPWSTRszPrefix,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.
Remarks
This function returns the handle to a service instance based on its prefix. This function is deprecated. To obtain a service handle, call CreateFile with the same prefix of the service whose handle must be retrieved.
Requirements
OS Versions: Windows CE .NET 4.0 and later.
Header: Service.h.
Link Library: Coredll.lib.
See Also
RegisterService | ActivateService | Services.exe | CreateFile
Send Feedback on this topic to the authors