Provider::GetObject(ParsedObjectPath*,MethodContext*,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.

Syntax

HRESULT GetObject(
        ParsedObjectPath *pParsedObjectPath,
        MethodContext    *pContext,
  [ref] long             lFlags
);

Parameters

pParsedObjectPath

Pointer to a CInstance object to be filled in by the framework provider.

pContext

Bitmask of flags with information about the GetObject operation. This is the value specified by the client in the IWbemServices::GetObject method.

The following flags are handled by (and filtered out) by WMI:

  • WBEM_FLAG_USE_AMENDED_QUALIFIERS
  • WBEM_FLAG_RETURN_WBEM_COMPLETE
  • WBEM_FLAG_RETURN_IMMEDIATELY

[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.

Remarks

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.

Requirements

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