Skip to content

Commit

Permalink
Merge pull request #68 from CherryPill/v1.4
Browse files Browse the repository at this point in the history
V1.4
  • Loading branch information
CherryPill authored Feb 11, 2020
2 parents f93afdc + 2602104 commit 6bc13a6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 23 deletions.
8 changes: 0 additions & 8 deletions SystemInfo/core/SystemInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,3 @@ void SystemInfo::setSnapshotGenDateTime(wstring snapshotGenDateTime) {
wstring SystemInfo::getSnapshotGenDateTime(void) {
return (*this).snapshotGenDateTime;
}

wstring SystemInfo::getComputerType() {
return (*this).computerType;
}

void SystemInfo::setComputerType(wstring computerType) {
(*this).computerType = computerType;
}
3 changes: 0 additions & 3 deletions SystemInfo/core/SystemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class SystemInfo {
this->uptime = L"Uptime not set";
}
wstring BIOS;
wstring computerType;
wstring OS;
wstring CPU;
wstring MB;
Expand Down Expand Up @@ -57,7 +56,6 @@ class SystemInfo {
}
wstring getOS(void);
wstring getSnapshotGenDateTime();
wstring getComputerType();
void setBIOS(wstring bios);
void setUptime(wstring uptime);
void setCPU(wstring CPU);
Expand All @@ -72,5 +70,4 @@ class SystemInfo {
void setAudio(wstring audio);
void addCDROMDevice(wstring CDROM);
void setSnapshotGenDateTime(wstring dt);
void setComputerType(wstring computerType);
};
20 changes: 11 additions & 9 deletions SystemInfo/core/sysinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,9 @@ int fillSystemInformation(SystemInfo *localMachine) {
//use the IWbemServices pointer to make requests of WMI

//temp
fillCPUTemp(localMachine, hres, pSvc, pLoc);
//fillCPUTemp(localMachine, hres, pSvc, pLoc);
//hardware
fillBIOS(localMachine);
fillComputerType(localMachine);
for (int x = 0; x < sizeof(fillInfoFuncs) / sizeof(fillInfoFuncs[0]); x++) {
(*fillInfoFuncs[x])(localMachine, hres, pSvc, pLoc);
}
Expand Down Expand Up @@ -173,6 +172,8 @@ void fillCPU(SystemInfo *localMachine,
processor = vtProp.bstrVal;
trimNullTerminator(processor);
trimWhiteSpace(processor);
removeTabulation(processor);
condenseSpaces(processor);
if (processor.find(L"@", 0) == string::npos) {
hr = pclsObj->Get(queryAttrs.at((int)WMI_CPU::MAXCLOCK), 0, &vtProp, 0, 0);
maxClockInMhZ = vtProp.uintVal;
Expand Down Expand Up @@ -461,8 +462,8 @@ void fillDimensionsAndFrequency(HRESULT hres,


void fillStorage(SystemInfo *localMachine,
HRESULT hres, IWbemServices *pSvc,
IWbemLocator *pLoc) {
HRESULT hres, IWbemServices *pSvc,
IWbemLocator *pLoc) {
vector<LPCWSTR> queryAttrs = wmiClassStringsMap.at(L"Win32_DiskDrive");

IEnumWbemClassObject* pEnumerator =
Expand Down Expand Up @@ -614,6 +615,7 @@ void fillBIOS(SystemInfo *localMachine) {
} else {
MessageBox(NULL, _T("Memory allocation failed"), _T("Fatal Error"), MB_OK);
}
_tcscat(biosData, (wchar_t*)getComputerType().c_str());
localMachine->setBIOS(biosData);
}

Expand All @@ -624,7 +626,7 @@ void fillCPUTemp(SystemInfo *localMachine,
}

wstring getSocket(HRESULT hres, IWbemServices *pSvc,
IWbemLocator *pLoc) {
IWbemLocator *pLoc) {
wstring socket;
IEnumWbemClassObject* pEnumerator = NULL;
pEnumerator = executeWQLQuery(hres, pLoc, pSvc, bstr_t("SELECT * FROM Win32_Processor"));
Expand Down Expand Up @@ -824,13 +826,13 @@ bstr_t buildQueryString(const wchar_t *wmiClass, vector<LPCWSTR> attrs) {
return bstr_t(queryString);
}

void fillComputerType(SystemInfo *localMachine) {
wstring getComputerType() {
SYSTEM_POWER_CAPABILITIES systemPowerCapabilities;
ZeroMemory(&systemPowerCapabilities, sizeof(systemPowerCapabilities));
GetPwrCapabilities(&systemPowerCapabilities);
systemPowerCapabilities.LidPresent
return systemPowerCapabilities.LidPresent
?
localMachine->setComputerType(PCType[0])
PCType[0]
:
localMachine->setComputerType(PCType[1]);
PCType[1];
}
2 changes: 1 addition & 1 deletion SystemInfo/core/sysinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
int test();
void fillCPUTemp(SystemInfo *localMachine, HRESULT hres, IWbemServices *pSvc, IWbemLocator *pLoc);
//hardware
void fillComputerType(SystemInfo *localMachine);
wstring getComputerType(void);
void fillBIOS(SystemInfo *localMachine);
void fillOS(SystemInfo *localMachine, HRESULT hres, IWbemServices *pSvc, IWbemLocator *pLoc);
void fillCPU(SystemInfo *localMachine, HRESULT hres, IWbemServices *pSvc, IWbemLocator *pLoc);
Expand Down
3 changes: 1 addition & 2 deletions SystemInfo/mainWindowProcedure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ void createHardwareInfoHolders(HWND parent, SystemInfo *info, int offsetIndex) {
void populateInfoHolders(SystemInfo *currentMachineInfo, HWND mainWindowHwnd) {
TCHAR biosInfo[256] = { 0 };
_tcscat(biosInfo, currentMachineInfo->getBIOS().c_str());
_tcscat(biosInfo, currentMachineInfo->getComputerType().c_str());


SetWindowText(GetDlgItem(mainWindowHwnd, BIOS_INFO),
biosInfo);
SetWindowText(GetDlgItem(mainWindowHwnd, OS_INFO),
Expand Down

0 comments on commit 6bc13a6

Please sign in to comment.