Expand Minimize

MI_Context_GetLocalSession function

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_Context_GetLocalSession(
  _In_   const MI_Context *context,
  _Out_  MI_Session *session
);

Parameters

context [in]

A pointer to the request context.

session [out]

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.

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.

MI_RESULT_ACCESS_DENIED

Access to a CIM resource is not available to the client.

 

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

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