コード例 #1
0
ファイル: ManagementEventWatcher.cs プロジェクト: ash2005/z
        internal void Cancel()
        {
            if (null != stub)
            {
                lock (this)
                {
                    if (null != stub)
                    {
                        int status = services.CancelAsyncCall_(stub);

                        // Release prior to throwing an exception.
                        ReleaseStub();

                        if (status < 0)
                        {
                            if ((status & 0xfffff000) == 0x80041000)
                            {
                                ManagementException.ThrowWithExtendedInfo((ManagementStatus)status);
                            }
                            else
                            {
                                Marshal.ThrowExceptionForHR(status);
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
        internal void Cancel()
        {
            if (null != stub)
            {
#pragma warning disable CA2002
                lock (this)
#pragma warning restore CA2002
                {
                    if (null != stub)
                    {
                        int status = services.CancelAsyncCall_(stub);

                        // Release prior to throwing an exception.
                        ReleaseStub();

                        if (status < 0)
                        {
                            if ((status & 0xfffff000) == 0x80041000)
                            {
                                ManagementException.ThrowWithExtendedInfo((ManagementStatus)status);
                            }
                            else
                            {
                                Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
        internal void Cancel()
        {
            int status = (int)ManagementStatus.NoError;

            try {
                status = services.CancelAsyncCall_(stub);
            }
            catch (Exception e) {
                ManagementException.ThrowWithExtendedInfo(e);
            }

            if ((status & 0xfffff000) == 0x80041000)
            {
                ManagementException.ThrowWithExtendedInfo((ManagementStatus)status);
            }
            else if ((status & 0x80000000) != 0)
            {
                Marshal.ThrowExceptionForHR(status);
            }
        }