public void Delete (ManagementOperationObserver watcher, DeleteOptions options) { throw new NotImplementedException (); }
public void Delete(ManagementOperationObserver watcher, DeleteOptions options) { throw new NotImplementedException(); }
public void Delete (DeleteOptions options) { throw new NotImplementedException (); }
public void Delete(DeleteOptions options) { throw new NotImplementedException(); }
public void Delete(ManagementOperationObserver watcher, DeleteOptions options) { int num; DeleteOptions deleteOption; if (this.path == null || this.path.Path.Length == 0) { throw new InvalidOperationException(); } else { if (watcher != null) { this.Initialize(false); if (options != null) { deleteOption = (DeleteOptions)options.Clone(); } else { deleteOption = new DeleteOptions(); } DeleteOptions deleteOption1 = deleteOption; if (watcher.HaveListenersForProgress) { deleteOption1.SendStatus = true; } IWbemServices wbemServices = this.scope.GetIWbemServices(); WmiEventSink newSink = watcher.GetNewSink(this.scope, deleteOption1.Context); SecurityHandler securityHandler = this.scope.GetSecurityHandler(); if (!base.IsClass) { num = this.scope.GetSecuredIWbemServicesHandler(wbemServices).DeleteInstanceAsync_(this.path.RelativePath, deleteOption1.Flags, deleteOption1.GetContext(), newSink.Stub); } else { num = this.scope.GetSecuredIWbemServicesHandler(wbemServices).DeleteClassAsync_(this.path.RelativePath, deleteOption1.Flags, deleteOption1.GetContext(), newSink.Stub); } if (securityHandler != null) { securityHandler.Reset(); } if (num < 0) { watcher.RemoveSink(newSink); if (((long)num & (long)-4096) != (long)-2147217408) { Marshal.ThrowExceptionForHR(num); } else { ManagementException.ThrowWithExtendedInfo((ManagementStatus)num); return; } } return; } else { throw new ArgumentNullException("watcher"); } } }
public void Delete(DeleteOptions options) { int num; DeleteOptions deleteOption; if (this.path == null || this.path.Path.Length == 0) { throw new InvalidOperationException(); } else { this.Initialize(false); if (options != null) { deleteOption = options; } else { deleteOption = new DeleteOptions(); } DeleteOptions deleteOption1 = deleteOption; IWbemServices wbemServices = this.scope.GetIWbemServices(); SecurityHandler securityHandler = null; try { securityHandler = this.scope.GetSecurityHandler(); if (!base.IsClass) { num = this.scope.GetSecuredIWbemServicesHandler(wbemServices).DeleteInstance_(this.path.RelativePath, deleteOption1.Flags, deleteOption1.GetContext(), IntPtr.Zero); } else { num = this.scope.GetSecuredIWbemServicesHandler(wbemServices).DeleteClass_(this.path.RelativePath, deleteOption1.Flags, deleteOption1.GetContext(), IntPtr.Zero); } if (num < 0) { if (((long)num & (long)-4096) != (long)-2147217408) { Marshal.ThrowExceptionForHR(num); } else { ManagementException.ThrowWithExtendedInfo((ManagementStatus)num); } } } finally { if (securityHandler != null) { securityHandler.Reset(); } } return; } }
/// <summary> /// <para>Deletes the object.</para> /// </summary> /// <param name='watcher'>The object that will receive the results of the operation.</param> /// <param name='options'>The options for how to delete the object.</param> public void Delete(ManagementOperationObserver watcher, DeleteOptions options) { if ((null == path) || (path.Path.Length==0)) throw new InvalidOperationException(); else if (null == watcher) throw new ArgumentNullException("watcher"); else { Initialize ( false ) ; DeleteOptions o = (null != options) ? (DeleteOptions) options.Clone() : new DeleteOptions(); // If someone has registered for progress, make sure we flag it if (watcher.HaveListenersForProgress) o.SendStatus = true; IWbemServices wbemServices = scope.GetIWbemServices(); WmiEventSink sink = watcher.GetNewSink(scope, o.Context); SecurityHandler securityHandler = null; int status = (int)ManagementStatus.NoError; securityHandler = scope.GetSecurityHandler(); if (IsClass) { status = scope.GetSecuredIWbemServicesHandler( wbemServices ).DeleteClassAsync_(path.RelativePath, o.Flags, o.GetContext(), sink.Stub); } else { status = scope.GetSecuredIWbemServicesHandler( wbemServices ).DeleteInstanceAsync_(path.RelativePath, o.Flags, o.GetContext(), sink.Stub); } if (securityHandler != null) securityHandler.Reset(); if (status < 0) { watcher.RemoveSink(sink); if ((status & 0xfffff000) == 0x80041000) ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); else Marshal.ThrowExceptionForHR(status); } } }
/// <summary> /// <para>Deletes the object.</para> /// </summary> /// <param name='options'>The options for how to delete the object. </param> public void Delete(DeleteOptions options) { if ((null == path) || (path.Path.Length==0)) throw new InvalidOperationException(); Initialize ( false ) ; DeleteOptions o = (null != options) ? options : new DeleteOptions(); IWbemServices wbemServices = scope.GetIWbemServices(); SecurityHandler securityHandler = null; int status = (int)ManagementStatus.NoError; try { securityHandler = scope.GetSecurityHandler(); if (IsClass) { status = scope.GetSecuredIWbemServicesHandler( wbemServices ).DeleteClass_( path.RelativePath, o.Flags, o.GetContext(), IntPtr.Zero); } else { status = scope.GetSecuredIWbemServicesHandler( wbemServices ).DeleteInstance_( path.RelativePath, o.Flags, o.GetContext(), IntPtr.Zero); } if (status < 0) { if ((status & 0xfffff000) == 0x80041000) ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); else Marshal.ThrowExceptionForHR(status); } } finally { if (securityHandler != null) securityHandler.Reset(); } }