views:

614

answers:

4

I know that it is possible to check how much physical RAM is installed using GetPhysicallyInstalledSystemMemory or how much ram the operating system can see using GlobalMemoryStatusEx. However, I am wondering if there is any way to check how much ram a user has installed by slot. That is, to be able to programmatically tell the difference between 1x2GB of ram and 2x1GB of ram, thus checking if the computer can be upgraded easily via software. Ideally, a way to check this without .Net.

A: 

Reviewing the MSDN docs for the functions listed here, I see that the function checks with the SMBIOS table, which is referenced by a standard here It appears that you indeed can find the information you seek through the BIOS. You may have to install a driver to get that information out to your program.

Good luck!

Paul Nathan
+1  A: 

Use WMI to look at Win32_PhysicalMemory. Look at the Capacity and Bank Label properties.

UPDATED: You do not need .NET for this. See Creating a WMI Application Using C++.aspx) for examples in C++

dpp
The above properties and others look to be exactly the things CPU-Z [http://www.cpuid.com/cpuz.php] would use. CPU-Z can do exactly the sort of things you're after.
Kevin Haines
I suspected WMI could do this, but I am pretty sure WMI requires .net.
Brian
bk1e
WMI does not require .NET (although it's easier with it)
dpp
A: 

On Linux, I can almost always find that information with dmidecode, which parses the DMI tables from the BIOS. It shows all the memory slots and what is on each one, together with other interesting information. I don't know how to get the DMI data on Windows, however.

CesarB
A: 

You don't need WMI (always avoid WMI (slow)), neither any driver (of course) Use standard Win32 SMB apis