Skip to main content
MI_Serializer_SerializeClass function

Serializes an MI_Class into a buffer in the format specified when the serializer was created. Options can be passed into the flags to control if the class and all its parent classes are serialized, or just the child-most class.


 MI_INLINE MI_Result MI_Serializer_SerializeClass(
  _Inout_       MI_Serializer                                   *serializer,
                MI_Uint32                                       flags,
  _In_    const MI_Class                                        *classObject,
                _Out_writes_bytes_(clientBufferLength) MI_Uint8 *clientBuffer,
                MI_Uint32                                       clientBufferLength,
  _Inout_       MI_Uint32                                       *clientBufferNeeded


serializer [in, out]

Serializer returned from MI_Application_NewSerializer.


Must be either 0 or MI_SERIALIZER_FLAGS_CLASS_DEEP. 0 means only the child most part of the class will be serialized. MI_SERIALIZER_FLAGS_CLASS_DEEP means all properties in the class will be serialized.

classObject [in]

Class object to be serialized.


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.


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

clientBufferNeeded [in, out]

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.


The operation succeeded.


There is not enough memory to complete the request.


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


A failure not covered by other MI_Result error codes.


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012


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



See also