public void SetStatus(
            int flags,
            int hResult,
            String message,
            IntPtr pErrObj)
        {
#if TODO_ERROBJ_NEVER_USED
            IWbemClassObjectFreeThreaded errObj = null;
            if (pErrObj != IntPtr.Zero)
            {
                Marshal.AddRef(pErrObj);
                errObj = new IWbemClassObjectFreeThreaded(pErrObj);
            }
#endif // TODO_ERROBJ_NEVER_USED

            try
            {
                // Fire Stopped event
                eventWatcher.FireStopped(new StoppedEventArgs(context, hResult));

                //This handles cases in which WMI calls SetStatus to indicate a problem, for example
                //a queue overflow due to slow client processing.
                //Currently we just cancel the subscription in this case.
                // BUG# 97657 - When you cancel a call with CancelAsyncCall, on Windows 2000,
                // you get a SetStatus with WBEM_E_CALL_CANCELLED.  On Windows XP, you get
                // a set status with WBEM_S_OPERATION_CANCELLED!!!
                if (hResult != (int)tag_WBEMSTATUS.WBEM_E_CALL_CANCELLED &&
                    hResult != (int)tag_WBEMSTATUS.WBEM_S_OPERATION_CANCELLED)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(Cancel2));                    // Cancel(); // BUG#118550 - On Win2k, we get a deadlock if we do a Cancel within a SetStatus
                }
            }
            catch {}
        }
        public void SetStatus(
            int flags,
            int hResult,
            String message,
            IntPtr pErrObj)
        {
            IWbemClassObjectFreeThreaded errObj = null;

            if (pErrObj != IntPtr.Zero)
            {
                Marshal.AddRef(pErrObj);
                errObj = new IWbemClassObjectFreeThreaded(pErrObj);
            }
            // TODO: errObj never used

            try {
                if (null != eventWatcher)
                {
                    // Fire Stopped event
                    eventWatcher.FireStopped(new StoppedEventArgs(context, hResult));

                    // Unhook the parent watcher
                    eventWatcher = null;
                }

                ReleaseStub();
            } catch {}
        }
Пример #3
0
        public void SetStatus(
            int flags,
            int hResult,
            String message,
            IntPtr pErrObj)
        {
            try
            {
                // Fire Stopped event
                eventWatcher.FireStopped(new StoppedEventArgs(context, hResult));

                //This handles cases in which WMI calls SetStatus to indicate a problem, for example
                //a queue overflow due to slow client processing.
                //Currently we just cancel the subscription in this case.
                if (hResult != (int)tag_WBEMSTATUS.WBEM_E_CALL_CANCELLED &&
                    hResult != (int)tag_WBEMSTATUS.WBEM_S_OPERATION_CANCELLED)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(Cancel2));
                }
            }
            catch
            {
            }
        }
Пример #4
0
        public void SetStatus(
            int flags,
            int hResult,
            String message,
            IntPtr pErrObj)
        {
#if TODO_ERROBJ_NEVER_USED
            IWbemClassObjectFreeThreaded errObj = null;
            if (pErrObj != IntPtr.Zero)
            {
                Marshal.AddRef(pErrObj);
                errObj = new IWbemClassObjectFreeThreaded(pErrObj);
            }
#endif //

            try
            {
                // Fire Stopped event
                eventWatcher.FireStopped(new StoppedEventArgs(context, hResult));

                //This handles cases in which WMI calls SetStatus to indicate a problem, for example
                //a queue overflow due to slow client processing.
                //Currently we just cancel the subscription in this case.
                //


                if (hResult != (int)tag_WBEMSTATUS.WBEM_E_CALL_CANCELLED &&
                    hResult != (int)tag_WBEMSTATUS.WBEM_S_OPERATION_CANCELLED)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(Cancel2));// Cancel(); //
                }
            }
            catch
            {
            }
        }