#pragma warning restore CS0169

        internal MI_DeserializerCallbacksNative GetNativeCallbacks(string format)
        {
            MI_DeserializerCallbacksNative callbacksNative = new MI_DeserializerCallbacksNative();

            callbacksNative.classObjectNeeded = MI_DeserializerCallbacks.GetNativeClassObjectNeededCallback(format, this.classObjectNeeded);

            return(callbacksNative);
        }
Example #2
0
        internal MI_Result DeserializeClassArray(
            MI_SerializerFlags flags,
            MI_OperationOptions options,
            MI_DeserializerCallbacks deserializerCallbacks,
            IntPtr serializedBuffer,
            UInt32 serializedBufferLength,
            MI_Class[] classDefinitions,
            string serverName,
            string namespaceName,
            out UInt32 serializedBufferRead,
            out MI_ExtendedArray classes,
            out MI_Instance cimErrorDetails)
        {
            if (!MI_SerializationFormat.MOF.Equals(this.format, StringComparison.OrdinalIgnoreCase))
            {
                throw new NotImplementedException();
            }

            MI_Class.ArrayPtr classPtrs            = MI_Class.GetPointerArray(classDefinitions);
            MI_Instance       cimErrorDetailsLocal = MI_Instance.NewIndirectPtr();
            MI_ExtendedArray  classesLocal         = MI_ExtendedArray.NewIndirectPtr();
            MI_ExtendedArray  classDetailsArray    = MI_ExtendedArray.NewDirectPtr(classPtrs.Ptrs);

            MI_DeserializerCallbacks.MI_DeserializerCallbacksNative nativeCallbacks = deserializerCallbacks.GetNativeCallbacks(this.format);

            classes = null;

            var resLocal = this.ft.DeserializeClassArray_MOF(
                this,
                flags,
                options,
                nativeCallbacks,
                serializedBuffer,
                serializedBufferLength,
                classDetailsArray,
                serverName,
                namespaceName,
                out serializedBufferRead,
                classesLocal,
                cimErrorDetailsLocal);

            cimErrorDetails = cimErrorDetailsLocal;
            classes         = classesLocal;

            return(resLocal);
        }
Example #3
0
        internal MI_Result DeserializeClassArray(
            MI_SerializerFlags flags,
            MI_OperationOptions options,
            MI_DeserializerCallbacks deserializerCallbacks,
            byte[] serializedBuffer,
            MI_Class[] classDefinitions,
            string serverName,
            string namespaceName,
            out UInt32 serializedBufferRead,
            out MI_ExtendedArray classes,
            out MI_Instance cimErrorDetails)
        {
            if (!MI_SerializationFormat.MOF.Equals(this.format, StringComparison.OrdinalIgnoreCase))
            {
                throw new NotImplementedException();
            }

            if (serializedBuffer == null || serializedBuffer.Length == 0)
            {
                throw new InvalidOperationException();
            }

            IntPtr clientBuffer = Marshal.AllocHGlobal(serializedBuffer.Length);

            try
            {
                Marshal.Copy(serializedBuffer, 0, clientBuffer, serializedBuffer.Length);
                return(this.DeserializeClassArray(
                           flags,
                           options,
                           deserializerCallbacks,
                           clientBuffer,
                           (uint)serializedBuffer.Length,
                           classDefinitions,
                           serverName,
                           namespaceName,
                           out serializedBufferRead,
                           out classes,
                           out cimErrorDetails));
            }
            finally
            {
                Marshal.FreeHGlobal(clientBuffer);
            }
        }
Example #4
0
        internal MI_Result DeserializeInstance(
            MI_SerializerFlags flags,
            byte[] serializedBuffer,
            MI_Class[] classObjects,
            MI_Deserializer_ClassObjectNeeded classObjectNeeded,
            out UInt32 serializedBufferRead,
            out MI_Instance instanceObject,
            out MI_Instance cimErrorDetails
            )
        {
            if (serializedBuffer == null || serializedBuffer.Length == 0)
            {
                throw new InvalidOperationException();
            }

            MI_Deserializer_ClassObjectNeededNative nativeCallback = MI_DeserializerCallbacks.GetNativeClassObjectNeededCallback(this.format, classObjectNeeded);

            IntPtr clientBuffer = Marshal.AllocHGlobal(serializedBuffer.Length);

            try
            {
                Marshal.Copy(serializedBuffer, 0, clientBuffer, serializedBuffer.Length);
                return(this.DeserializeInstance(flags,
                                                clientBuffer,
                                                (UInt32)(serializedBuffer.Length),
                                                classObjects,
                                                nativeCallback,
                                                IntPtr.Zero,
                                                out serializedBufferRead,
                                                out instanceObject,
                                                out cimErrorDetails));
            }
            finally
            {
                Marshal.FreeHGlobal(clientBuffer);
            }
        }