次の方法で共有


3.1.4.3.22 IWbemServices::ExecMethod (Opnum 24)

The IWbemServices::ExecMethod method executes a CIM method that is implemented by a CIM class or a CIM instance that is retrieved from the IWbemServices interface.

 HRESULT ExecMethod(
   [in] const BSTR strObjectPath,
   [in] const BSTR strMethodName,
   [in] long lFlags,
   [in] IWbemContext* pCtx,
   [in] IWbemClassObject* pInParams,
   [out, in, unique] IWbemClassObject** ppOutParams,
   [out, in, unique] IWbemCallResult** ppCallResult
 );

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

strMethodName: MUST be the name of the method to be executed. This parameter MUST NOT be NULL.

lFlags: Specifies the behavior of the IWbemServices::ExecMethod 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.

pInParams: MUST be a pointer to an IWbemClassObject interface pointer, which MUST contain an instance of input parameter CIM class as defined in [MS-WMIO] (section 2.3.3), with method parameter values set as properties. This parameter MUST be NULL when the method has no input parameters.

ppOutParams: 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

Success operation

Failure operation

WBEM_FLAG_RETURN_IMMEDIATELY is not set.

This parameter MUST NOT be NULL upon input. If NULL, the server MUST return WBEM_E_INVALID_PARAMETER. Upon output, the parameter MUST contain an IWbemClassObject interface pointer.

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

WBEM_FLAG_RETURN_IMMEDIATELY is set.

MUST return NULL.

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

ppCallResult: In this situation, 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.

Condition

Success operation

Failure operation

WBEM_FLAG_RETURN_IMMEDIATELY is not set.

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

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

WBEM_FLAG_RETURN_IMMEDIATELY is set.

The ppCallResult parameter MUST NOT be NULL upon input. If NULL, the server MUST return WBEM_E_INVALID_PARAMETER. Upon output, the parameter MUST contain the IWbemCallResult interface pointer.

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

Return Values: This method MUST return an HRESULT, which MUST indicate the status of the method call. HRESULT MUST have the type and values as specified in section 2.2.11. 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_METHOD_EXECUTE and WBEM_REMOTE_ENABLE accesses to the namespace; otherwise, WBEM_E_ACCESS_DENIED MUST be returned.

In response to IWbemServices::ExecMethod, the server MUST evaluate the strObjectPath and strMethodName parameters (as specified in this section) and MUST execute the method that is identified by strMethodName and implemented by the CIM object that is referred to by strObjectPath. The server MUST use the input parameters to the CIM method from the pInParams parameter, which is an instance of the input parameter CIM class as defined in [MS-WMIO] (section 2.3.3). The server MUST execute the CIM method and send the output parameters as an instance of the output parameter CIM class as defined in [MS-WMIO] (section 2.3.3). The method MUST fail if the CIM object that is referred to by strObjectPath does not exist, if the method parameters are not valid, as specified earlier in this section, or if the server is unable to execute the method.

If the strMethodName has "disabled" qualifier set to true, then the server MUST return WBEM_E_METHOD_DISABLED. If the strMethodName is not implemented by the CIM class as pointed by the strObjectPath, the server MUST return WBEM_E_METHOD_NOT_IMPLEMENTED.

The successful synchronous method execution MUST return the output parameters that are encapsulated in an IWbemClassObject interface pointer in the ppObject parameter and MUST return WBEM_S_NO_ERROR.

The semisynchronous method execution MUST follow the rules that are 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.