次の方法で共有


3.1.4.4 RLockServiceDatabase (Opnum 3)

The RLockServiceDatabase method acquires a lock on an SCM database.

 DWORD RLockServiceDatabase(
   [in] SC_RPC_HANDLE hSCManager,
   [out] LPSC_RPC_LOCK lpLock
 );

hSCManager: An SC_RPC_HANDLE (section 2.2.4) data type that defines the handle to the SCM database created using one of the open methods specified in section 3.1.4. The caller MUST be granted the SC_MANAGER_LOCK access right when the RPC context handle is created.

lpLock: An LPSC_RPC_LOCK (section 2.2.5) data type that defines the handle to the resulting database lock.

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 SC_MANAGER_LOCK access rights had not been granted to the caller when the RPC context handle was created.

6

ERROR_INVALID_HANDLE

The handle is no longer valid.

1055

ERROR_SERVICE_DATABASE_LOCKED

The service database is locked.

In response to this request from the client, for a successful operation, the server SHOULD lock the SCM database identified by the hSCManager parameter of the client request.<36>

After the database is locked, the server MUST respond with error code ERROR_SERVICE_DATABASE_LOCKED (1055) for future RLockServiceDatabase, RStartServiceW, and RStartServiceA RPCs. All other methods are unaffected.<37>

If the client holding the lock crashes or does not cleanly shut down, then an RPC context handle rundown callback executes on the server to release the lock. See [MS-RPCE] section 3.3.3.2.1 Connection Time-out.