Expand Minimize

MI_Application_NewHostedProvider function

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

Syntax


 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_opt_  MI_Instance **extendedError,
  _Out_      MI_HostedProvider *hostedProvider
);

Parameters

application [in]

A pointer to the handle returned from the MI_Application_Initialize function.

namespaceName [in]

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

providerName [in]

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

mi_Main [in]

Main entry point to an MI provider.

extendedError [out, optional]

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.

hostedProvider [out]

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

Return codeDescription
MI_RESULT_OK

The operation succeeded.

MI_RESULT_SERVER_LIMITS_EXCEEDED

There is not enough memory to complete the request.

MI_RESULT_INVALID_PARAMETER

One or more parameters passed to the function were not valid.

MI_RESULT_FAILED

A failure not covered by other MI_Result error codes.

 

Remarks

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.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Redistributable

Windows Management Framework 3.0 on Windows Server 2008 R2 with SP1, Windows 7 with SP1, and Windows Server 2008 with SP2

Header

Mi.h

 

 

Show:
© 2014 Microsoft