DeregisterService

This function stops a service instance.

BOOL DeregisterService(
  HANDLE hDevice
);

Parameters

Return Values

A nonzero value indicates success. A value of zero indicates failure. To get extended error information, call GetLastError.

Remarks

DeregisterService will first call into the service's exported xxx_IOControl with the dwCode value set to IOCTL_SERVICE_QUERY_CAN_DEINIT. If xxx_IOControl returns a value of TRUE and sets the buffer passed in to a nonzero value, DeregisterService will not unload the service. If the service is to be unloaded, all super service sockets associated with the service instance will be unbound and Services.exe will call xxx_Deinit.

If the service instance is the last service loaded by a service DLL, the DLL will be unloaded from memory after the call to xxx_Deinit returns. It is extremely important that no other threads created by the DLL are running after the DLL has been unloaded from memory because unloading the DLL will unload any code pages. Any thread that attempts to access these code pages will cause an exception.

Requirements

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

See Also

ActivateService | RegisterService | GetServiceHandle | xxx_Deinit | xxx_IOControl | Services.exe

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.