public override void Uninstall(IDictionary savedState) { try { ManagementClass MC = new ManagementClass(@"root\cimv2:Win32_Evil"); MC.Delete(); } catch { } try { base.Uninstall(savedState); } catch { } }
public override void Uninstall(IDictionary savedState) { try { new System.EnterpriseServices.Internal.Publish().GacRemove("WMIKatz.dll"); ManagementClass MC = new ManagementClass(@"root\cimv2:Win32_WMIKatz"); MC.Delete(); } catch { } try { base.Uninstall(savedState); } catch { } }
public void RegisterNonAssemblySpecificSchema(InstallContext installContext) { SecurityHelper.UnmanagedCode.Demand(); WmiNetUtilsHelper.VerifyClientKey_f(); SchemaNaming.InstallLogWrapper installLogWrapper = new SchemaNaming.InstallLogWrapper(installContext); SchemaNaming.EnsureNamespace(installLogWrapper, this.GlobalRegistrationNamespace); SchemaNaming.EnsureClassExists(installLogWrapper, this.GlobalInstrumentationClassPath, new SchemaNaming.ClassMaker(this.MakeGlobalInstrumentationClass)); SchemaNaming.EnsureClassExists(installLogWrapper, this.GlobalRegistrationClassPath, new SchemaNaming.ClassMaker(this.MakeNamespaceRegistrationClass)); SchemaNaming.EnsureClassExists(installLogWrapper, this.GlobalNamingClassPath, new SchemaNaming.ClassMaker(this.MakeNamingClass)); SchemaNaming.EnsureNamespace(installLogWrapper, this.NamespaceName); SchemaNaming.EnsureClassExists(installLogWrapper, this.InstrumentationClassPath, new SchemaNaming.ClassMaker(this.MakeInstrumentationClass)); SchemaNaming.EnsureClassExists(installLogWrapper, this.RegistrationClassPath, new SchemaNaming.ClassMaker(this.MakeRegistrationClass)); try { ManagementClass managementClass = new ManagementClass(this.DecoupledProviderClassPath); if (managementClass["HostingModel"].ToString() != "Decoupled:Com") { managementClass.Delete(); } } catch (ManagementException managementException1) { ManagementException managementException = managementException1; if (managementException.ErrorCode != ManagementStatus.NotFound) { throw managementException; } } SchemaNaming.EnsureClassExists(installLogWrapper, this.DecoupledProviderClassPath, new SchemaNaming.ClassMaker(this.MakeDecoupledProviderClass)); SchemaNaming.EnsureClassExists(installLogWrapper, this.ProviderClassPath, new SchemaNaming.ClassMaker(this.MakeProviderClass)); if (!SchemaNaming.DoesInstanceExist(this.GlobalRegistrationPath)) { this.RegisterNamespaceAsInstrumented(); } }
public void RegisterNonAssemblySpecificSchema(InstallContext installContext) { SecurityHelper.UnmanagedCode.Demand(); // Bug#112640 - Close off any potential use from anything but fully trusted code // Make sure the 'Client' key has the correct permissions WmiNetUtilsHelper.VerifyClientKey_f(); InstallLogWrapper context = new InstallLogWrapper(installContext); EnsureNamespace(context, GlobalRegistrationNamespace); EnsureClassExists(context, GlobalInstrumentationClassPath, new ClassMaker(MakeGlobalInstrumentationClass)); EnsureClassExists(context, GlobalRegistrationClassPath, new ClassMaker(MakeNamespaceRegistrationClass)); EnsureClassExists(context, GlobalNamingClassPath, new ClassMaker(MakeNamingClass)); EnsureNamespace(context, NamespaceName); EnsureClassExists(context, InstrumentationClassPath, new ClassMaker(MakeInstrumentationClass)); EnsureClassExists(context, RegistrationClassPath, new ClassMaker(MakeRegistrationClass)); // Make sure Hosting model is set correctly by default. If not, we blow away the class definition try { ManagementClass cls = new ManagementClass(DecoupledProviderClassPath); if(cls["HostingModel"].ToString() != "Decoupled:Com") { cls.Delete(); } } catch(ManagementException e) { if(e.ErrorCode != ManagementStatus.NotFound) throw e; } EnsureClassExists(context, DecoupledProviderClassPath, new ClassMaker(MakeDecoupledProviderClass)); EnsureClassExists(context, ProviderClassPath, new ClassMaker(MakeProviderClass)); if(!DoesInstanceExist(GlobalRegistrationPath)) RegisterNamespaceAsInstrumented(); }