IWbemHiPerfProvider::CreateRefresher method

The IWbemHiPerfProvider::CreateRefresher method creates a refresher. The returned refresher will be used in subsequent calls to IWbemHiPerfProvider::CreateRefreshableEnum, IWbemHiPerfProvider::CreateRefreshableObject, and IWbemHiPerfProvider::StopRefreshing.

Note  If a provider does not implement this method, it must return WBEM_E_PROVIDER_NOT_CAPABLE. A provider must implement this method to support refresher operations.

Syntax


HRESULT CreateRefresher(
  [in]   IWbemServices *pNamespace,
  [in]   long lFlags,
  [out]  IWbemRefresher **ppRefresher
);

Parameters

pNamespace [in]

An IWbemServices pointer back into Windows Management, which can service any request made by the provider. The provider should call AddRef on this pointer if it is going to call back into Windows Management during its execution.

lFlags [in]

Reserved. This parameter must be 0 (zero).

ppRefresher [out]

Pointer to hold the reference to the provider's implementation of the IWbemRefresher interface.

Return value

This method returns an HRESULT indicating the status of the method call. The following table lists the value contained within an HRESULT.

Return codeDescription
WBEM_S_NO_ERROR

The method was successful.

WBEM_E_PROVIDER_NOT_CAPABLE

The provider cannot retrieve specific instances regardless of whether it recognizes the paths.

Return this error code in all cases unless you need a specific return code.

WBEM_E_FAILED

The provider failed internally, even though the operation was valid.

WBEM_E_REFRESHER_BUSY

The refresher is busy.

 

Remarks

The provider must supply its own implementation of the IWbemRefresher interface. It is valid for WMI to request multiple refreshers, each of which will be used for its own refresh operations.

When you release a refresher, the provider should clean up any refreshable objects or enumerators that were added to the refresher.

Examples

The following code example describes how to implement CreateRefresher.


HRESULT CHiPerfProvider::CreateRefresher(
  /* [in] */IWbemServices *pNamespace,
  /* [in] */ long lFlags,
  /* [out] */ IWbemRefresher** ppRefresher
)
{
    // Allocate a new refresher
    //For Example:
    // CMyRefresher* pMyRefresher = new CMyRefresher();

    // Return the refresher to the ppRefresher
    // [out] parameter
    /*return pMyRefresher->QueryInterface(
     IID_IWbemRefresher, (void**) ppRefresher );*/
}

// Free memory resources.
// For Example:
//pNamespace->Release();
//ppRefresher->Release();
//delete[] pMyRefresher;

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

Wbemprov.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

Wmiprvsd.dll

See also

IWbemHiPerfProvider
Developing a WMI Provider
Writing an Instance Provider
Making an Instance Provider into a High-Performance Provider
Performance Counter Provider

 

 

Show:
© 2014 Microsoft