[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, long lFlags, CFrameworkQuery & Query );
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.
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:
- Determine which instance WMI requested by reading the key properties with a Get method from CInstance, such as CInstance::GetCHString.
- 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.
|Minimum supported client||Windows Vista|
|Minimum supported server||Windows Server 2008|
|Header||provider.h (include FwCommon.h)|