Пример #1
0
        public int CreateInstanceEnum_(string strFilter, int lFlags, IWbemContext pCtx, out IEnumWbemClassObject ppEnum)
        {
            var items = WMIDatabaseFactory.Get(_currentNamespace, strFilter);

            ppEnum = new UnixEnumWbemClassObject(items);
            return(0);
        }
Пример #2
0
        public int ExecQueryAsync_(string strQueryLanguage, string strQuery, int lFlags, IWbemContext pCtx, IWbemObjectSink pResponseHandler)
        {
            IEnumerable <IWbemClassObject_DoNotMarshal> list = WMIDatabaseFactory.Get(_currentNamespace, strQuery);

            pResponseHandler.Indicate_(list.Count(), new IntPtr[0]);
            return(0);
        }
Пример #3
0
        public int ExecQuery_(string strQueryLanguage, string strQuery, int lFlags, IWbemContext pCtx, out IEnumWbemClassObject ppEnum)
        {
            IEnumerable <IWbemClassObject_DoNotMarshal> list = WMIDatabaseFactory.Get(_currentNamespace, strQuery);

            ppEnum = new UnixEnumWbemClassObject(list);
            return(0);
        }
Пример #4
0
        internal static int CreateInstanceEnumWmi(string strFilter, int lFlags, IWbemContext pCtx, out IEnumWbemClassObject ppEnum, int impLevel, int authnLevel, IWbemServices pCurrentNamespace, string strUser, IntPtr strPassword, string strAuthority)
        {
            var svc   = pCurrentNamespace as UnixWbemServices;
            var items = WMIDatabaseFactory.Get(svc.CurrentNamespace, "SELECT * FROM " + strFilter);

            ppEnum = new UnixEnumWbemClassObject(items);
            return(0);
        }
Пример #5
0
        internal static int ExecQueryWmi(string strQueryLanguage, string strQuery, int lFlags, IWbemContext pCtx, out IEnumWbemClassObject ppEnum, int impLevel, int authnLevel, IWbemServices pCurrentNamespace, string strUser, IntPtr strPassword, string strAuthority)
        {
            var svc = pCurrentNamespace as UnixWbemServices;
            IEnumerable <IWbemClassObject_DoNotMarshal> list = WMIDatabaseFactory.Get(svc.CurrentNamespace, strQuery);

            ppEnum = new UnixEnumWbemClassObject(list);
            return(0);
        }
Пример #6
0
        public int ExecMethod_(string strObjectPath, string strMethodName, int lFlags, IWbemContext pCtx, IntPtr pInParams, out IWbemClassObjectFreeThreaded ppOutParams, IntPtr ppCallResult)
        {
            string strQuery = QueryParser.GetQueryFromPath(strObjectPath);
            var    items    = WMIDatabaseFactory.Get(_currentNamespace, strQuery);

            ppOutParams = null;
            foreach (var obj in items)
            {
                var intPtr = MarshalWbemObject.GetInstance(null).MarshalManagedToNative(obj);
                ppOutParams = new IWbemClassObjectFreeThreaded(intPtr);
            }
            return(0);
        }
Пример #7
0
        /// <summary>
        /// Creates the signature.
        /// </summary>
        /// <param name='info'>
        /// Info.
        /// </param>
        /// <param name='ppInSignature'>
        /// Pp in signature.
        /// </param>
        /// <param name='ppOutSignature'>
        /// Pp out signature.
        /// </param>
        public static void CreateSignature(UnixCimMethodInfo info, out IWbemClassObject_DoNotMarshal ppInSignature, out IWbemClassObject_DoNotMarshal ppOutSignature)
        {
            Type inType  = null;
            Type outType = null;

            if (string.IsNullOrEmpty(info.InSignatureType))
            {
                inType = typeof(UNIX_MethodParameterClass);
            }
            else
            {
                inType = Type.GetType(info.InSignatureType, false, true);
            }

            if (string.IsNullOrEmpty(info.OutSignatureType))
            {
                outType = typeof(UNIX_MethodParameterClass);
            }
            else
            {
                outType = Type.GetType(info.OutSignatureType, false, true);
            }

            var inClass  = (UNIX_MethodParameterClass)WMIDatabaseFactory.GetHandler(inType).Get((object)null);
            var outClass = (UNIX_MethodParameterClass)WMIDatabaseFactory.GetHandler(outType).Get((object)null);

            if (info.InProperties != null)
            {
                foreach (var property in info.InProperties)
                {
                    inClass.RegisterProperty(property);
                }
            }

            outClass.RegisterProperty(new UnixWbemPropertyInfo {
                Name = "ReturnValue", Type = CimType.UInt32, Flavor = 0
            });

            if (info.OutProperties != null)
            {
                foreach (var property in info.OutProperties)
                {
                    outClass.RegisterProperty(property);
                }
            }

            ppInSignature  = new UnixWbemClassObject(inClass);
            ppOutSignature = new UnixWbemClassObject(outClass);
        }
Пример #8
0
 internal static int ConnectServerWmi(string strNetworkResource, string strUser, IntPtr strPassword, string strLocale, int lSecurityFlags, string strAuthority, IWbemContext pCtx, out IWbemServices ppNamespace, int impersonationLevel, int authenticationLevel)
 {
     WMIDatabaseFactory.EnsureOpen();
     ppNamespace = new UnixWbemServices();
     return(0);
 }
Пример #9
0
 public int ExecNotificationQuery_(string strQueryLanguage, string strQuery, int lFlags, IWbemContext pCtx, out IEnumWbemClassObject ppEnum)
 {
     ppEnum = new UnixEnumWbemClassObject(WMIDatabaseFactory.Get(_currentNamespace, strQuery));
     return(0);
 }