32 位 OS 上的 RAM 检测问题
RAM detection issue on 32-bit OS
我想使用 GetPhysicallyInstalledSystemMemory
函数检测内存,问题是,它只能在 64 位 OS 上正确显示 RAM
。在 32 位 OS 上,我得到了错误的值。例如下图:
在虚拟机 (Windows Vista SP2 x32) 上:
代码:
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
}
为什么它在 32 位 OS 上不起作用?谢谢。
我已经安装了 Windows 7 x32 并进行了测试。现在这些值是正确的。所以 bug 与 VMware Workstation 有关。稍后我会报告给VMware。感谢大家的帮助。
我想使用 GetPhysicallyInstalledSystemMemory
函数检测内存,问题是,它只能在 64 位 OS 上正确显示 RAM
。在 32 位 OS 上,我得到了错误的值。例如下图:
在虚拟机 (Windows Vista SP2 x32) 上:
代码:
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
}
为什么它在 32 位 OS 上不起作用?谢谢。
我已经安装了 Windows 7 x32 并进行了测试。现在这些值是正确的。所以 bug 与 VMware Workstation 有关。稍后我会报告给VMware。感谢大家的帮助。