lfreist / hwinfo

cross platform C++ library for hardware information (CPU, RAM, GPU, ...)
MIT License
438 stars 76 forks source link

Fixed bugs with WMI output and code refactor #15

Closed GermanAizek closed 2 years ago

GermanAizek commented 2 years ago

instance of Win32_PnPEntity { Caption = "Intel(R) HD Graphics 4600"; ClassGuid = "{4d36e968-e325-11ce-bfc1-08002be10318}"; CompatibleID = {"PCI\VEN_8086&DEV_0412&REV_06", "PCI\VEN_8086&DEV_0412", "PCI\VEN_8086&CC_030000", "PCI\VEN_8086&CC_0300", "PCI\VEN_8086", "PCI\CC_030000", "PCI\CC_0300"}; ConfigManagerErrorCode = 0; ConfigManagerUserConfig = FALSE; CreationClassName = "Win32_PnPEntity"; Description = "Intel(R) HD Graphics 4600"; DeviceID = "PCI\VEN_8086&DEV_0412&SUBSYS_18E5103C&REV_06\3&11583659&0&10"; HardwareID = {"PCI\VEN_8086&DEV_0412&SUBSYS_18E5103C&REV_06", "PCI\VEN_8086&DEV_0412&SUBSYS_18E5103C", "PCI\VEN_8086&DEV_0412&CC_030000", "PCI\VEN_8086&DEV_0412&CC_0300"}; Manufacturer = "Intel Corporation"; Name = "Intel(R) HD Graphics 4600"; PNPClass = "Display"; PNPDeviceID = "PCI\VEN_8086&DEV_0412&SUBSYS_18E5103C&REV_06\3&11583659&0&10"; Present = TRUE; Service = "igfx"; Status = "OK"; SystemCreationClassName = "Win32_ComputerSystem"; SystemName = "-------"; };


- Fixed CPU CurrentClockSpeed
- Fixed might be dereferencing of a potential null pointer 'pEnumerator'
- Removed unused vars
- Optimize more efficient to use an initialization list in constuctors
- Fixed `numCores > 0` always true

   `regs_4[2]` will never be negative, and other `int` values are always positive

   Example:

int numCores = (int) + (uint32_t && int)

GermanAizek commented 2 years ago

@lfreist fix it https://github.com/lfreist/hwinfo/pull/15/commits/0f848768601cc20b6710f207b04575e3cb88b43b