简体   繁体   中英

RAM detection issue on 32-bit OS

I want to detect memory using GetPhysicallyInstalledSystemMemory function, the problem is, it only displays RAM correctly on 64-bit OS. On 32-bit OS I get wrong values. For example like in the picture below:

On Virtual machine (Windows Vista SP2 x32):

在此处输入图片说明

Code:

ULONGLONG ramSize;
BOOL result = GetPhysicallyInstalledSystemMemory(&ramSize);

if (result == TRUE) {
    QString ramMB = QString::number(ramSize / (1024.0));
    QString ramGB = QString::number(ceil(ramSize / (1024.0 * 1024.0)));
    QMessageBox::information(this, "Test_MB", ramMB.append(" MB")); // RAM in MB
    QMessageBox::information(this, "Test_GB", ramGB.append(" GB")); // RAM in GB
}

Why it doesn't work on 32-bit OS? Thanks.

I have installed Windows 7 x32 and test it. Now the values are correct. So the bug is with VMware Workstation. I will report it to VMware later. Thanks all for help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM