IWbemHiPerfProvider::GetObjects method

The IWbemHiPerfProvider::GetObjects method inserts the non-key properties of the objects in the supplied array. WMI calls GetObjects in response to a IWbemServices::GetObject call. If a provider does not implement GetObjects, WMI attempts to service a GetObject request with a call to the IWbemHiPerfProvider::CreateRefreshableObject method.

Note  If a provider does not implement this method, it must return WBEM_E_PROVIDER_NOT_CAPABLE.


HRESULT GetObjects(
  [in]      IWbemServices     *pNamespace,
  [in]      long              lNumObjects,
  [in, out] IWbemObjectAccess *apObj,
            long              lFlags,
            IWbemContext      *pCtx


pNamespace [in]

An IWbemServices pointer back into Windows Management, which can service any request made by the provider. The provider should call AddRef on this pointer if it is going to call back into Windows Management during its execution.

lNumObjects [in]

Integer that contains the number of objects you are retrieving.

apObj [in, out]

Pointer to an array of IWbemObjectAccess objects. The GetObjects method inserts the key properties of each object into this array.


Reserved. This parameter must be 0.


Typically NULL; otherwise, a pointer to an IWbemContext object that is required by one or more dynamic class providers. The values in the context object must be specified in specific provider documentation. For more information about this parameter, see Making Calls to WMI..

Return value

This method returns an HRESULT indicating the status of the method call. The following list lists the value contained within an HRESULT.


The method was successful.


The provider does not implement this method.


The requested instance could not be found.


The current user does not have permission to retrieve the specified instance.


The requested objects will have their key properties filled out.


The following code example describes how to implement GetObjects.

HRESULT CMyHiPerfProvider::GetObjects(
  /* [in] */IWbemServices *pNamespace,
  /* [in] */  long lNumObjects,
  /* [in,out] */IWbemObjectAccess **apObj,
  /* [in] */long lFlags,
  /* [in] */IWbemContext *pCtx

  for ( long i = 0; i < lNumObjects; i++ )
      // Validate the instance (that is, ensure
      // the path is good); if it fails, return
      // the error.

      // For example, create a method that validates
      // the IWbemObjectAccess instance and returns
      // false if validation failed.
      /*if ( !ValidateInstance( apObj[i] ) )
          return WBEM_E_NOT_FOUND;*/

      // Fill out the instance.
      // For example, create a method that assigns
      // a value to the IWbemObjectAccess instance.
      /*FillInstance( apObj[i] );*/

  return WBEM_S_NO_ERROR;


Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008


Wbemprov.h (include Wbemidl.h)





See also

Developing a WMI Provider
Writing an Instance Provider
Making an Instance Provider into a High-Performance Provider
Performance Counter Provider