Skip to content
⌘ NSIS Forum Archive

HwInfo.dll inaccurate API used

1 posts

kalverson#

HwInfo.dll inaccurate API used

The author of this plugin should consider using the following replacement API (GlobalMemoryStatusEx instead of GlobalMemoryStatus) that is more accurate on larger installed memory. MSDN points this out and I have found it to be very true.👍

void CHardwareInfo::GetTotalSystemMemory( int &sysMem )
{
MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex);
sysMem = (int)( ceil( statex.ullTotalPhys / 1048576.f ) );
}