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.
 

Syntax


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

Parameters

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.

lFlags

Reserved. This parameter must be 0.

pCtx

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.

WBEM_S_NO_ERROR

The method was successful.

WBEM_E_PROVIDER_NOT_CAPABLE

The provider does not implement this method.

WBEM_E_NOT_FOUND

The requested instance could not be found.

WBEM_E_ACCESS_DENIED

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

Remarks

The requested objects will have their key properties filled out.

Examples

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;
}

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Wbemprov.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

Wmiprvsd.dll

See also

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

 

 

Show: