MI_Context_GetLocalSession function (mi.h)

Gets the local session (MI_Session) which allows the provider to perform CIM operations against the local server hosting the provider.

Syntax

MI_INLINE MI_Result MI_INLINE_CALL MI_Context_GetLocalSession(
  [in]  const MI_Context *context,
  [out] MI_Session       *session
);

Parameters

[in] context

A pointer to the request context.

[out] session

A pointer to the returned MI_Session object. This session must not be closed.

Return value

A value of the MI_Result enumeration that specifies the function return code. This can be one of the following codes.

Remarks

This session is pre-instantiated and has the lifetime of the context from which the session was obtained. The provider must not close this session because its lifetime is bound to the context.

The provider should call this function rather than creating a new session through the MI_Application_NewSession function, because some optimizations may be possible for talking to the CIM server.

The security context used to call the MI_Context_GetLocalSession function should be the same identity used communicate back to the server through the MI_Session_* operation functions. Do not cache these sessions outside the current operation. The provider calls this method multiple times within an operation under different identities, in which case the retrieved session should also be used with the same identity. Any operations on the session should always be the same identity that the user retrieved for the local session, or else the operation could fail with the MI_RESULT_ACCESS_DENIED return code.

Requirements

Requirement Value
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