Provider::GetObject(CInstance*,long) method (provider.h)

[The Provider 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 GetObject method is called by WMI to retrieve an instance of a class.


HRESULT GetObject(
        CInstance *pInstance,
  [ref] long      lFlags




[ref] lFlags

Query object that indicates the set of properties to be populated, as requested by a call to Provider::GetObject.

A provider can realize a significant performance gain by filling in only these requested property values. The provider determines which properties are requested by using CFrameworkQuery::IsPropertyRequired. Otherwise, the provider must fill in all property values.

Return value

The default framework provider implementation of this method returns WBEM_E_PROVIDER_NOT_CAPABLE to the calling method. The IWbemServices::GetObject method lists the common return values, although you can choose to implement any COM return value.


WMI often invokes GetObject in response to a client call to IWbemServices::GetObject. The WMI version of Provider::GetObject provides an instance with only the key properties populated. In contrast, an implemented framework provider must fill in all other properties. The following describes a common override of GetObject:

  1. Determine which instance WMI requested by reading the key properties with a Get method from CInstance, such as CInstance::GetCHString.
  2. Populate the rest of the properties of the instance using the many Set methods of the CInstance class, such as CInstance::SetByte or CInstance::SetStringArray.


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