Example #1
0
 protected WmiEventSink(ManagementOperationObserver watcher, object context, ManagementScope scope, string path, string className)
 {
     try
     {
         this.context   = context;
         this.watcher   = watcher;
         this.className = className;
         this.isLocal   = false;
         if (path != null)
         {
             this.path = new ManagementPath(path);
             if ((string.Compare(this.path.Server, ".", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(this.path.Server, Environment.MachineName, StringComparison.OrdinalIgnoreCase) == 0))
             {
                 this.isLocal = true;
             }
         }
         if (scope != null)
         {
             this.scope = scope.Clone();
             if ((path == null) && ((string.Compare(this.scope.Path.Server, ".", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(this.scope.Path.Server, Environment.MachineName, StringComparison.OrdinalIgnoreCase) == 0)))
             {
                 this.isLocal = true;
             }
         }
         WmiNetUtilsHelper.GetDemultiplexedStub_f(this, this.isLocal, out this.stub);
         this.hash = Interlocked.Increment(ref s_hash);
     }
     catch
     {
     }
 }
        void HackToCreateStubInMTA(object param)
        {
            SinkForEventQuery obj      = (SinkForEventQuery)param;
            object            dmuxStub = null;

            obj.Status = WmiNetUtilsHelper.GetDemultiplexedStub_f(obj, obj.isLocal, out dmuxStub);
            obj.stub   = (IWbemObjectSink)dmuxStub;
        }
Example #3
0
        private void HackToCreateStubInMTA(object param)
        {
            SinkForEventQuery getDemultiplexedStubF = (SinkForEventQuery)param;
            object            obj = null;

            getDemultiplexedStubF.Status = WmiNetUtilsHelper.GetDemultiplexedStub_f(getDemultiplexedStubF, getDemultiplexedStubF.isLocal, out obj);
            getDemultiplexedStubF.stub   = (IWbemObjectSink)obj;
        }
Example #4
0
        private void HackToCreateStubInMTA(object param)
        {
            SinkForEventQuery pIUnknown  = (SinkForEventQuery)param;
            object            ppIUnknown = null;

            pIUnknown.Status = WmiNetUtilsHelper.GetDemultiplexedStub_f(pIUnknown, pIUnknown.isLocal, out ppIUnknown);
            pIUnknown.stub   = (IWbemObjectSink)ppIUnknown;
        }
Example #5
0
        protected WmiEventSink(ManagementOperationObserver watcher,
                               object context,
                               ManagementScope scope,
                               string path,
                               string className)
        {
            try
            {
                this.context   = context;
                this.watcher   = watcher;
                this.className = className;
                this.isLocal   = false;

                if (null != path)
                {
                    this.path = new ManagementPath(path);
                    if ((0 == string.Compare(this.path.Server, ".", StringComparison.OrdinalIgnoreCase)) ||
                        (0 == string.Compare(this.path.Server, System.Environment.MachineName, StringComparison.OrdinalIgnoreCase)))
                    {
                        this.isLocal = true;
                    }
                }

                if (null != scope)
                {
                    this.scope = (ManagementScope)scope.Clone();
                    if (null == path) // use scope to see if sink is local
                    {
                        if ((0 == string.Compare(this.scope.Path.Server, ".", StringComparison.OrdinalIgnoreCase)) ||
                            (0 == string.Compare(this.scope.Path.Server, System.Environment.MachineName, StringComparison.OrdinalIgnoreCase)))
                        {
                            this.isLocal = true;
                        }
                    }
                }

                WmiNetUtilsHelper.GetDemultiplexedStub_f(this, this.isLocal, out stub);
                hash = Threading.Interlocked.Increment(ref s_hash);
            }
            catch { }
        }