Exemple #1
0
        internal static MI_ExtendedArray NewDirectPtr(IntPtr[] ptrs)
        {
            var res = new MI_ExtendedArray(true);

            res.WritePointerArray(ptrs);
            return(res);
        }
Exemple #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);
        }
Exemple #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);
            }
        }