public static CimType ToCimType(this MiType miType)
        {
            MiType miType1 = miType;

            switch (miType1)
            {
            case MiType.Boolean:
            {
                return(CimType.Boolean);
            }

            case MiType.UInt8:
            {
                return(CimType.UInt8);
            }

            case MiType.SInt8:
            {
                return(CimType.SInt8);
            }

            case MiType.UInt16:
            {
                return(CimType.UInt16);
            }

            case MiType.SInt16:
            {
                return(CimType.SInt16);
            }

            case MiType.UInt32:
            {
                return(CimType.UInt32);
            }

            case MiType.SInt32:
            {
                return(CimType.SInt32);
            }

            case MiType.UInt64:
            {
                return(CimType.UInt64);
            }

            case MiType.SInt64:
            {
                return(CimType.SInt64);
            }

            case MiType.Real32:
            {
                return(CimType.Real32);
            }

            case MiType.Real64:
            {
                return(CimType.Real64);
            }

            case MiType.Char16:
            {
                return(CimType.Char16);
            }

            case MiType.DateTime:
            {
                return(CimType.DateTime);
            }

            case MiType.String:
            {
                return(CimType.String);
            }

            case MiType.Reference:
            {
                return(CimType.Reference);
            }

            case MiType.Instance:
            {
                return(CimType.Instance);
            }

            case MiType.BooleanArray:
            {
                return(CimType.BooleanArray);
            }

            case MiType.UInt8Array:
            {
                return(CimType.UInt8Array);
            }

            case MiType.SInt8Array:
            {
                return(CimType.SInt8Array);
            }

            case MiType.UInt16Array:
            {
                return(CimType.UInt16Array);
            }

            case MiType.SInt16Array:
            {
                return(CimType.SInt16Array);
            }

            case MiType.UInt32Array:
            {
                return(CimType.UInt32Array);
            }

            case MiType.SInt32Array:
            {
                return(CimType.SInt32Array);
            }

            case MiType.UInt64Array:
            {
                return(CimType.UInt64Array);
            }

            case MiType.SInt64Array:
            {
                return(CimType.SInt64Array);
            }

            case MiType.Real32Array:
            {
                return(CimType.Real32Array);
            }

            case MiType.Real64Array:
            {
                return(CimType.Real64Array);
            }

            case MiType.Char16Array:
            {
                return(CimType.Char16Array);
            }

            case MiType.DateTimeArray:
            {
                return(CimType.DateTimeArray);
            }

            case MiType.StringArray:
            {
                return(CimType.StringArray);
            }

            case MiType.ReferenceArray:
            {
                return(CimType.ReferenceArray);
            }

            case MiType.InstanceArray:
            {
                return(CimType.InstanceArray);
            }
            }
            throw new ArgumentOutOfRangeException("miType");
        }
Beispiel #2
0
		internal static unsafe MiResult GetMethodElementAt_GetType(ClassHandle handle, int index, out MiType type)
		{
			/*
			_MI_Result _MIResult;
			_MI_Type _MIType = 0;
			_MI_QualifierSet _MIQualifierSet;
			_MI_ParameterSet _MIParameterSet;
			UInt16* uInt16Pointer = null;
			DangerousHandleAccessor dangerousHandleAccessor = null;
			DangerousHandleAccessor dangerousHandleAccessor = new DangerousHandleAccessor(handle);
			try
			{
				dangerousHandleAccessor = dangerousHandleAccessor;
				_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_Class_GetMethodAt((void*)dangerousHandleAccessor.DangerousGetHandle(), index, ref uInt16Pointer, (long)0, ref _MIParameterSet);
				if (_MIResult == 0)
				{
					_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_ParameterSet_GetMethodReturnType(ref _MIParameterSet, (_MI_Type*)(&_MIType), ref _MIQualifierSet);
					if (_MIResult == 0)
					{
						type = (MiType)_MIType;
					}
				}
			}
			dangerousHandleAccessor.Dispose();
			return (MiResult)_MIResult;
			*/

			type = MiType.UInt32;
			return MiResult.OK;
		}
Beispiel #3
0
		internal static unsafe MiResult GetMethodParameterGetQualifierElementAt_GetType(ClassHandle handle, int methodIndex, int parameterName, int index, out MiType type)
		{
			/*
			_MI_Result _MIResult;
			_MI_Type _MIType = 0;
			_MI_Value _MIValue;
			uint num = 0;
			_MI_QualifierSet _MIQualifierSet;
			UInt16* uInt16Pointer = null;
			_MI_ParameterSet _MIParameterSet;
			UInt16* uInt16Pointer1 = null;
			DangerousHandleAccessor dangerousHandleAccessor = null;
			DangerousHandleAccessor dangerousHandleAccessor = new DangerousHandleAccessor(handle);
			try
			{
				dangerousHandleAccessor = dangerousHandleAccessor;
				_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_Class_GetMethodAt((void*)dangerousHandleAccessor.DangerousGetHandle(), methodIndex, ref uInt16Pointer1, (long)0, ref _MIParameterSet);
				if (_MIResult == 0)
				{
					_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_ParameterSet_GetParameterAt(ref _MIParameterSet, parameterName, ref uInt16Pointer, (_MI_Type*)(&_MIType), (long)0, ref _MIQualifierSet);
					if (_MIResult == 0)
					{
						_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_QualifierSet_GetQualifierAt(ref _MIQualifierSet, index, ref (UInt16*)((long)0), (_MI_Type*)(&_MIType), ref num, ref _MIValue);
						if (_MIResult == 0)
						{
							type = (MiType)_MIType;
						}
					}
				}
			}
			dangerousHandleAccessor.Dispose();
			return (MiResult)_MIResult;
			*/
			type = MiType.Instance;
			return MiResult.OK;
		}
Beispiel #4
0
		internal static MiResult GetElementAt_GetType (ClassHandle handle, int index, out MiType type)
		{
			/*
			_MI_Result _MIResult;
			_MI_Type _MIType = 0;
			DangerousHandleAccessor dangerousHandleAccessor = null;
			DangerousHandleAccessor dangerousHandleAccessor = new DangerousHandleAccessor(handle);
			try
			{
				dangerousHandleAccessor = dangerousHandleAccessor;
				_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_Class_GetElementAt((void*)dangerousHandleAccessor.DangerousGetHandle(), index, (long)0, (long)0, (long)0, (_MI_Type*)(&_MIType), (long)0, (long)0, (long)0);
				if (_MIResult == 0)
				{
					type = (MiType)_MIType;
				}
			}
			dangerousHandleAccessor.Dispose();
			return (MiResult)_MIResult;
			*/
			NativeCimClass instance = CimNativeApi.MarshalledObject.FromPointer<NativeCimClass> (handle.DangerousGetHandle ());
			NativeCimProperties properties = NativeCimPropertiesHelper.Deserialize (instance.Properties);
			var ctype = properties.ElementAt (index).Type;
			if (ctype == CimType.Unknown) {
				Type propType = properties.ElementAt (index).Value.GetType ();
				ctype = CimConverter.GetCimType (propType);
			}
			type = ctype.ToMiType ();
			return MiResult.OK;
		}
Beispiel #5
0
		internal static unsafe MiResult GetMethodAt_GetType (ClassHandle handle, int methodIndex, int parameterIndex, out MiType type)
		{
			/*
			_MI_Result _MIResult;
			_MI_Type _MIType = 0;
			_MI_QualifierSet _MIQualifierSet;
			UInt16* uInt16Pointer = null;
			_MI_ParameterSet _MIParameterSet;
			UInt16* uInt16Pointer1 = null;
			DangerousHandleAccessor dangerousHandleAccessor = null;
			DangerousHandleAccessor dangerousHandleAccessor = new DangerousHandleAccessor(handle);
			try
			{
				dangerousHandleAccessor = dangerousHandleAccessor;
				_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_Class_GetMethodAt((void*)dangerousHandleAccessor.DangerousGetHandle(), methodIndex, ref uInt16Pointer1, (long)0, ref _MIParameterSet);
				if (_MIResult == 0)
				{
					_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_ParameterSet_GetParameterAt(ref _MIParameterSet, parameterIndex, ref uInt16Pointer, (_MI_Type*)(&_MIType), (long)0, ref _MIQualifierSet);
					if (_MIResult == 0)
					{
						type = (MiType)_MIType;
					}
				}
			}
			dangerousHandleAccessor.Dispose();
			return (MiResult)_MIResult;
			*/
			NativeCimClass instance = CimNativeApi.MarshalledObject.FromPointer<NativeCimClass> (handle.DangerousGetHandle ());
			var methods = NativeCimMethodsHelper.Deserialize (instance.Methods);
			var method = methods.ElementAt (methodIndex);
			var properties = NativeCimPropertiesHelper.Deserialize (method.InSignature);
			type = MiType.Instance;
			int i = 0;
			foreach (var property in properties) {
				if (i == parameterIndex)
				{
					type = property.Type.ToMiType();
					break;
				}
			}
			return MiResult.OK;
		}
Beispiel #6
0
		internal static unsafe MiResult GetPropertyQualifierElementAt_GetType(ClassHandle handle, int index, string propertyName, out MiType type)
		{
			/*
			_MI_Result _MIResult;
			_MI_Type _MIType = 0;
			_MI_Value _MIValue;
			uint num = 0;
			_MI_QualifierSet _MIQualifierSet;
			DangerousHandleAccessor dangerousHandleAccessor = null;
			DangerousHandleAccessor dangerousHandleAccessor = new DangerousHandleAccessor(handle);
			try
			{
				dangerousHandleAccessor = dangerousHandleAccessor;
				_MI_Class* _MIClassPointer = (_MI_Class*)((void*)dangerousHandleAccessor.DangerousGetHandle());
				IntPtr hGlobalUni = Marshal.StringToHGlobalUni(propertyName);
				IntPtr intPtr = hGlobalUni;
				_MIResult = 0;
				try
				{
					_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_Class_GetElement(_MIClassPointer, (void*)hGlobalUni, (long)0, (long)0, (_MI_Type*)((long)0), (long)0, ref _MIQualifierSet, (long)0, (long)0);
				}
				finally
				{
					if (intPtr != IntPtr.Zero)
					{
						Marshal.FreeHGlobal(intPtr);
					}
				}
				if (_MIResult == 0)
				{
					_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_QualifierSet_GetQualifierAt(ref _MIQualifierSet, index, ref (UInt16*)((long)0), (_MI_Type*)(&_MIType), ref num, ref _MIValue);
					if (_MIResult == 0)
					{
						type = (MiType)_MIType;
					}
				}
			}
			dangerousHandleAccessor.Dispose();
			return (MiResult)_MIResult;
			*/
			type = MiType.Instance;
			return MiResult.OK;
		}
Beispiel #7
0
		internal static unsafe MiResult GetQualifierElementAt_GetType(ClassHandle handle, int index, out MiType type)
		{
			/*
			_MI_Result _MIResult;
			_MI_Type _MIType = 0;
			_MI_Value _MIValue;
			uint num = 0;
			_MI_QualifierSet _MIQualifierSet;
			DangerousHandleAccessor dangerousHandleAccessor = null;
			DangerousHandleAccessor dangerousHandleAccessor = new DangerousHandleAccessor(handle);
			try
			{
				dangerousHandleAccessor = dangerousHandleAccessor;
				_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_Class_GetClassQualifierSet((void*)dangerousHandleAccessor.DangerousGetHandle(), ref _MIQualifierSet);
				if (_MIResult == 0)
				{
					_MIResult = (_MI_Result)<Module>.?A0x37ea71e9.MI_QualifierSet_GetQualifierAt(ref _MIQualifierSet, index, ref (UInt16*)((long)0), (_MI_Type*)(&_MIType), ref num, ref _MIValue);
					if (_MIResult == 0)
					{
						type = (MiType)_MIType;
					}
				}
			}
			dangerousHandleAccessor.Dispose();
			return (MiResult)_MIResult;
			*/
			NativeCimClass instance = CimNativeApi.MarshalledObject.FromPointer<NativeCimClass> (handle.DangerousGetHandle ());
			var qualifiers = NativeCimQualifiersHelper.Deserialize (instance.Qualifiers);
			type = CimConverter.GetCimType (qualifiers.ElementAt (index).Value.GetType ()).ToMiType ();
			return MiResult.OK;
		}
        internal void StreamedParameterCallback(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, string parameterName, object parameterValue, MiType parameterType)
        {
            parameterValue = CimInstance.ConvertFromNativeLayer(parameterValue, null, null, !this._shortenLifetimeOfResults);
            CimInstance cimInstance = parameterValue as CimInstance;

            if (cimInstance != null)
            {
                cimInstance.SetCimSessionComputerName(this._CimSessionComputerName);
                cimInstance.SetCimSessionInstanceId(this._CimSessionInstanceID);
            }
            CimInstance[] cimInstanceArray = parameterValue as CimInstance[];
            if (cimInstanceArray != null)
            {
                CimInstance[] cimInstanceArray1 = cimInstanceArray;
                for (int i = 0; i < (int)cimInstanceArray1.Length; i++)
                {
                    CimInstance cimInstance1 = cimInstanceArray1[i];
                    if (cimInstance1 != null)
                    {
                        cimInstance1.SetCimSessionComputerName(this._CimSessionComputerName);
                        cimInstance1.SetCimSessionInstanceId(this._CimSessionInstanceID);
                    }
                }
            }
            try
            {
                CimMethodResultBase cimMethodStreamedResult = new CimMethodStreamedResult(parameterName, parameterValue, parameterType.ToCimType());
                base.ProcessNativeCallback(callbackProcessingContext, cimMethodStreamedResult, true, MiResult.OK, null, null);
            }
            finally
            {
                if (this._shortenLifetimeOfResults)
                {
                    CimInstance cimInstance2 = parameterValue as CimInstance;
                    if (cimInstance2 != null)
                    {
                        cimInstance2.Dispose();
                    }
                    CimInstance[] cimInstanceArray2 = parameterValue as CimInstance[];
                    if (cimInstanceArray2 != null)
                    {
                        CimInstance[] cimInstanceArray3 = cimInstanceArray2;
                        for (int j = 0; j < (int)cimInstanceArray3.Length; j++)
                        {
                            CimInstance cimInstance3 = cimInstanceArray3[j];
                            if (cimInstance3 != null)
                            {
                                cimInstance3.Dispose();
                            }
                        }
                    }
                }
            }
        }
Beispiel #9
0
 internal static void ThrowIfMismatchedType(MiType type, object managedValue)
 {
 }
Beispiel #10
0
        public static MiResult GetElementAt_GetType(InstanceHandle handle, int _index, out MiType miType)
        {
            NativeCimInstance instance = CimNativeApi.MarshalledObject.FromPointer <NativeCimInstance> (handle.DangerousGetHandle());
            var properties             = NativeCimPropertiesHelper.Deserialize(PropertiesOrSystem(instance));
            int i = 0;

            miType = MiType.Boolean;
            foreach (var element in properties)
            {
                if (i == _index)
                {
                    Type type = element.Value.GetType();
                    miType = CimConverter.GetCimType(type).ToMiType();
                    break;
                }
                i++;
            }
            return(MiResult.OK);
        }
Beispiel #11
0
		internal static void ThrowIfMismatchedType(MiType type, object managedValue)
		{
			
		}
Beispiel #12
0
		public static MiResult GetElementAt_GetType (InstanceHandle handle, int _index, out MiType miType)
		{
			NativeCimInstance instance = CimNativeApi.MarshalledObject.FromPointer<NativeCimInstance> (handle.DangerousGetHandle ());
			var properties = NativeCimPropertiesHelper.Deserialize (PropertiesOrSystem(instance));
			int i = 0;
			miType = MiType.Boolean;
			foreach (var element in properties) {
				if (i == _index) {
					Type type = element.Value.GetType ();
					miType = CimConverter.GetCimType (type).ToMiType();
					break;
				}
				i++;
			}
			return MiResult.OK;
		}