IWbemServices::GetObject

[This is preliminary documentation and subject to change.]

The IWbemServices::GetObject method locates an object by path.

This method retrieves an object, either a class definition or an instance, based on its path. This method only retrieves objects from the namespace associated with the current IWbemServices object.

HRESULT IWbemServices::GetObject(
  [in] BSTR bstrObjectPath,                          
  [in] LONG lFlags,                              
  [in] IWbemContext *pCtx,                        
  [out, OPTIONAL] IWbemClassObject **ppObject,    
  [out, OPTIONAL] IWbemCallResult **ppCallResult  
);
 

Parameters

bstrObjectPath
The object path of the object to retrieve. If this is NULL, an empty object is returned that can become a new class. See Class Creation.
lFlags
Reserved. It must be zero.
pCtx
Typically NULL. Otherwise, this is a pointer to an IWbemContext object required by the dynamic class provider that is producing the class instances. The values in the context object must be specified in the documentation for the provider in question.
ppObject
If not NULL, this receives the object, if it is found. The returned object has a positive reference count. The caller must use Release when the object is no longer needed. In all cases of error, this parameter is set to point to NULL.
ppCallResult
If NULL, this is not used. Otherwise, the call returns immediately and ppCallResult receives a pointer to a new IWbemCallResult object which can be periodically polled to determine the result of the call. The caller can call IWbemCallResult::GetResultObject to retrieve the object when it becomes available.

Return Values

WBEM_E_ACCESS_DENIED The current user does not have permission to access the object.
WBEM_E_FAILED Other unspecified errors.
WBEM_E_INVALID_PARAMETER An invalid parameter was specified, or the namespace could not be parsed.
WBEM_E_INVALID_PATH The specified path was invalid.
WBEM_E_NOT_FOUND The requested object could not be found.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_E_RPC_FAILURE The RPC link between the client and CIMOM has failed.
WBEM_NO_ERROR The call succeeded.

On failure, you can obtain any available information from the COM function GetErrorInfo.

See Also

Class Creation, Error Objects, IWbemCallResult, IWbemServices::GetObjectAsync, Object Paths