Ejemplo n.º 1
0
        internal MI_Result SerializeClass(
            MI_SerializerFlags flags,
            MI_Class classObject,
            out byte[] clientBuffer
            )
        {
            clientBuffer = null;
            UInt32    spaceNeeded = 0;
            MI_Result resultLocal = this.ft.SerializeClass(this,
                                                           flags,
                                                           classObject,
                                                           IntPtr.Zero,
                                                           0,
                                                           out spaceNeeded);

            if (resultLocal == MI_Result.MI_RESULT_OK || (resultLocal == MI_Result.MI_RESULT_FAILED && spaceNeeded != 0))
            {
                UInt32 spaceUsed;
                IntPtr clientBufferLocal = Marshal.AllocHGlobal((IntPtr)spaceNeeded);
                resultLocal = this.ft.SerializeClass(this,
                                                     flags,
                                                     classObject,
                                                     clientBufferLocal,
                                                     spaceNeeded,
                                                     out spaceUsed);
                if (clientBufferLocal != IntPtr.Zero)
                {
                    clientBuffer = new byte[spaceNeeded];
                    Marshal.Copy(clientBufferLocal, clientBuffer, 0, (int)spaceNeeded);
                    Marshal.FreeHGlobal(clientBufferLocal);
                }
            }

            return(resultLocal);
        }
Ejemplo n.º 2
0
        internal MI_Result DeserializeClass(
            MI_SerializerFlags flags,
            IntPtr serializedBuffer,
            UInt32 serializedBufferLength,
            MI_Class parentClass,
            string serverName,
            string namespaceName,
            IntPtr classObjectNeeded,
            IntPtr classObjectNeededContext,
            out UInt32 serializedBufferRead,
            out MI_Class classObject,
            out MI_Instance cimErrorDetails
            )
        {
            MI_Class    classObjectLocal     = MI_Class.NewIndirectPtr();
            MI_Instance cimErrorDetailsLocal = MI_Instance.NewIndirectPtr();

            MI_Result resultLocal = this.commonFT.DeserializeClass(this,
                                                                   flags,
                                                                   serializedBuffer,
                                                                   serializedBufferLength,
                                                                   parentClass,
                                                                   serverName,
                                                                   namespaceName,
                                                                   classObjectNeeded,
                                                                   classObjectNeededContext,
                                                                   out serializedBufferRead,
                                                                   classObjectLocal,
                                                                   cimErrorDetailsLocal);

            classObject     = classObjectLocal;
            cimErrorDetails = cimErrorDetailsLocal;
            return(resultLocal);
        }
Ejemplo n.º 3
0
        internal MI_Result GetClass(
            out MI_Class instanceClass
            )
        {
            MI_Class instanceClassLocal = MI_Class.NewIndirectPtr();

            MI_Result resultLocal = this.ft.GetClass(this,
                                                     instanceClassLocal);

            instanceClass = instanceClassLocal;
            return(resultLocal);
        }
Ejemplo n.º 4
0
        internal MI_Result Clone(
            out MI_Class newClass
            )
        {
            MI_Class newClassLocal = MI_Class.NewIndirectPtr();

            MI_Result resultLocal = this.ft.Clone(this,
                                                  newClassLocal);

            newClass = newClassLocal;
            return(resultLocal);
        }
Ejemplo n.º 5
0
        internal MI_Result GetParentClass(
            out MI_Class parentClass
            )
        {
            MI_Class parentClassLocal = MI_Class.NewIndirectPtr();

            MI_Result resultLocal = this.ft.GetParentClass(this,
                                                           parentClassLocal);

            parentClass = parentClassLocal;
            return(resultLocal);
        }
Ejemplo n.º 6
0
        internal MI_Result NewInstanceFromClass(
            string className,
            MI_Class classObject,
            out MI_Instance instance
            )
        {
            MI_Instance instanceLocal = MI_Instance.NewIndirectPtr();

            MI_Result resultLocal = this.ft.NewInstanceFromClass(this,
                                                                 className,
                                                                 classObject,
                                                                 instanceLocal);

            instance = instanceLocal;
            return(resultLocal);
        }
Ejemplo n.º 7
0
        internal MI_Result SerializeClass(
            MI_SerializerFlags flags,
            MI_Class classObject,
            IntPtr clientBuffer,
            UInt32 clientBufferLength,
            out UInt32 clientBufferNeeded
            )
        {
            MI_Result resultLocal = this.ft.SerializeClass(this,
                                                           flags,
                                                           classObject,
                                                           clientBuffer,
                                                           clientBufferLength,
                                                           out clientBufferNeeded);

            return(resultLocal);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        internal MI_Result NewClass(
            MI_ClassDecl classDecl,
            string namespaceName,
            string serverName,
            out MI_Class classObject
            )
        {
            MI_Class classObjectLocal = MI_Class.NewIndirectPtr();

            MI_Result resultLocal = this.ft.NewClass(this,
                                                     classDecl,
                                                     namespaceName,
                                                     serverName,
                                                     classObjectLocal);

            classObject = classObjectLocal;
            return(resultLocal);
        }
Ejemplo n.º 10
0
        internal MI_Result DeserializeClass(
            MI_SerializerFlags flags,
            byte[] serializedBuffer,
            MI_Class parentClass,
            string serverName,
            string namespaceName,
            IntPtr classObjectNeeded,
            IntPtr classObjectNeededContext,
            out UInt32 serializedBufferRead,
            out MI_Class classObject,
            out MI_Instance cimErrorDetails
            )
        {
            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.DeserializeClass(flags,
                                             clientBuffer,
                                             (uint)serializedBuffer.Length,
                                             parentClass,
                                             serverName,
                                             namespaceName,
                                             classObjectNeeded,
                                             classObjectNeededContext,
                                             out serializedBufferRead,
                                             out classObject,
                                             out cimErrorDetails));
            }
            finally
            {
                Marshal.FreeHGlobal(clientBuffer);
            }
        }
Ejemplo n.º 11
0
        private MI_Result DeserializeInstance(
            MI_SerializerFlags flags,
            IntPtr serializedBuffer,
            UInt32 serializedBufferLength,
            MI_Class[] classObjects,
            MI_Deserializer_ClassObjectNeededNative classObjectNeeded,
            IntPtr classObjectNeededContext,
            out UInt32 serializedBufferRead,
            out MI_Instance instanceObject,
            out MI_Instance cimErrorDetails
            )
        {
            if (classObjectNeededContext != IntPtr.Zero)
            {
                throw new NotImplementedException();
            }

            MI_Instance instanceObjectLocal  = MI_Instance.NewIndirectPtr();
            MI_Instance cimErrorDetailsLocal = MI_Instance.NewIndirectPtr();

            MI_Class.ArrayPtr classArrayPtr = MI_Class.GetPointerArray(classObjects);

            MI_Result resultLocal = this.commonFT.DeserializeInstance(this,
                                                                      flags,
                                                                      serializedBuffer,
                                                                      serializedBufferLength,
                                                                      classArrayPtr.Ptrs,
                                                                      (uint)classObjects.Length,
                                                                      classObjectNeeded,
                                                                      IntPtr.Zero,
                                                                      out serializedBufferRead,
                                                                      instanceObjectLocal,
                                                                      cimErrorDetailsLocal);

            instanceObject  = instanceObjectLocal;
            cimErrorDetails = cimErrorDetailsLocal;
            return(resultLocal);
        }
Ejemplo n.º 12
0
        internal MI_Result GetClass(
            out MI_Class classResult,
            out bool moreResults,
            out MI_Result result,
            out string errorMessage,
            out MI_Instance completionDetails
            )
        {
            MI_Class    classResultLocal       = MI_Class.NewIndirectPtr();
            MI_String   errorMessageLocal      = MI_String.NewIndirectPtr();
            MI_Instance completionDetailsLocal = MI_Instance.NewIndirectPtr();

            MI_Result resultLocal = this.ft.GetClass(this,
                                                     classResultLocal,
                                                     out moreResults,
                                                     out result,
                                                     errorMessageLocal,
                                                     completionDetailsLocal);

            classResult       = classResultLocal;
            errorMessage      = errorMessageLocal.Value;
            completionDetails = completionDetailsLocal;
            return(resultLocal);
        }