次の方法で共有


3.1.4.3.19 IWbemServices::ExecQueryAsync (Opnum 21)

The IWbemServices::ExecQueryAsync method is the asynchronous version of the IWbemServices::ExecQuery method. The IWbemServices::ExecQueryAsync method returns an enumerable collection of IWbemClassObject interface objects based on a query.

 HRESULT ExecQueryAsync(
   [in] const BSTR strQueryLanguage,
   [in] const BSTR strQuery,
   [in] long lFlags,
   [in] IWbemContext* pCtx,
   [in] IWbemObjectSink* pResponseHandler
 );

strQueryLanguage: MUST be set to "WQL".

strQuery: MUST contain the WQL query text as specified in section 2.2.1. This parameter MUST NOT be NULL.

lFlags: Specifies the behavior of the IWbemServices::ExecQueryAsync method. Flag behavior MUST be interpreted as specified in the following table.

The server MUST allow any combination of zero or more flags from the following table and MUST comply with all the restrictions in a flag description. Any other DWORD value that does not match a flag condition MUST be treated as not valid.

Value

Meaning

WBEM_FLAG_USE_AMENDED_QUALIFIERS

0x00020000

If this bit is not set, the server SHOULD not return CIM localizable information.

If this bit is set, the server SHOULD return CIM localizable information for the CIM object, as specified in section 2.2.6.

WBEM_FLAG_SEND_STATUS

0x00000080

If this bit is not set the server MUST make one final IWbemObjectSink::SetStatus call on the interface pointer that is provided in the pResponseHandler parameter.

If this bit is set, the server MAY make intermediate IWbemObjectSink::SetStatus calls on the interface pointer prior to call completion.

WBEM_FLAG_PROTOTYPE

0x00000002

If this bit is not set, the server MUST run the query.

If this bit is set, the server MUST only return the class schema of the resulting objects.

WBEM_FLAG_DIRECT_READ

0x00000200

If this bit is not set, the server MUST consider the entire class hierarchy when it returns the result.

If this bit is set, the server MUST disregard any derived class when it searches the result.

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.

pResponseHandler: MUST be a pointer to the IWbemObjectSink interface that is implemented by the caller, where enumeration results are delivered. The parameter MUST NOT be NULL.

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 (as specified in section 2.2.11) to indicate the successful completion of the method.

WBEM_S_NO_ERROR (0x00)

The following validation happens before asynchronous operation is started.

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

This method MUST fail if strQueryLanguage or strQuery does not exist.

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

Requirements mentioned in the parameter definitions are also checked before an asynchronous operation is started.

If successful, the server MUST create a new entry in AsyncOperationTable as specified in section 3.1.1.1.3.

The following validation happens asynchronously.

In response to an IWbemServices::ExecQueryAsync method call, the server MUST evaluate the strQueryLanguage and strQuery parameters (as specified in this section) and return all instances that match the requested query. The method MUST fail if the method parameters or their combinations are not valid as specified earlier in this section, or if the server is unable to execute the method.

If the strQuery is not syntactically valid or one or more elements in <PROPERTY-LIST> contains undefined properties, the server MUST return WBEM_E_INVALID_QUERY.

See IWbemServices::ExecQuery (Opnum 20) (section 3.1.4.3.18) for more details on the processing rules for WQL queries.