CWbemProviderGlue::GetInstanceKeysByPath method (wbemglue.h)

[The CWbemProviderGlue 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 GetInstanceKeysByPath method retrieves the instance identified by a particular object path, with only the key properties populated.


HRESULT GetInstanceKeysByPath(
  LPCWSTR       pszInstancePath,
  CInstance     **ppInstance,
  MethodContext *pMethodContext



An object path to the instance to be returned.


A pointer to a pointer to a new CInstance instance whose keys are those specified in the pszInstancePath. The framework provider the performs the request must release this pointer.


A pointer to the current context. A context must be provided to prevent deadlocks. Either use the context passed into the provider by Provider::EnumerateInstances or Provider::ExecQuery, or else obtain it from the instance using CInstance::GetMethodContext. This parameter must not be NULL.

Return value

Returns WBEM_S_NO_ERROR if the operation was successful, WBEM_E_OUT_OF_MEMORY if the operation failed due to lack of memory, or any other HRESULT error code.


This method makes use of partial-instance update operations to request only the key properties of the specified object. It is the most efficient way to verify the existence of a specific object. Be aware that not all providers support partial-instance operations. In that case, the entire instance will be populated. For more information, see Supporting Partial-Instance Operations.

In the current version of the provider framework, pszInstancePath must resolve to be an instance path on the same computer.


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

See also