Esempio n. 1
0
		public CimAsyncStatus CloseAsync()
		{
			IObservable<object> cimAsyncDelegatedObservable = new CimAsyncDelegatedObservable<object>((IObserver<object> observer) => {
				bool flag;
				lock (this._disposeThreadSafetyLock)
				{
					flag = this._disposed;
					this._disposed = true;
				}
				if (!flag)
				{
					CimSession.CloseAsyncImpersonationWorker closeAsyncImpersonationWorker = new CimSession.CloseAsyncImpersonationWorker(observer);
					MiResult miResult = this._handle.ReleaseHandleAsynchronously(new SessionHandle.OnSessionHandleReleasedDelegate(closeAsyncImpersonationWorker.OnCompleted));
					CimException exceptionIfMiResultFailure = CimException.GetExceptionIfMiResultFailure(miResult, null, null);
					if (exceptionIfMiResultFailure != null)
					{
						observer.OnError(exceptionIfMiResultFailure);
						closeAsyncImpersonationWorker.Dispose();
					}
					return;
				}
				else
				{
					observer.OnCompleted();
					return;
				}
			}
			);
			return new CimAsyncStatus(cimAsyncDelegatedObservable);
		}
Esempio n. 2
0
        private static string GetExceptionMessage(MiResult errorCode, string errorMessage, InstanceHandle errorDetailsHandle)
        {
            string exceptionMessage = GetExceptionMessage(errorDetailsHandle);

            if (!string.IsNullOrEmpty(exceptionMessage))
            {
                return(exceptionMessage);
            }
            ApplicationMethods.GetCimErrorFromMiResult(errorCode, errorMessage, out errorDetailsHandle);
            try
            {
                exceptionMessage = GetExceptionMessage(errorDetailsHandle);
                if (!string.IsNullOrEmpty(exceptionMessage))
                {
                    return(exceptionMessage);
                }
            }
            finally
            {
                if (errorDetailsHandle != null)
                {
                    var disosable = errorDetailsHandle as IDisposable;
                    if (disosable != null)
                    {
                        disosable.Dispose();
                    }
                }
            }
            return(errorCode.ToString());
        }
Esempio n. 3
0
        public CimInstance(CimClass cimClass)
        {
            InstanceHandle instanceHandle = null;

            this._CimSessionInstanceID = Guid.Empty;
            if (cimClass != null)
            {
                MiResult miResult = ApplicationMethods.NewInstance(CimApplication.Handle, cimClass.CimSystemProperties.ClassName, cimClass.ClassHandle, out instanceHandle);
                if (miResult != MiResult.INVALID_PARAMETER)
                {
                    CimException.ThrowIfMiResultFailure(miResult);
                    this._myHandle = new SharedInstanceHandle(instanceHandle);
                    miResult       = InstanceMethods.SetNamespace(this._myHandle.Handle, cimClass.CimSystemProperties.Namespace);
                    CimException.ThrowIfMiResultFailure(miResult);
                    miResult = InstanceMethods.SetServerName(this._myHandle.Handle, cimClass.CimSystemProperties.ServerName);
                    CimException.ThrowIfMiResultFailure(miResult);
                    return;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("cimClass");
                }
            }
            else
            {
                throw new ArgumentNullException("cimClass");
            }
        }
 public override CimQualifier this[string qualifierName]
 {
     get
     {
         int num = 0;
         if (!string.IsNullOrWhiteSpace(qualifierName))
         {
             MiResult methodGetQualifierElementGetIndex = ClassMethods.GetMethodGetQualifierElement_GetIndex(this.classHandle, this.methodIndex, this.parameterName, qualifierName, out num);
             MiResult miResult = methodGetQualifierElementGetIndex;
             if (miResult != MiResult.NO_SUCH_PROPERTY)
             {
                 CimException.ThrowIfMiResultFailure(methodGetQualifierElementGetIndex);
                 return(new CimQualifierOfMethodParameter(this.classHandle, this.methodIndex, this.parameterName, num));
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             throw new ArgumentNullException("qualifierName");
         }
     }
 }
 public override CimQualifier this[string qualifierName]
 {
     get
     {
         int num = 0;
         if (!string.IsNullOrWhiteSpace(qualifierName))
         {
             MiResult classQualifierIndex = ClassMethods.GetClassQualifier_Index(this.classHandle, qualifierName, out num);
             MiResult miResult            = classQualifierIndex;
             if (miResult != MiResult.NOT_FOUND)
             {
                 CimException.ThrowIfMiResultFailure(classQualifierIndex);
                 return(new CimQualifierOfClass(this.classHandle, num));
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             throw new ArgumentNullException("qualifierName");
         }
     }
 }
 public override CimQualifier this[string qualifierName]
 {
     get
     {
         int num = 0;
         if (!string.IsNullOrWhiteSpace(qualifierName))
         {
             MiResult propertyQualifierIndex = ClassMethods.GetPropertyQualifier_Index(this.classHandle, this.name, qualifierName, out num);
             MiResult miResult = propertyQualifierIndex;
             if (miResult != MiResult.NO_SUCH_PROPERTY)
             {
                 CimException.ThrowIfMiResultFailure(propertyQualifierIndex);
                 return(new CimQualifierOfProperty(this.classHandle, this.name, num));
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             throw new ArgumentNullException("qualifierName");
         }
     }
 }
Esempio n. 7
0
 public override CimQualifier this[string methodName]
 {
     get
     {
         int num = 0;
         if (!string.IsNullOrWhiteSpace(methodName))
         {
             MiResult methodQualifierElementGetIndex = ClassMethods.GetMethodQualifierElement_GetIndex(this.classHandle, this.methodIndex, methodName, out num);
             MiResult miResult = methodQualifierElementGetIndex;
             if (miResult != MiResult.NOT_FOUND)
             {
                 CimException.ThrowIfMiResultFailure(methodQualifierElementGetIndex);
                 return(new CimMethodQualifierDeclarationOfMethod(this.classHandle, this.methodIndex, num));
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             throw new ArgumentNullException("methodName");
         }
     }
 }
Esempio n. 8
0
 public override CimPropertyDeclaration this[string propertyName]
 {
     get
     {
         int num = 0;
         if (!string.IsNullOrWhiteSpace(propertyName))
         {
             MiResult elementGetIndex = ClassMethods.GetElement_GetIndex(this.classHandle, propertyName, out num);
             MiResult miResult        = elementGetIndex;
             if (miResult != MiResult.NO_SUCH_PROPERTY)
             {
                 CimException.ThrowIfMiResultFailure(elementGetIndex);
                 return(new CimClassPropertyOfClass(this.classHandle, num));
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             throw new ArgumentNullException("propertyName");
         }
     }
 }
Esempio n. 9
0
        public CimInstance(string className, string namespaceName)
        {
            InstanceHandle instanceHandle = null;

            this._CimSessionInstanceID = Guid.Empty;
            if (className != null)
            {
                MiResult miResult  = ApplicationMethods.NewInstance(CimApplication.Handle, className, null, out instanceHandle);
                MiResult miResult1 = miResult;
                if (miResult1 != MiResult.INVALID_PARAMETER)
                {
                    CimException.ThrowIfMiResultFailure(miResult);
                    this._myHandle = new SharedInstanceHandle(instanceHandle);
                    if (namespaceName != null)
                    {
                        miResult = InstanceMethods.SetNamespace(this._myHandle.Handle, namespaceName);
                        CimException.ThrowIfMiResultFailure(miResult);
                    }
                    return;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("className");
                }
            }
            else
            {
                throw new ArgumentNullException("className");
            }
        }
Esempio n. 10
0
        public bool Serialize(CimInstance cimInstance, InstanceSerializationOptions options, byte[] buffer, ref int offset)
        {
            int num = 0;

            if (cimInstance != null)
            {
                if (buffer != null)
                {
                    if ((long)offset <= (long)((int)buffer.Length))
                    {
                        if ((long)offset == (long)((int)buffer.Length))
                        {
                            buffer = null;
                        }
                    }
                    else
                    {
                        throw new ArgumentOutOfRangeException("offset");
                    }
                }
                else
                {
                    if (offset != 0)
                    {
                        throw new ArgumentNullException("buffer");
                    }
                }
                this.AssertNotDisposed();
                bool     flag      = true;
                MiResult miResult  = MiResult.OK; //TODO: // SerializerMethods.SerializeInstance(this._myHandle, options, cimInstance.InstanceHandle, buffer, offset, out num);
                MiResult miResult1 = miResult;
                switch (miResult1)
                {
                case MiResult.OK:
                {
                    offset = offset + num;
                    flag   = true;
                    return(flag);
                }

                case MiResult.FAILED:
                {
                    if (buffer == null || (long)(offset + num) > (long)((int)buffer.Length))
                    {
                        miResult = MiResult.OK;
                        offset   = offset + num;
                    }
                    flag = false;
                    return(flag);
                }
                }
                CimException.ThrowIfMiResultFailure(miResult);
                return(flag);
            }
            else
            {
                throw new ArgumentNullException("cimInstance");
            }
        }
Esempio n. 11
0
        private void Initialize(CimSubscriptionDeliveryType types)
        {
            SubscriptionDeliveryOptionsHandle subscriptionDeliveryOptionsHandle = null;
            MiResult miResult = ApplicationMethods.NewSubscriptionDeliveryOptions(CimApplication.Handle, (MiSubscriptionDeliveryType)types, out subscriptionDeliveryOptionsHandle);

            CimException.ThrowIfMiResultFailure(miResult);
            this._subscriptionDeliveryOptionsHandle = subscriptionDeliveryOptionsHandle;
        }
Esempio n. 12
0
 internal static CimException GetExceptionIfMiResultFailure(MiResult result, string errorMessage, InstanceHandle errorData)
 {
     if (result != MiResult.OK)
     {
         return(new CimException(result, errorMessage, errorData));
     }
     return(null);
 }
Esempio n. 13
0
 internal CimException(MiResult errorCode, string errorMessage, InstanceHandle errorDetailsHandle, string exceptionMessage) : base(exceptionMessage ?? GetExceptionMessage(errorCode, errorMessage, errorDetailsHandle))
 {
     this.NativeErrorCode = errorCode.ToNativeErrorCode();
     if (errorDetailsHandle != null)
     {
         this._errorData = new CimInstance(errorDetailsHandle, null);
     }
 }
Esempio n. 14
0
        internal static void ThrowIfMiResultFailure(MiResult result, string errorMessage, InstanceHandle errorData)
        {
            CimException exception = GetExceptionIfMiResultFailure(result, errorMessage, errorData);

            if (exception != null)
            {
                throw exception;
            }
        }
 public override void Add(CimProperty newProperty)
 {
     if (newProperty != null)
     {
         MiResult miResult = InstanceMethods.AddElement(this._instanceHandle.Handle, newProperty.Name, CimInstance.ConvertToNativeLayer(newProperty.Value), newProperty.CimType.ToMiType(), newProperty.Flags.ToMiFlags());
         CimException.ThrowIfMiResultFailure(miResult);
         return;
     }
     else
     {
         throw new ArgumentNullException("newProperty");
     }
 }
Esempio n. 16
0
 public void SetString(string optionName, string optionValue, uint flags)
 {
     if (!string.IsNullOrWhiteSpace(optionName))
     {
         this.AssertNotDisposed();
         MiResult miResult = MiResult.OK;                 //TODO: SubscriptionDeliveryOptionsMethods.SetString(this._subscriptionDeliveryOptionsHandle, optionName, optionValue, flags);
         CimException.ThrowIfMiResultFailure(miResult);
         return;
     }
     else
     {
         throw new ArgumentNullException("optionName");
     }
 }
Esempio n. 17
0
		internal static unsafe MiResult GetClass(OperationHandle operationHandle, out ClassHandle classHandle, out bool moreResults, out MiResult result, out string errorMessage, out InstanceHandle completionDetails)
		{
			result = MiResult.OK;
			classHandle = null;
			completionDetails = null;
			errorMessage = "";
			moreResults = false;
			return MiResult.OK;
			/*
			int num;
			classHandle = null;
			moreResults = false;
			result = MiResult.OK;
			errorMessage = null;
			completionDetails = null;
			_MI_Class modopt(System.Runtime.CompilerServices.IsConst)* _MIClass modopt(System.Runtime.CompilerServices.IsConst)Pointer = (_MI_Class modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
			byte num1 = 0;
			_MI_Result _MIResult = 0;
			UInt16 modopt(System.Runtime.CompilerServices.IsConst)* uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer = (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
			_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)* _MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer = (_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
			_MI_Result modopt(System.Runtime.CompilerServices.CallConvCdecl) _MIResult modopt(System.Runtime.CompilerServices.CallConvCdecl) = (_MI_Result)<Module>.?A0xf5a90918.MI_Operation_GetClass((void*)operationHandle.DangerousGetHandle(), ref (_MI_Class modopt(System.Runtime.CompilerServices.IsConst)*)((long)0), ref num1, (_MI_Result*)(&_MIResult), ref (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0), ref (_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0));
			if ((_MI_Class modopt(System.Runtime.CompilerServices.IsConst)*)((long)0) != null)
			{
				IntPtr intPtr = (IntPtr)_MIClass modopt(System.Runtime.CompilerServices.IsConst)Pointer;
				classHandle = new ClassHandle(intPtr, false);
			}
			if (0 != num1)
			{
				num = 1;
			}
			else
			{
				num = 0;
			}
			int num2 = num;
			moreResults = num2;
			result = (MiResult)_MIResult;
			if (_MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer != null)
			{
				IntPtr intPtr1 = (IntPtr)_MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer;
				completionDetails = new InstanceHandle(intPtr1, false);
			}
			if (uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer != null)
			{
				IntPtr intPtr2 = (IntPtr)uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer;
				errorMessage = Marshal.PtrToStringUni(intPtr2);
			}
			return (MiResult)_MIResult modopt(System.Runtime.CompilerServices.CallConvCdecl);
			*/
		}
Esempio n. 18
0
 public override void AddDestinationCredentials(CimCredential credential)
 {
     if (credential != null)
     {
         base.AssertNotDisposed();
         MiResult miResult = DestinationOptionsMethods.AddDestinationCredentials(base.DestinationOptionsHandleOnDemand, credential.GetCredential());
         CimException.ThrowIfMiResultFailure(miResult);
         return;
     }
     else
     {
         throw new ArgumentNullException("credential");
     }
 }
Esempio n. 19
0
		public static CimSession Create(string computerName, CimSessionOptions sessionOptions)
		{
			IPAddress pAddress = null;
			InstanceHandle instanceHandle = null;
			SessionHandle sessionHandle = null;
			CimSession cimSession;
			string protocol;
			DestinationOptionsHandle destinationOptionsHandle;
			string str = computerName;
			if (!string.IsNullOrEmpty(str) && IPAddress.TryParse(str, out pAddress) && pAddress.AddressFamily == AddressFamily.InterNetworkV6 && str[0] != '[')
			{
				str = string.Concat("[", str, "]");
			}
			IDisposable disposable = CimApplication.AssertNoPendingShutdown();
			using (disposable)
			{
				ApplicationHandle handle = CimApplication.Handle;
				if (sessionOptions == null)
				{
					protocol = null;
				}
				else
				{
					protocol = sessionOptions.Protocol;
				}
				string str1 = str;
				if (sessionOptions == null)
				{
					destinationOptionsHandle = null;
				}
				else
				{
					destinationOptionsHandle = sessionOptions.DestinationOptionsHandle ?? sessionOptions.DestinationOptionsHandleOnDemand;
				}
				MiResult miResult = ApplicationMethods.NewSession(handle, protocol, str1, destinationOptionsHandle, out instanceHandle, out sessionHandle);
				if (miResult != MiResult.NOT_FOUND)
				{
					CimException.ThrowIfMiResultFailure(miResult, instanceHandle);
					CimSession cimSession1 = new CimSession(sessionHandle, computerName);
					cimSession = cimSession1;
				}
				else
				{
					throw new CimException(miResult, null, instanceHandle, System.Management.Automation.Strings.UnrecognizedProtocolName);
				}
			}
			return cimSession;
		}
Esempio n. 20
0
        public CimSubscriptionDeliveryOptions(CimSubscriptionDeliveryOptions optionsToClone)
        {
            SubscriptionDeliveryOptionsHandle subscriptionDeliveryOptionsHandle = null;

            if (optionsToClone != null)
            {
                MiResult miResult = MiResult.OK;                 //TODO: SubscriptionDeliveryOptionsMethods.Clone(optionsToClone.SubscriptionDeliveryOptionsHandle, out subscriptionDeliveryOptionsHandle);
                CimException.ThrowIfMiResultFailure(miResult);
                this._subscriptionDeliveryOptionsHandle = subscriptionDeliveryOptionsHandle;
                return;
            }
            else
            {
                throw new ArgumentNullException("optionsToClone");
            }
        }
Esempio n. 21
0
		public void Close()
		{
			lock (this._disposeThreadSafetyLock)
			{
				if (!this._disposed)
				{
					this._disposed = true;
				}
				else
				{
					return;
				}
			}
			MiResult miResult = this._handle.ReleaseHandleSynchronously();
			CimException.ThrowIfMiResultFailure(miResult);
		}
Esempio n. 22
0
        public static MiResult GetClass(Microsoft.Management.Infrastructure.Native.InstanceHandle instanceHandle, out ClassHandle classHandle)
        {
            MiResult          result   = MiResult.OK;
            IntPtr            ptr      = instanceHandle.DangerousGetHandle();
            NativeCimInstance instance = CimNativeApi.MarshalledObject.FromPointer <NativeCimInstance> (ptr);

            classHandle = null;
            if (!string.IsNullOrEmpty(instance.ClassName))
            {
                var options  = CimNativeApi.GetDestinationOptions(new SessionHandle(instance.SessionHandle));
                var classObj = CimNativeApi.QueryClasses(options, instance.Namespace, CimNativeApi.WQLNamespace, "SELECT * FROM Meta_Class WHERE ClassName = '" + instance.ClassName + "'").FirstOrDefault();
                classObj.SessionHandle = instance.SessionHandle;
                IntPtr classPtr = CimNativeApi.MarshalledObject.Create <NativeCimClass>(classObj);
                classHandle = new ClassHandle(classPtr, true);
            }
            return(result);
        }
Esempio n. 23
0
        internal override MiResult NativeMoveNext(OperationHandle operationHandle, out CimClass currentItem, out bool moreResults, out MiResult operationResult, out string errorMessage, out InstanceHandle errorDetailsHandle)
        {
            ClassHandle classHandle = null;

            currentItem = null;
            MiResult @class = OperationMethods.GetClass(operationHandle, out classHandle, out moreResults, out operationResult, out errorMessage, out errorDetailsHandle);

            if (classHandle != null && !classHandle.IsInvalid)
            {
                if (!base.ShortenLifetimeOfResults)
                {
                    classHandle = classHandle.Clone();
                }
                currentItem = new CimClass(classHandle);
            }
            return(@class);
        }
Esempio n. 24
0
        private static ApplicationHandle GetApplicationHandle()
        {
            ApplicationHandle applicationHandle = null;
            InstanceHandle    instanceHandle    = null;
            MiResult          miResult          = ApplicationMethods.Initialize(0, AppDomain.CurrentDomain.FriendlyName, out instanceHandle, out applicationHandle);

            CimException.ThrowIfMiResultFailure(miResult, instanceHandle);
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.DomainUnload += (object sender, EventArgs eventArgs) => CimApplication.Shutdown();
            AppDomain appDomain = AppDomain.CurrentDomain;

            appDomain.ProcessExit += (object param0, EventArgs param1) => {
                ApplicationMethods.SupressFurtherCallbacks();
                CimApplication.Shutdown();
            };
            return(applicationHandle);
        }
Esempio n. 25
0
        internal override MiResult NativeMoveNext(OperationHandle operationHandle, out CimInstance currentItem, out bool moreResults, out MiResult operationResult, out string errorMessage, out InstanceHandle errorDetailsHandle)
        {
            InstanceHandle instanceHandle = null;

            currentItem = null;
            MiResult instance = OperationMethods.GetInstance(operationHandle, out instanceHandle, out moreResults, out operationResult, out errorMessage, out errorDetailsHandle);

            if (instanceHandle != null && !instanceHandle.IsInvalid)
            {
                if (!base.ShortenLifetimeOfResults)
                {
                    instanceHandle = instanceHandle.Clone();
                }
                currentItem = new CimInstance(instanceHandle, null);
                currentItem.SetCimSessionComputerName(this._CimSessionComputerName);
                currentItem.SetCimSessionInstanceId(this._CimSessionInstanceID);
            }
            return(instance);
        }
Esempio n. 26
0
        internal override MiResult NativeMoveNext(OperationHandle operationHandle, out CimSubscriptionResult currentItem, out bool moreResults, out MiResult operationResult, out string errorMessage, out InstanceHandle errorDetailsHandle)
        {
            InstanceHandle instanceHandle = null;
            string         str            = null;
            string         str1           = null;

            currentItem = null;
            MiResult indication = OperationMethods.GetIndication(operationHandle, out instanceHandle, out str, out str1, out moreResults, out operationResult, out errorMessage, out errorDetailsHandle);

            if (instanceHandle != null && !instanceHandle.IsInvalid)
            {
                if (!base.ShortenLifetimeOfResults)
                {
                    instanceHandle = instanceHandle.Clone();
                }
                currentItem = new CimSubscriptionResult(instanceHandle, str, str1);
            }
            return(indication);
        }
Esempio n. 27
0
 public void AddCredentials(string optionName, CimCredential optionValue, uint flags)
 {
     if (string.IsNullOrWhiteSpace(optionName) || optionValue == null)
     {
         throw new ArgumentNullException("optionName");
     }
     else
     {
         if (optionValue != null)
         {
             this.AssertNotDisposed();
             MiResult miResult = MiResult.OK;                     //TODO: SubscriptionDeliveryOptionsMethods.AddCredentials(this._subscriptionDeliveryOptionsHandle, optionName, optionValue.GetCredential(), flags);
             CimException.ThrowIfMiResultFailure(miResult);
             return;
         }
         else
         {
             throw new ArgumentNullException("optionValue");
         }
     }
 }
Esempio n. 28
0
 internal void Cancel(CancellationMode cancellationMode)
 {
     lock (this._cancellationModeLock)
     {
         if (this._cancellationMode != CancellationMode.IgnoreCancellationRequests)
         {
             this._cancellationMode = cancellationMode;
         }
         else
         {
             return;
         }
     }
     lock (this._cancelVsCloseLock)
     {
         if (this._handle != null)
         {
             MiResult miResult = OperationMethods.Cancel(this._handle, MiCancellationReason.None);
             CimException.ThrowIfMiResultFailure(miResult);
         }
     }
     this.Cancelled.SafeInvoke <EventArgs>(this, EventArgs.Empty);
 }
Esempio n. 29
0
        internal static unsafe MiResult GetIndication(OperationHandle operationHandle, out InstanceHandle instanceHandle, out string bookmark, out string machineID, out bool moreResults, out MiResult result, out string errorMessage, out InstanceHandle completionDetails)
        {
            moreResults       = false;
            machineID         = System.Net.Dns.GetHostName();
            errorMessage      = "";
            bookmark          = null;
            instanceHandle    = null;
            result            = MiResult.OK;
            instanceHandle    = null;
            completionDetails = null;
            return(MiResult.OK);

            /*
             * int num;
             * instanceHandle = null;
             * moreResults = false;
             * result = MiResult.OK;
             * errorMessage = null;
             * bookmark = null;
             * machineID = null;
             * completionDetails = null;
             * _MI_Instance modopt(System.Runtime.CompilerServices.IsConst)* _MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer = (_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
             * UInt16 modopt(System.Runtime.CompilerServices.IsConst)* uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer = (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
             * UInt16 modopt(System.Runtime.CompilerServices.IsConst)* uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer1 = (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
             * byte num1 = 0;
             * _MI_Result _MIResult = 0;
             * UInt16 modopt(System.Runtime.CompilerServices.IsConst)* uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer2 = (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
             * _MI_Instance modopt(System.Runtime.CompilerServices.IsConst)* _MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer1 = (_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
             * _MI_Result modopt(System.Runtime.CompilerServices.CallConvCdecl) _MIResult modopt(System.Runtime.CompilerServices.CallConvCdecl) = (_MI_Result)<Module>.?A0xf5a90918.MI_Operation_GetIndication((void*)operationHandle.DangerousGetHandle(), ref (_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0), ref (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0), ref (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0), ref num1, (_MI_Result*)(&_MIResult), ref (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0), ref (_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0));
             * if ((_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0) != null)
             * {
             *      IntPtr intPtr = (IntPtr)_MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer;
             *      instanceHandle = new InstanceHandle(intPtr, false);
             * }
             * if (0 != num1)
             * {
             *      num = 1;
             * }
             * else
             * {
             *      num = 0;
             * }
             * int num2 = num;
             * moreResults = num2;
             * result = (MiResult)_MIResult;
             * if (_MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer1 != null)
             * {
             *      IntPtr intPtr1 = (IntPtr)_MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer1;
             *      completionDetails = new InstanceHandle(intPtr1, false);
             * }
             * if (uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer2 != null)
             * {
             *      IntPtr intPtr2 = (IntPtr)uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer2;
             *      errorMessage = Marshal.PtrToStringUni(intPtr2);
             * }
             * if (uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer != null)
             * {
             *      IntPtr intPtr3 = (IntPtr)uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer;
             *      bookmark = Marshal.PtrToStringUni(intPtr3);
             * }
             * if (uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer1 != null)
             * {
             *      IntPtr intPtr4 = (IntPtr)uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer1;
             *      machineID = Marshal.PtrToStringUni(intPtr4);
             * }
             * return (MiResult)_MIResult modopt(System.Runtime.CompilerServices.CallConvCdecl);
             */
        }
Esempio n. 30
0
		internal static unsafe MiResult GetIndication(OperationHandle operationHandle, out InstanceHandle instanceHandle, out string bookmark, out string machineID, out bool moreResults, out MiResult result, out string errorMessage, out InstanceHandle completionDetails)
		{
			moreResults = false;
			machineID = System.Net.Dns.GetHostName ();
			errorMessage = "";
			bookmark = null;
			instanceHandle = null;
			result = MiResult.OK;
			instanceHandle = null;
			completionDetails = null;
			return MiResult.OK;
			/*
			int num;
			instanceHandle = null;
			moreResults = false;
			result = MiResult.OK;
			errorMessage = null;
			bookmark = null;
			machineID = null;
			completionDetails = null;
			_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)* _MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer = (_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
			UInt16 modopt(System.Runtime.CompilerServices.IsConst)* uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer = (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
			UInt16 modopt(System.Runtime.CompilerServices.IsConst)* uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer1 = (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
			byte num1 = 0;
			_MI_Result _MIResult = 0;
			UInt16 modopt(System.Runtime.CompilerServices.IsConst)* uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer2 = (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
			_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)* _MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer1 = (_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0);
			_MI_Result modopt(System.Runtime.CompilerServices.CallConvCdecl) _MIResult modopt(System.Runtime.CompilerServices.CallConvCdecl) = (_MI_Result)<Module>.?A0xf5a90918.MI_Operation_GetIndication((void*)operationHandle.DangerousGetHandle(), ref (_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0), ref (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0), ref (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0), ref num1, (_MI_Result*)(&_MIResult), ref (UInt16 modopt(System.Runtime.CompilerServices.IsConst)*)((long)0), ref (_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0));
			if ((_MI_Instance modopt(System.Runtime.CompilerServices.IsConst)*)((long)0) != null)
			{
				IntPtr intPtr = (IntPtr)_MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer;
				instanceHandle = new InstanceHandle(intPtr, false);
			}
			if (0 != num1)
			{
				num = 1;
			}
			else
			{
				num = 0;
			}
			int num2 = num;
			moreResults = num2;
			result = (MiResult)_MIResult;
			if (_MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer1 != null)
			{
				IntPtr intPtr1 = (IntPtr)_MIInstance modopt(System.Runtime.CompilerServices.IsConst)Pointer1;
				completionDetails = new InstanceHandle(intPtr1, false);
			}
			if (uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer2 != null)
			{
				IntPtr intPtr2 = (IntPtr)uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer2;
				errorMessage = Marshal.PtrToStringUni(intPtr2);
			}
			if (uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer != null)
			{
				IntPtr intPtr3 = (IntPtr)uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer;
				bookmark = Marshal.PtrToStringUni(intPtr3);
			}
			if (uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer1 != null)
			{
				IntPtr intPtr4 = (IntPtr)uInt16 modopt(System.Runtime.CompilerServices.IsConst)Pointer1;
				machineID = Marshal.PtrToStringUni(intPtr4);
			}
			return (MiResult)_MIResult modopt(System.Runtime.CompilerServices.CallConvCdecl);
			*/
		}
Esempio n. 31
0
        internal static void GetCimErrorFromMiResult(MiResult errorCode, string errorMessage, out InstanceHandle errorDetailsHandle)
        {
			errorDetailsHandle = new InstanceHandle(IntPtr.Zero, false);
        }
Esempio n. 32
0
        internal void ClassCallback(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, ClassHandle ClassHandle, bool moreResults, MiResult operationResult, string errorMessage, InstanceHandle errorDetailsHandle)
        {
            CimClass cimClass = null;

            if (ClassHandle != null && !ClassHandle.IsInvalid)
            {
                if (!this._shortenLifetimeOfResults)
                {
                    ClassHandle = ClassHandle.Clone();
                }
                cimClass = new CimClass(ClassHandle);
            }
            //using (cimClass)
            {
                if (!this._shortenLifetimeOfResults || cimClass == null)
                {
                    base.ProcessNativeCallback(callbackProcessingContext, cimClass, moreResults, operationResult, errorMessage, errorDetailsHandle);
                }
            }
        }
        internal void IndicationResultCallback(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, InstanceHandle instanceHandle, string bookMark, string machineID, bool moreResults, MiResult operationResult, string errorMessage, InstanceHandle errorDetailsHandle)
        {
            CimSubscriptionResult cimSubscriptionResult = null;

            if (instanceHandle != null && !instanceHandle.IsInvalid)
            {
                if (!this._shortenLifetimeOfResults)
                {
                    instanceHandle = instanceHandle.Clone();
                }
                cimSubscriptionResult = new CimSubscriptionResult(instanceHandle, bookMark, machineID);
            }
            using (cimSubscriptionResult)
            {
                if (!this._shortenLifetimeOfResults || cimSubscriptionResult == null)
                {
                    base.ProcessNativeCallback(callbackProcessingContext, cimSubscriptionResult, moreResults, operationResult, errorMessage, errorDetailsHandle);
                }
            }
        }