3.1.4.1 RCloseServiceHandle (Opnum 0)

The RCloseServiceHandle method is called by the client. In response, the server releases the handle to the specified service or the SCM database.

 DWORD RCloseServiceHandle(
   [in, out] LPSC_RPC_HANDLE hSCObject
 );

hSCObject: An SC_RPC_HANDLE (section 2.2.4) data type that defines the handle to a service record or to the SCM database that MUST have been created previously using one of the open methods specified in section 3.1.4.

Return Values: The method returns 0x00000000 (ERROR_SUCCESS) on success; otherwise, it returns the following error code.

Return value/code

Description

6

ERROR_INVALID_HANDLE

The handle is no longer valid.

0xFFFF75FD

The operation completed successfully. Additionally, the passed handle was the last one created for the associated service record that was previously used in a successful call to the RNotifyServiceStatusChange (section 3.1.4.43) method.

0xFFFF75FE

The operation completed successfully. Additionally, the passed handle was previously used in a successful call to the RNotifyServiceStatusChange method.

In response to this request from the client, for a successful operation, the server MUST close the handle to the service record or the SCM database specified by the hSCObject parameter specified in the client request.

If hSCObject is the RPC control handle that has been created for the service record, the server MUST decrement the HandleCount field of the service record. If the Deleted field of the service record indicates that RDeleteService has been successfully called with the RPC control handle created for the same service record, and HandleCount indicates that hSCObject is the last RPC control handle created for this service record, the server MUST delete the service record.