MI_Serializer_SerializeInstance function (mi.h)

Serializes an MI_Instance into a buffer in the format specified when the serializer was created. Options can be passed into the flags to control if the class is also serialized into the buffer as well as the instance.

Syntax

MI_INLINE MI_Result MI_Serializer_SerializeInstance(
  [in, out] MI_Serializer     *serializer,
            MI_Uint32         flags,
  [in]      const MI_Instance *instanceObject,
            MI_Uint8          *clientBuffer,
            MI_Uint32         clientBufferLength,
  [in, out] MI_Uint32         *clientBufferNeeded
);

Parameters

[in, out] serializer

Serializer returned from MI_Application_NewSerializer.

flags

Must be either 0 or MI_SERIALIZER_FLAGS_INSTANCE_WITH_CLASS. 0 means to serialize the instance only. MI_SERIALIZER_FLAGS_INSTANCE_WITH_CLASS means to serialize the instance and all class parts into the buffer so that it is self contained.

[in] instanceObject

Instance object to be serialized.

clientBuffer

The output buffer to receive the serialized class data. If this parameter is Null, the required length of the buffer is passed back in clientBufferNeeded.

clientBufferLength

Length of the clientBuffer passed in. If clientBuffer is Null, this parameter should be 0.

[in, out] clientBufferNeeded

Returned total length the buffer needs to be. If a buffer is passed in (via the clientBuffer parameter) that is the required size or more, this value will indicate how much buffer was used. If a buffer was not passed in (where the clientBuffer value is Null) or the buffer is too small to hold the serialized class, this value will indicate how much space is needed to hold the serialized class.

Return value

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

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

See also

MI_Application_NewSerializer