Skip to main content
MI_Application_InitializeV1 function

Initializes an application so that it can make Management Infrastructure (MI) client API calls.

Syntax


MI_Result MI_Application_InitializeV1(
  MI_Uint32 flags,
  _In_opt_  const MI_Char *applicationID,
  _Outptr_opt_result_maybenull_ MI_Instance **extendedError,
  _Out_     MI_Application *application
);

Parameters

flags

Must be 0.

applicationID [in, optional]

An optional string (usually GUID in string format) to represent a client application. This string may be used for application specific configuration and application specific logging.

extendedError

Optional parameter giving more error information if the operation failed. If an instance is returned, MI_Instance_Delete must be called to free it when it is no longer needed.

application [out]

A pointer to an uninitialized MI_Application handle is passed in and a populated handle is returned. The initialized handle must be passed to MI_Application_Close before the application shuts down. If an application passes this handle, pass it by value rather than as a pointer.

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

This API needs to be called only once per application; although, it can be called multiple times safely. Calling this API multiple times will result in a small amount of extra memory usage. When called, the application passes in an MI_Application pointer to be initialized. This pointer must be closed by calling MI_Application_Close. Not doing so will cause memory leaks and potential crashes during shutdown.

MI.h defines MI_Application_Initialize as MI_Application_InitializeV1 with this line:

#define MI_Application_Initialize MI_Application_InitializeV1

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

Library

Mi.lib

DLL

Mi.dll