简体   繁体   中英

How I can determine physical RAM installed on computer? (windows)

How I can get physical ram installed to my computer using c++ in Windows? I mean not only capacity parametrs which can GlobalMemoryStatusEx() , but also number of used memory slots, type of memory (like DDR1/DDR2/DDR3), type of slot (DIMM/SO-DIMM) and clock rate of memory bus. Am I need to use SMBIOS? Or have been any another way to get this info?

On my machine, most of the information you request is available through WMI. Take a look at the Win32_PhysicalMemory and related classes.

For example, the output of wmic memorychip on my machine is:

C:\>wmic memorychip
Attributes  BankLabel  Capacity     Caption          ConfiguredClockSpeed  ConfiguredVoltage  CreationClassName     DataWidth  Description      DeviceLocator   FormFactor  HotSwappable  InstallDate  InterleaveDataDepth  InterleavePosition  Manufacturer  MaxVoltage  MemoryType  MinVoltage  Model  Name             OtherIdentifyingInfo  PartNumber        PositionInRow  PoweredOn  Removable  Replaceable  SerialNumber  SKU  SMBIOSMemoryType  Speed  Status  Tag                TotalWidth  TypeDetail  Version
2           BANK 0     17179869184  Physical Memory  2133                  1200               Win32_PhysicalMemory  64         Physical Memory  ChannelA-DIMM0  12                                                                              Samsung       0           0           0                  Physical Memory                        M471A2K43BB1-CPB                                                    15741117           26                2133           Physical Memory 0  64          128
2           BANK 2     17179869184  Physical Memory  2133                  1200               Win32_PhysicalMemory  64         Physical Memory  ChannelB-DIMM0  12                                                                              Samsung       0           0           0                  Physical Memory                        M471A2K43BB1-CPB                                                    21251413           26                2133           Physical Memory 2  64          128

As noted in the link above, FormFactor 12 is SODIMM.

Notably missing are the voltages (which you didn't ask for, but are usually of interest) and the MemoryType , the documentation of which is outdated on MSDN, while the recent SMBIOS docs from DMTF include values in the enum for DDR4. etc.

Therefore, you would probably have to resort to looking at the SMBIOS tables more or less by hand. See: How to get memory information (RAM type, eg DDR,DDR2,DDR3?) with WMI/C++

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