次の方法で共有


3.1.4.3.14 IWbemServices::DeleteInstance (Opnum 16)

The IWbemServices::DeleteInstance method deletes an instance of an existing class from the namespace that is pointed to by the IWbemServices interface object that is used to call the method.

 HRESULT DeleteInstance(
   [in] const BSTR strObjectPath,
   [in] long lFlags,
   [in] IWbemContext* pCtx,
   [out, in, unique] IWbemCallResult** ppCallResult
 );

strObjectPath: MUST be the CIM path to the class instance that the client wants to delete. This parameter MUST NOT be NULL. The CIM path MUST contain the class name and the value of the key properties.

lFlags: Flags that affect the behavior of the IWbemServices::DeleteInstance method. Flag behavior MUST be interpreted as specified in the following table.

Value

Meaning

WBEM_FLAG_RETURN_IMMEDIATELY

0x00000010

If this bit is not set, the server MUST make the method call synchronously.

If this bit is set, the server MUST make the method call semisynchronously.

Any other DWORD value that does not match the preceding condition MUST be treated as invalid.

pCtx: MUST be a pointer to an IWbemContext interface, which MUST contain additional information that the client wants to pass to the server. If pCtx is NULL, the parameter MUST be ignored.

ppCallResult: If the input parameter is non-NULL, the server MUST return WBEM_S_NO_ERROR and IWbemCallResult MUST deliver the result of the requested operation (regardless whether WBEM_FLAG_RETURN_IMMEDIATELY is set). The output parameter MUST be filled according to the state of the lFlags parameter (whether WBEM_FLAG_RETURN_IMMEDIATELY is set) as listed in the following table.

Flag state

Operation Started Successfully

Operation Failed to Start

WBEM_FLAG_RETURN_IMMEDIATELY is not set.

MUST be set to IWbemCallResult if the input parameter is non-NULL.

MUST be set to NULL if the input parameter is non-NULL.

WBEM_FLAG_RETURN_IMMEDIATELY is set.

This parameter MUST NOT be NULL upon input. If NULL, the server MUST return WBEM_E_INVALID_PARAMETER. On output, the parameter MUST contain the IWbemCallResult interface pointer.

MUST be set to NULL if the input parameter is non-NULL.

If the ppCallResult input parameter is NULL and WBEM_FLAG_RETURN_IMMEDIATELY is not set, the server MUST deliver the result of the requested operation synchronously.

Return Values: This method MUST return an HRESULT value that MUST indicate the status of the method call. The server MUST return WBEM_S_NO_ERROR (specified in section 2.2.11) to indicate the successful completion of the method.

WBEM_S_NO_ERROR (0x00)

The security principal that makes the call MUST have WBEM_REMOTE_ENABLE and WBEM_ENABLE accesses to the namespace; otherwise,  WBEM_E_ACCESS_DENIED MUST be returned.

If the CIM instance being updated is dynamic, the security principal that makes the call MUST have WBEM_WRITE_PROVIDER access to the namespace; otherwise, WBEM_E_ACCESS_DENIED MUST be returned.

If the CIM instance being updated is static and if the CIM instance is of a class that has a WMI system class as one of the classes in the parent hierarchy, the security principal that makes the call MUST have WBEM_FULL_WRITE access to the namespace; otherwise, WBEM_E_ACCESS_DENIED MUST be returned.

If the CIM instance being updated is static and if the CIM instance is of a class that does not have a WMI system class as one of the classes in the parent hierarchy, the security principal that makes the call MUST have WBEM_PARTIAL_WRITE_REP access to the namespace; otherwise, WBEM_E_ACCESS_DENIED MUST be returned.

If the CIM instance being deleted is dynamic, the server MUST obtain SupportsDelete for the given provider in the ProviderTable. If SupportsDelete is FALSE, the server MUST return WBEM_E_PROVIDER_NOT_CAPABLE.

In response to the IWbemServices::DeleteInstance method, the server MUST evaluate the strObjectPath parameter (as specified in this section) and MUST delete the instance that is identified by strObjectPath from the current namespace. The method MUST fail if the following applies: if strObjectPath does not exist; if the method parameters or their combinations are not valid as specified in the preceding list; or if the server is unable to execute the method.

The server SHOULD enforce a maximum length for the strObjectPath parameter, and return WBEM_E_QUOTA_VIOLATION if the limit is exceeded.<44>

The successful synchronous method execution MUST return WBEM_S_NO_ERROR.

The semisynchronous method execution MUST follow the rules as specified in section 3.1.1.1.2.

The failed method execution MUST set the output parameters to NULL and MUST return an error in the format specified in section 2.2.11.