Interface IWbemProviderInit¦@¦
<span style=color:#FF0000>[This is preliminary documentation and subject to change.]</span>
The IWbemProviderInit interface is called by CIMOM to initialize providers. All providers are required to implement IWbemProviderInit.
Methods in Vtable Order
IUnknown Methods | Description |
QueryInterface_hmm_IWbemProviderInit_QueryInterface | Determines if the current object supports a given interface. |
Addref_hmm_IWbemProviderInit_Addref | Increases the object's reference count by 1. |
Release_hmm_IWbemProviderInit_Release | Decrements the object's reference count by 1, and frees the object when the reference count is zero. |
IWbemProviderInit Methods | Description |
Initialize_hmm_IWbemProviderInit_Initialize | Called by CIMOM to initialize a provider. |
^# $ K + IWbemProviderInit::QueryInterface¦@¦
<span style=color:#FF0000>[This is preliminary documentation and subject to change.]</span>
The IWbemProviderInit::QueryInterface method determines if the object supports a particular COM interface. If it does, the system increases the object's reference count, and the application can use that interface immediately.
HRESULT IWbemProviderInit::QueryInterface(
[in] REFIID riid,
[out] LPVOID *ppv
);
Parameters
riid
The COM interface identifier of the requested interface.
obp
Address of a pointer that will be filled with the interface pointer if the query succeeds.
Return Values
Returns standard COM error codes for QueryInterface. It returns WBEM_S_NO_ERROR if the call succeeds. If the call fails because the requested interface was not supported, the method returns E_NOINTERFACE.
Remarks
When the application no longer needs the interface retrieved by a call to this method, it must call the Release method for that interface to free it. The QueryInterface method allows the extension of objects without interfering with each object's existing or future functionality.
This method is part of the IUnknown interface inherited by the object. For more information about this method, see the COM documentation in the Microsoft Platform SDK.
See Also
IUnknown Interface Basics_hmm_IUnknown_Interface_Basics
^# $ K + IWbemProviderInit::AddRef¦@¦
<span style=color:#FF0000>[This is preliminary documentation and subject to change.]</span>
The IWbemProviderInit::AddRef method increases the object's reference count by 1.
ULONG AddRef( );
Parameters
None.
Return Values
Returns the new reference count.
Remarks
When the object is created, its reference count is set to 1. Every time an application obtains an interface to the object or calls the AddRef method, the object's reference count is increased by 1. Use the Release_hmm_IWbemProviderInit_Release method to decrease the object's reference count by 1.
This method is part of the IUnknown interface inherited by the object. For a complete discussion of IUnknown methods, see IUnknown Programming Basics.
For more information about this method, see the COM documentation in the Microsoft Platform SDK.
See Also
IUnknown Interface Basics_hmm_IUnknown_Interface_Basics
^# $ K + IWbemProviderInit::Release¦@¦
<span style=color:#FF0000>[This is preliminary documentation and subject to change.]</span>
The IWbemProviderInit::Release method decreases the object's reference count by 1.
ULONG IWbemProviderInit::Release( );
Parameters
None.
Return Values
Returns the new reference count.
Remarks
The object deallocates itself when its reference count reaches zero. Use the AddRef_hmm_IWbemProviderInit_AddRef method to increase the object's reference count by 1.
This method is part of the IUnknown interface inherited by the object. For more information about this method, see the COM documentation in the Microsoft Platform SDK.
See Also
IUnknown Interface Basics_hmm_IUnknown_Interface_Basics
^# $ K + IWbemProviderInit::Initialize¦@¦
<span style=color:#FF0000>[This is preliminary documentation and subject to change.]</span>
The IWbemProviderInit::Initialize method is called by CIMOM to initialize a provider and deem it ready to receive client requests. All types of providers must implement this method.
HRESULT IWbemProviderInit::Initialize(
[in] LPWSTR pszUser,
[in] LONG lFlags,
[in] LPWSTR pszNamespace,
[in] LPWSTR pszLocale,
[in] IWbemServices *pNamespace,
[in] IWbemContext *pCtx,
[in] IWbemProviderInitSink *pInitSink
);
Parameters
pszUser
Pointer to the user name, if per-user initialization was requested in the __Win32Provider_hmm___Win32Provider registration instance for this provider. Otherwise, this will be NULL.
lFlags
Reserved. It must be zero.
pszNamespace
The namespace name for which the provider is being initialized.
pszLocale
The locale name for which the provider is being initialized. This is typically a string of the following format, where the hex value is a Microsoft standard LCID value:
"MS\\0x409"
pNamespace
An IWbemServices_hmm_IWbemServices pointer back into CIMOM. This pointer is capable of servicing any requests made by the provider. The provider should use the AddRef_hmm_IWbemProviderInit_AddRef method on this pointer if it is going to need to call back into CIMOM during its execution.
pCtx
An IWbemContext_hmm_IWbemContext pointer associated with initialization. If the provider needs to make requests back into CIMOM before completing initialization, it should use the AddRef_hmm_IWbemProviderInit_Addref method on this pointer. This pointer must be passed by the provider in all future IWbemServices calls that it makes to CIMOM. For more information, see Making Calls to CIMOM_hmm_Making_Calls_to_CIMOM.
pInitSink
An IWbemProviderInitSink_hmm_IWbemProviderInitSink pointer that is used by the provider to report initialization status.
Return Values
The provider should return WBEM_S_NO_ERROR and indicate its status using the supplied object sink in the pInitSink parameter. However, if a provider returns WBEM_E_FAILED and does not use the sink, then the provider initialization will be considered as failed.
Remarks
Typically, the provider will implement a COM object using multiple inheritance in order to support both the IWbemProviderInit interface as well as its primary interface, such as IWbemServices_hmm_IWbemServices or IWbemEventProvider_hmm_IWbemEventProvider.
Initialization status is reported by calling IWbemProviderInitSink::SetStatus_hmm_IWbemProviderInitSink_SetStatus. This method can be called repeatedly to report incremental status if necessary. The provider must increment the reference count on this pointer by calling its AddRef_hmm_IWbemProviderInit_Addref method before using it to communicate status to CIMOM.
The provider may use the IWbemProviderInitSink_hmm_IWbemProviderInitSink pointer synchronously as in the following example:
HRESULT SampleProvider::Initialize(
/* [unique][in] */ LPWSTR wszUser,
/* [in] */ LONG lFlags,
/* [in] */ LPWSTR wszNamespace,
/* [unique][in] */ LPWSTR wszLocale,
/* [in] */ IWbemServices __RPC_FAR *pNamespace,
/* [in] */ IWbemContext __RPC_FAR *pCtx,
/* [in] */ IWbemProviderInitSink __RPC_FAR *pInitSink
)
{
// AddRef the pNamespace pointer, if required
// Analyze other parameters
// Tell CIMOM that we are initialized
pInitSink->SetStatus(0, WBEM_S_INITIALIZED);
return WBEM_S_NO_ERROR;
}
The provider may also use the AddRef method on the pointer and create a separate thread to complete its initialization and immediately return from the call.
See Also
Initializing a Provider_hmm_Initializing_a_Provider