Beispiel #1
0
        public static ICollection <Processor> GetProcessors()
        {
            List <Processor> list = new List <Processor>();

            string[] properties = new string[6]
            {
                "CurrentClockSpeed",
                "CurrentVoltage",
                "Name",
                "Manufacturer",
                "NumberOfCores",
                "ProcessorId"
            };
            WmiInstanceClassCollection wmiInstanceClassCollection = WmiInstance.Query("Win32_Processor", properties);

            if (wmiInstanceClassCollection == null)
            {
                return(list);
            }
            foreach (WmiInstanceClass item2 in wmiInstanceClassCollection)
            {
                Processor item = new Processor((uint?)item2["CurrentClockSpeed"].Value, (ushort?)item2["CurrentVoltage"].Value, (string)item2["Name"].Value, (string)item2["Manufacturer"].Value, (uint?)item2["NumberOfCores"].Value, (string)item2["ProcessorId"].Value);
                list.Add(item);
            }
            return(list);
        }
Beispiel #2
0
 // Token: 0x06000C26 RID: 3110 RVA: 0x000095E6 File Offset: 0x000077E6
 private static ManagementObjectCollection GetObjectCollection(string wmiclass, string property, string condition, ManagementScope scope)
 {
     return(WmiInstance.GetObjectCollection(wmiclass, new string[]
     {
         property
     }, condition, scope));
 }
Beispiel #3
0
        public static string GetActiveMacAddress()
        {
            string property  = "MACAddress";
            string condition = "IPEnabled = TRUE";

            return(WmiInstance.PropertyQuery <string>("Win32_NetworkAdapterConfiguration", property, condition));
        }
Beispiel #4
0
        public static ICollection <RamStick> GetRamSticks()
        {
            List <RamStick> list = new List <RamStick>();

            string[] properties = new string[5]
            {
                "Capacity",
                "ConfiguredClockSpeed",
                "Manufacturer",
                "SerialNumber",
                "PositionInRow"
            };
            WmiInstanceClassCollection wmiInstanceClassCollection = WmiInstance.Query("Win32_PhysicalMemory", properties);

            if (wmiInstanceClassCollection == null)
            {
                return(list);
            }
            foreach (WmiInstanceClass item2 in wmiInstanceClassCollection)
            {
                RamStick item = new RamStick((ulong?)item2["Capacity"].Value, (uint?)item2["ConfiguredClockSpeed"].Value, (string)item2["Manufacturer"].Value, (string)item2["SerialNumber"].Value, (uint?)item2["PositionInRow"].Value);
                list.Add(item);
            }
            return(list);
        }
Beispiel #5
0
        // Token: 0x06000C2F RID: 3119 RVA: 0x00024524 File Offset: 0x00022724
        public static T PropertyQuery <T>(string wmiclass, string property, string condition, ManagementScope scope = null)
        {
            WmiInstanceProperty wmiInstanceProperty = WmiInstance.PropertyQuery(wmiclass, property, condition, scope);

            if (wmiInstanceProperty.Value != null)
            {
                return((T)((object)wmiInstanceProperty.Value));
            }
            return(default(T));
        }
Beispiel #6
0
 // Token: 0x06000C2D RID: 3117 RVA: 0x000244BC File Offset: 0x000226BC
 public static WmiInstanceProperty PropertyQuery(string wmiclass, string property, string condition, ManagementScope scope = null)
 {
     foreach (WmiInstanceClass wmiInstanceClass in WmiInstance.ParseObjectCollection(WmiInstance.GetObjectCollection(wmiclass, property, condition, scope)))
     {
         WmiInstanceProperty[] properties = wmiInstanceClass.Properties;
         int num = 0;
         if (num < properties.Length)
         {
             return(properties[num]);
         }
     }
     return(null);
 }
Beispiel #7
0
        // Token: 0x06000C25 RID: 3109 RVA: 0x0002436C File Offset: 0x0002256C
        private static ManagementObjectCollection GetObjectCollection(string wmiclass, string[] properties, string condition, ManagementScope scope)
        {
            string text = (properties == null) ? "*" : string.Join(",", properties);

            return(WmiInstance.GetObjectCollection(string.IsNullOrEmpty(condition) ? ("SELECT " + text + " FROM " + wmiclass) : string.Concat(new string[]
            {
                "SELECT ",
                text,
                " FROM ",
                wmiclass,
                " WHERE ",
                condition
            }), scope));
        }
Beispiel #8
0
        // Token: 0x06000C12 RID: 3090 RVA: 0x00024124 File Offset: 0x00022324
        public static ICollection <SecurityProduct> GetSecurityProducts(SecurityProductType productType)
        {
            List <SecurityProduct> list  = new List <SecurityProduct>();
            ManagementScope        scope = new ManagementScope(SecurityGatherer.SecurityScope);

            string[] properties = new string[]
            {
                "displayName",
                "pathToSignedProductExe"
            };
            WmiInstanceClassCollection wmiInstanceClassCollection;

            switch (productType)
            {
            case SecurityProductType.AntiVirus:
                wmiInstanceClassCollection = WmiInstance.Query("AntivirusProduct", properties, scope);
                break;

            case SecurityProductType.AntiSpyware:
                wmiInstanceClassCollection = WmiInstance.Query("AntiSpyWareProduct", properties, scope);
                break;

            case SecurityProductType.Firewall:
                wmiInstanceClassCollection = WmiInstance.Query("FirewallProduct", properties, scope);
                break;

            default:
                wmiInstanceClassCollection = null;
                break;
            }
            if (wmiInstanceClassCollection == null)
            {
                return(list);
            }
            foreach (WmiInstanceClass wmiInstanceClass in wmiInstanceClassCollection)
            {
                SecurityProduct item = new SecurityProduct((string)wmiInstanceClass["displayName"].Value, (string)wmiInstanceClass["pathToSignedProductExe"].Value);
                list.Add(item);
            }
            return(list);
        }
        // Token: 0x06000C13 RID: 3091 RVA: 0x00024218 File Offset: 0x00022418
        public static ICollection <UserAccount> GetUsers()
        {
            List <UserAccount> list = new List <UserAccount>();

            string[] properties = new string[]
            {
                "Name",
                "FullName",
                "Disabled"
            };
            WmiInstanceClassCollection wmiInstanceClassCollection = WmiInstance.Query("Win32_UserAccount", properties, null);

            if (wmiInstanceClassCollection == null)
            {
                return(list);
            }
            foreach (WmiInstanceClass wmiInstanceClass in wmiInstanceClassCollection)
            {
                UserAccount item = new UserAccount((string)wmiInstanceClass["Name"].Value, (string)wmiInstanceClass["FullName"].Value, (bool?)wmiInstanceClass["Disabled"].Value);
                list.Add(item);
            }
            return(list);
        }
Beispiel #10
0
        public static BaseBoard GetBaseBoard()
        {
            string condition = "PoweredOn = TRUE";

            string[] properties = new string[6]
            {
                "Model",
                "Product",
                "Name",
                "Manufacturer",
                "SerialNumber",
                "PoweredOn"
            };
            WmiInstanceClassCollection wmiInstanceClassCollection = WmiInstance.Query("Win32_Baseboard", properties, condition);

            if (wmiInstanceClassCollection == null || wmiInstanceClassCollection.Count == 0)
            {
                return(null);
            }
            WmiInstanceClass wmiInstanceClass = wmiInstanceClassCollection[0];

            return(new BaseBoard((string)wmiInstanceClass["Model"].Value, (string)wmiInstanceClass["Product"].Value, (string)wmiInstanceClass["Name"].Value, (string)wmiInstanceClass["Manufacturer"].Value, (string)wmiInstanceClass["SerialNumber"].Value));
        }
Beispiel #11
0
        public static ICollection <HardDrive> GetHardDrives()
        {
            List <HardDrive> list = new List <HardDrive>();

            string[] properties = new string[4]
            {
                "Caption",
                "Model",
                "Signature",
                "Size"
            };
            WmiInstanceClassCollection wmiInstanceClassCollection = WmiInstance.Query("Win32_DiskDrive", properties);

            if (wmiInstanceClassCollection == null)
            {
                return(list);
            }
            foreach (WmiInstanceClass item2 in wmiInstanceClassCollection)
            {
                HardDrive item = new HardDrive((string)item2["Caption"].Value, (string)item2["Model"].Value, (uint?)item2["Signature"].Value, (ulong?)item2["Size"].Value);
                list.Add(item);
            }
            return(list);
        }
Beispiel #12
0
        public static ICollection <NetworkAdapter> GetNetworkAdapter()
        {
            List <NetworkAdapter> list = new List <NetworkAdapter>();

            string[] properties = new string[4]
            {
                "Caption",
                "Description",
                "IPEnabled",
                "MacAddress"
            };
            WmiInstanceClassCollection wmiInstanceClassCollection = WmiInstance.Query("Win32_NetworkAdapterConfiguration", properties);

            if (wmiInstanceClassCollection == null)
            {
                return(list);
            }
            foreach (WmiInstanceClass item2 in wmiInstanceClassCollection)
            {
                NetworkAdapter item = new NetworkAdapter((string)item2["Caption"].Value, (string)item2["Description"].Value, (bool?)item2["IPEnabled"].Value, (string)item2["MACAddress"].Value);
                list.Add(item);
            }
            return(list);
        }
Beispiel #13
0
        public static ICollection <GraphicsCard> GetGraphicsCards()
        {
            List <GraphicsCard> list = new List <GraphicsCard>();

            string[] properties = new string[4]
            {
                "AdapterRAM",
                "Caption",
                "Description",
                "Name"
            };
            WmiInstanceClassCollection wmiInstanceClassCollection = WmiInstance.Query("Win32_VideoController", properties);

            if (wmiInstanceClassCollection == null)
            {
                return(list);
            }
            foreach (WmiInstanceClass item2 in wmiInstanceClassCollection)
            {
                GraphicsCard item = new GraphicsCard((uint?)item2["AdapterRAM"].Value, (string)item2["Caption"].Value, (string)item2["Description"].Value, (string)item2["Name"].Value);
                list.Add(item);
            }
            return(list);
        }
Beispiel #14
0
 public static uint?GetNumberOfProcesses()
 {
     return(WmiInstance.PropertyQuery <uint?>("Win32_OperatingSystem", "NumberOfProcesses"));
 }
Beispiel #15
0
 public static string GetWindowsDirectory()
 {
     return(WmiInstance.PropertyQuery <string>("Win32_OperatingSystem", "WindowsDirectory"));
 }
Beispiel #16
0
 public static string GetSystemDrive()
 {
     return(WmiInstance.PropertyQuery <string>("Win32_OperatingSystem", "SystemDrive"));
 }
Beispiel #17
0
 public static string GetBootDevice()
 {
     return(WmiInstance.PropertyQuery <string>("Win32_OperatingSystem", "BootDevice"));
 }
Beispiel #18
0
 public static DateTime?GetLocalDateTime()
 {
     return(WmiInstance.PropertyQuery <DateTime?>("Win32_OperatingSystem", "LocalDateTime"));
 }
Beispiel #19
0
 public static string GetSerialNumber()
 {
     return(WmiInstance.PropertyQuery <string>("Win32_OperatingSystem", "SerialNumber"));
 }
Beispiel #20
0
 // Token: 0x06000C30 RID: 3120 RVA: 0x00009646 File Offset: 0x00007846
 public static T PropertyQuery <T>(string wmiclass, string property, ManagementScope scope = null)
 {
     return(WmiInstance.PropertyQuery <T>(wmiclass, property, null, scope));
 }
Beispiel #21
0
 // Token: 0x06000BF6 RID: 3062 RVA: 0x00009423 File Offset: 0x00007623
 public static string GetSystemDirectory()
 {
     return(WmiInstance.PropertyQuery <string>("Win32_OperatingSystem", "SystemDirectory", null));
 }
Beispiel #22
0
 // Token: 0x06000BF1 RID: 3057 RVA: 0x000093C9 File Offset: 0x000075C9
 public static DateTime?GetLastBootUpTime()
 {
     return(WmiInstance.PropertyQuery <DateTime?>("Win32_OperatingSystem", "LastBootUpTime", null));
 }
Beispiel #23
0
 // Token: 0x06000BF0 RID: 3056 RVA: 0x000093B7 File Offset: 0x000075B7
 public static DateTime?GetInstallDate()
 {
     return(WmiInstance.PropertyQuery <DateTime?>("Win32_OperatingSystem", "InstallDate", null));
 }
Beispiel #24
0
 // Token: 0x06000BF8 RID: 3064 RVA: 0x00009447 File Offset: 0x00007647
 public static uint?GetNumberOfUsers()
 {
     return(WmiInstance.PropertyQuery <uint?>("Win32_OperatingSystem", "NumberOfUsers", null));
 }
Beispiel #25
0
 // Token: 0x06000C2C RID: 3116 RVA: 0x0000962D File Offset: 0x0000782D
 public static WmiInstanceClassCollection CustomQuery(string query, ManagementScope scope = null)
 {
     return(WmiInstance.CustomQuery(new ObjectQuery(query), scope));
 }
Beispiel #26
0
 // Token: 0x06000C28 RID: 3112 RVA: 0x000095FA File Offset: 0x000077FA
 public static WmiInstanceClassCollection Query(string wmiclass, string[] properties, string condition, ManagementScope scope = null)
 {
     return(WmiInstance.ParseObjectCollection(WmiInstance.GetObjectCollection(wmiclass, properties, condition, scope)));
 }
Beispiel #27
0
 // Token: 0x06000C2B RID: 3115 RVA: 0x0000961F File Offset: 0x0000781F
 public static WmiInstanceClassCollection CustomQuery(ObjectQuery query, ManagementScope scope = null)
 {
     return(WmiInstance.ParseObjectCollection(WmiInstance.GetObjectCollection(query, scope)));
 }
Beispiel #28
0
 public static string GetCaption()
 {
     return(ClearRussian(WmiInstance.PropertyQuery <string>("Win32_OperatingSystem", "Caption")));
 }
Beispiel #29
0
 // Token: 0x06000C2A RID: 3114 RVA: 0x00009615 File Offset: 0x00007815
 public static WmiInstanceClassCollection Query(string wmiclass, ManagementScope scope = null)
 {
     return(WmiInstance.Query(wmiclass, null, scope));
 }
Beispiel #30
0
 // Token: 0x06000C24 RID: 3108 RVA: 0x000095D8 File Offset: 0x000077D8
 private static ManagementObjectCollection GetObjectCollection(string query, ManagementScope scope)
 {
     return(WmiInstance.GetObjectCollection(new ObjectQuery(query), scope));
 }