[*] Windows 7 and predecessors: AuHwInfo memory usage queries seem... off
This commit is contained in:
parent
c85d65aa59
commit
262d76ddee
@ -36,12 +36,38 @@ namespace Aurora::HWInfo
|
||||
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
|
||||
PROCESS_MEMORY_COUNTERS_EX pmc;
|
||||
PROCESS_MEMORY_COUNTERS pm;
|
||||
|
||||
if (pGetProcessMemoryInfo)
|
||||
{
|
||||
if (pGetProcessMemoryInfo(GetCurrentProcess(),
|
||||
reinterpret_cast<PPROCESS_MEMORY_COUNTERS>(&pmc),
|
||||
sizeof(PROCESS_MEMORY_COUNTERS_EX)))
|
||||
{
|
||||
if (pm.PagefileUsage)
|
||||
{
|
||||
return RamStat { pmc.PagefileUsage, max };
|
||||
}
|
||||
else
|
||||
{
|
||||
return RamStat { pmc.PrivateUsage, max };
|
||||
}
|
||||
}
|
||||
|
||||
if (pGetProcessMemoryInfo(GetCurrentProcess(),
|
||||
reinterpret_cast<PPROCESS_MEMORY_COUNTERS>(&pm),
|
||||
sizeof(PROCESS_MEMORY_COUNTERS)))
|
||||
{
|
||||
return RamStat {pm.WorkingSetSize, max};
|
||||
if (pm.PagefileUsage)
|
||||
{
|
||||
return RamStat { pm.PagefileUsage, max };
|
||||
}
|
||||
else
|
||||
{
|
||||
return RamStat { pm.WorkingSetSize, max };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RamStat {0, max};
|
||||
@ -97,10 +123,13 @@ namespace Aurora::HWInfo
|
||||
ULONGLONG SharedCommitUsage;
|
||||
} vm;
|
||||
|
||||
|
||||
static const PROCESSINFOCLASS kProcessVmCounters = static_cast<PROCESSINFOCLASS>(3);
|
||||
|
||||
if (pNtQueryInformationProcess(GetCurrentProcess(), kProcessVmCounters, &vm, sizeof(vm), 0))
|
||||
if (pNtQueryInformationProcess(GetCurrentProcess(),
|
||||
kProcessVmCounters,
|
||||
&vm,
|
||||
sizeof(vm),
|
||||
0))
|
||||
{
|
||||
// I WILL NOT USE A BLOATED OS THAT LIES TO US
|
||||
// I WILL NOT USE A BLOATED OS THAT LIES TO US
|
||||
@ -113,25 +142,13 @@ namespace Aurora::HWInfo
|
||||
}
|
||||
#endif
|
||||
|
||||
PROCESS_MEMORY_COUNTERS_EX pmc;
|
||||
PROCESS_MEMORY_COUNTERS pm;
|
||||
|
||||
if (pGetProcessMemoryInfo)
|
||||
{
|
||||
if (pGetProcessMemoryInfo(GetCurrentProcess(),
|
||||
reinterpret_cast<PPROCESS_MEMORY_COUNTERS>(&pmc),
|
||||
sizeof(PROCESS_MEMORY_COUNTERS_EX)))
|
||||
{
|
||||
return RamStat { pmc.PrivateUsage, max };
|
||||
}
|
||||
|
||||
if (pGetProcessMemoryInfo(GetCurrentProcess(),
|
||||
reinterpret_cast<PPROCESS_MEMORY_COUNTERS>(&pm),
|
||||
sizeof(PROCESS_MEMORY_COUNTERS)))
|
||||
{
|
||||
return RamStat { pm.WorkingSetSize, max };
|
||||
}
|
||||
}
|
||||
|
||||
return RamStat {};
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user