예제 #1
0
        internal void CreateInstance(
            MI_OperationFlags flags,
            MI_OperationOptions options,
            string namespaceName,
            MI_Instance inboundInstance,
            MI_OperationCallbacks callbacks,
            out MI_Operation operation
            )
        {
            if (callbacks != null)
            {
                throw new NotImplementedException();
            }

            MI_Operation operationLocal = MI_Operation.NewDirectPtr();

            this.ft.CreateInstance(this,
                                   flags,
                                   options,
                                   namespaceName,
                                   inboundInstance,
                                   null,
                                   operationLocal);

            operation = operationLocal;
        }
예제 #2
0
        internal MI_Result NewSession(
            string protocol,
            string destination,
            MI_DestinationOptions options,
            MI_SessionCreationCallbacks callbacks,
            out MI_Instance extendedError,
            out MI_Session session
            )
        {
            if (callbacks != null)
            {
                throw new NotImplementedException();
            }

            MI_Instance extendedErrorLocal = MI_Instance.NewIndirectPtr();
            MI_Session  sessionLocal       = MI_Session.NewDirectPtr();

            MI_Result resultLocal = this.ft.NewSession(this,
                                                       protocol,
                                                       destination,
                                                       options,
                                                       null,
                                                       extendedErrorLocal,
                                                       sessionLocal);

            extendedError = extendedErrorLocal;
            session       = sessionLocal;
            return(resultLocal);
        }
예제 #3
0
        internal void ReferenceInstances(
            MI_OperationFlags flags,
            MI_OperationOptions options,
            string namespaceName,
            MI_Instance instanceKeys,
            string resultClass,
            string role,
            bool keysOnly,
            MI_OperationCallbacks callbacks,
            out MI_Operation operation
            )
        {
            if (callbacks != null)
            {
                throw new NotImplementedException();
            }

            MI_Operation operationLocal = MI_Operation.NewDirectPtr();

            this.ft.ReferenceInstances(this,
                                       flags,
                                       options,
                                       namespaceName,
                                       instanceKeys,
                                       resultClass,
                                       role,
                                       keysOnly,
                                       null,
                                       operationLocal);

            operation = operationLocal;
        }
예제 #4
0
        internal MI_Result SerializeInstance(
            MI_SerializerFlags flags,
            MI_Instance instanceObject,
            out byte[] clientBuffer
            )
        {
            clientBuffer = null;
            UInt32    spaceNeeded = 0;
            MI_Result resultLocal = this.ft.SerializeInstance(this,
                                                              flags,
                                                              instanceObject,
                                                              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.SerializeInstance(this,
                                                        flags,
                                                        instanceObject,
                                                        clientBufferLocal,
                                                        spaceNeeded,
                                                        out spaceUsed);
                if (clientBufferLocal != IntPtr.Zero)
                {
                    clientBuffer = new byte[spaceNeeded];
                    Marshal.Copy(clientBufferLocal, clientBuffer, 0, (int)spaceNeeded);
                    Marshal.FreeHGlobal(clientBufferLocal);
                }
            }

            return(resultLocal);
        }
예제 #5
0
        internal MI_Result GetIndication(
            out MI_Instance instance,
            out string bookmark,
            out string machineID,
            out bool moreResults,
            out MI_Result result,
            out string errorMessage,
            out MI_Instance completionDetails
            )
        {
            MI_Instance instanceLocal          = MI_Instance.NewIndirectPtr();
            MI_String   bookmarkLocal          = MI_String.NewIndirectPtr();
            MI_String   machineIDLocal         = MI_String.NewIndirectPtr();
            MI_String   errorMessageLocal      = MI_String.NewIndirectPtr();
            MI_Instance completionDetailsLocal = MI_Instance.NewIndirectPtr();

            MI_Result resultLocal = this.ft.GetIndication(this,
                                                          instanceLocal,
                                                          bookmarkLocal,
                                                          machineIDLocal,
                                                          out moreResults,
                                                          out result,
                                                          errorMessageLocal,
                                                          completionDetailsLocal);

            instance          = instanceLocal;
            bookmark          = bookmarkLocal.Value;
            machineID         = machineIDLocal.Value;
            errorMessage      = errorMessageLocal.Value;
            completionDetails = completionDetailsLocal;
            return(resultLocal);
        }
예제 #6
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);
        }
예제 #7
0
        internal static MI_Result Initialize(string applicationId, out MI_Instance extendedError, out MI_Application application)
        {
            MI_Application applicationLocal   = MI_Application.NewDirectPtr();
            MI_Instance    extendedErrorLocal = MI_Instance.NewIndirectPtr();

            MI_Result result = NativeMethods.MI_Application_InitializeV1(0, applicationId, extendedErrorLocal, applicationLocal);

            extendedError = extendedErrorLocal;
            application   = applicationLocal;
            return(result);
        }
예제 #8
0
        internal MI_Result Clone(
            out MI_Instance newInstance
            )
        {
            MI_Instance newInstanceLocal = MI_Instance.NewIndirectPtr();

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

            newInstance = newInstanceLocal;
            return(resultLocal);
        }
예제 #9
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);
        }
예제 #10
0
        internal MI_Result NewInstance(
            string className,
            MI_ClassDecl classRTTI,
            out MI_Instance instance
            )
        {
            MI_Instance instanceLocal = MI_Instance.NewIndirectPtr();

            MI_Result resultLocal = this.ft.NewInstance(this,
                                                        className,
                                                        classRTTI,
                                                        instanceLocal);

            instance = instanceLocal;
            return(resultLocal);
        }
예제 #11
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);
        }
예제 #12
0
        internal MI_Result SerializeInstance(
            MI_SerializerFlags flags,
            MI_Instance instanceObject,
            IntPtr clientBuffer,
            UInt32 clientBufferLength,
            out UInt32 clientBufferNeeded
            )
        {
            MI_Result resultLocal = this.ft.SerializeInstance(this,
                                                              flags,
                                                              instanceObject,
                                                              clientBuffer,
                                                              clientBufferLength,
                                                              out clientBufferNeeded);

            return(resultLocal);
        }
예제 #13
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);
            }
        }
예제 #14
0
        internal MI_Result NewHostedProvider(
            string namespaceName,
            string providerName,
            IntPtr mi_Main,
            out MI_Instance extendedError,
            IntPtr provider
            )
        {
            MI_Instance extendedErrorLocal = MI_Instance.NewIndirectPtr();

            MI_Result resultLocal = this.ft.NewHostedProvider(this,
                                                              namespaceName,
                                                              providerName,
                                                              mi_Main,
                                                              extendedErrorLocal,
                                                              provider);

            extendedError = extendedErrorLocal;
            return(resultLocal);
        }
예제 #15
0
        internal MI_Result Instance_GetClassName(
            IntPtr serializedBuffer,
            UInt32 serializedBufferLength,
            string className,
            out UInt32 classNameLength,
            out MI_Instance cimErrorDetails
            )
        {
            MI_Instance cimErrorDetailsLocal = MI_Instance.NewIndirectPtr();

            MI_Result resultLocal = this.commonFT.Instance_GetClassName(this,
                                                                        serializedBuffer,
                                                                        serializedBufferLength,
                                                                        className,
                                                                        out classNameLength,
                                                                        cimErrorDetailsLocal);

            cimErrorDetails = cimErrorDetailsLocal;
            return(resultLocal);
        }
예제 #16
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);
            }
        }
예제 #17
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);
        }
예제 #18
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);
            }
        }
예제 #19
0
        internal MI_Result GetInstance(
            out MI_Instance instance,
            out bool moreResults,
            out MI_Result result,
            out string errorMessage,
            out MI_Instance completionDetails
            )
        {
            MI_Instance instanceLocal          = MI_Instance.NewIndirectPtr();
            MI_String   errorMessageLocal      = MI_String.NewIndirectPtr();
            MI_Instance completionDetailsLocal = MI_Instance.NewIndirectPtr();

            MI_Result resultLocal = this.ft.GetInstance(this,
                                                        instanceLocal,
                                                        out moreResults,
                                                        out result,
                                                        errorMessageLocal,
                                                        completionDetailsLocal);

            instance          = instanceLocal;
            errorMessage      = errorMessageLocal.Value;
            completionDetails = completionDetailsLocal;
            return(resultLocal);
        }