3.1.4.3 RDeleteService (Opnum 2)

The RDeleteService method marks the specified service for deletion from the SCM database.

 DWORD RDeleteService(
   [in] SC_RPC_HANDLE hService
 );

hService: An SC_RPC_HANDLE (section 2.2.4) data type that defines the handle to the service record that MUST have been created previously, using one of the open methods specified in section 3.1.4. The DELETE access right MUST have been granted to the caller when the RPC context handle to the service record was created.

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

Return value/code

Description

5

ERROR_ACCESS_DENIED

The DELETE access right had not been granted to the caller when the RPC context handle to the service record was created.

6

ERROR_INVALID_HANDLE

The handle is no longer valid.

1072

ERROR_SERVICE_MARKED_FOR_DELETE

The RDeleteService has already been called for the service record identified by the hService parameter.

1115

ERROR_SHUTDOWN_IN_PROGRESS

The system is shutting down.

The server MUST change the Start in the service record to SERVICE_DISABLED.

The server MUST set the Deleted field to TRUE in the service record to indicate that the deletion is pending.

The server MUST delete the service record when the last RPC context handle created for the service has been closed by a call to the RCloseServiceHandle (section 3.1.4.1) function.