CWbemProviderGlue::GetAllInstancesAsynch method (wbemglue.h)

[The CWbemProviderGlue class is part of the WMI Provider Framework which is now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.]

The GetAllInstancesAsynch method retrieves a list of instances returned by a specific class. This method allows the provider to respond asynchronously by returning one instance at a time.

Syntax

HRESULT GetAllInstancesAsynch(
  LPCWSTR                    pszClassName,
  Provider                   *pRequester,
  LPProviderInstanceCallback pCallback,
  LPCWSTR                    pszNamespace,
  MethodContext              *pMethodContext,
  void                       *pUserData
);

Parameters

pszClassName

Name of class for which list of instances should be returned.

pRequester

The "This" pointer for the callback function pointed to by pCallback.

pCallback

Pointer to a static function with this prototype:

static HRESULT WINAPI Classname::FunctionName(Provider *pProvider,
                                              CInstance *pInstance,
                                              MethodContext *pMethodContext,
                                              void *pUserData );

where Classname is the name of a class derived from class Provider. It is an instance of this class that is the "this" pointer defined by pRequester. This function is called to return each instance supported by the provider specified by pszClassName.

pszNamespace

Namespace of the provider specified by pszClassName. This parameter can be NULL to indicate the default namespace, which is root\cimv2.

pMethodContext

Pointer to the current context. A context must be provided to prevent deadlocks. Either use the context passed into the provider by Provider::EnumerateInstances or Provider::ExecQuery, or else obtain it from the instance using CInstance::GetMethodContext. This parameter must not be NULL.

pUserData

Pointer to user-defined data that is passed to the function pointed to by pCallback.

Return value

The method returns WBEM_S_NO_ERROR if the operation was successful, WBEM_E_OUT_OF_MEMORY if the operation failed due to lack of memory, or any other HRESULT error code.

Remarks

The GetAllInstancesAsynch method performs almost the same function as GetAllInstances. However, instead of returning one arbitrarily large array of instances, the provider passes an instance to the function specified by pCallback each time the instance is retrieved from a provider. This allows the provider to use less memory, and to begin returning instances to the client sooner.

Note  Because the call-back to the sink might not be returned at the same authentication level as the client requires, it is recommended that you use semisynchronous instead of asynchronous communication. For more information, see Calling a Method.
 
This method is semantically equivalent to the query SELECT * FROM pszBaseClassName WHERE __Class = pszBaseClassName.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header wbemglue.h (include FwCommon.h)
Library FrameDyn.lib
DLL FrameDynOS.dll; FrameDyn.dll