MI_Application_NewHostedProvider function (mi.h)

Registers a hosted provider with the WMI engine on the local machine.


MI_INLINE MI_Result MI_Application_NewHostedProvider(
  [in]            MI_Application    *application,
  [in]            const MI_Char     *namespaceName,
  [in]            const MI_Char     *providerName,
  [in]            MI_MainFunction   mi_Main,
  [out, optional] MI_Instance       **extendedError,
  [out]           MI_HostedProvider *hostedProvider


[in] application

A pointer to the handle returned from the MI_Application_Initialize function.

[in] namespaceName

A pointer to the namespace where the provider is registered. For example, L"root/cimv2".

[in] providerName

A pointer to the provider name that is registered with the WMI engine for this hosted provider.

[in] mi_Main

Main entry point to an MI provider.

[out, optional] extendedError

A pointer to a pointer to an optional parameter to receive extended error information in the event the API fails. If a pointer is passed in, then an error instance may be returned. If an error instance is returned, then, when you have finished using it, delete it by using the MI_Instance_Delete function.

[out] hostedProvider

A pointer to a returned hosted provider handle. When you have finished using the handle, close it by calling the MI_HostedProvider_Close function during shutdown or when the provider no longer needs to receive operation requests.

Return value

This function returns MI_INLINE MI_Result.


A hosted provider is one that resides in a client application rather than in the WMI service's host process. The client controls the lifetime of these providers. Hosted providers are registered differently than regular providers. This different registration indicates that the WMI service be hosted by the client. When you have finished using the provider, the application should shut it down by calling the MI_HostedProvider_Close function.


Minimum supported client Windows 8
Minimum supported server Windows Server 2012
Target Platform Windows
Header mi.h
Redistributable Windows Management Framework 3.0 on Windows Server 2008 R2 with SP1, Windows 7 with SP1, and Windows Server 2008 with SP2