Expand Minimize

GetPhysicallyInstalledSystemMemory function

Retrieves the amount of RAM that is physically installed on the computer.

Syntax


BOOL WINAPI GetPhysicallyInstalledSystemMemory(
  _Out_  PULONGLONG TotalMemoryInKilobytes
);

Parameters

TotalMemoryInKilobytes [out]

A pointer to a variable that receives the amount of physically installed RAM, in kilobytes.

Return value

If the function succeeds, it returns TRUE and sets the TotalMemoryInKilobytes parameter to a nonzero value.

If the function fails, it returns FALSE and does not modify the TotalMemoryInKilobytes parameter. To get extended error information, use the GetLastError function. Common errors are listed in the following table.

Return codeDescription
ERROR_INVALID_PARAMETER

The TotalMemoryInKilobytes parameter is NULL.

ERROR_INVALID_DATA

The System Management BIOS (SMBIOS) data is malformed.

 

Remarks

The GetPhysicallyInstalledSystemMemory function retrieves the amount of physically installed RAM from the computer's SMBIOS firmware tables. This can differ from the amount reported by the GlobalMemoryStatusEx function, which sets the ullTotalPhys member of the MEMORYSTATUSEX structure to the amount of physical memory that is available for the operating system to use. The amount of memory available to the operating system can be less than the amount of memory physically installed in the computer because the BIOS and some drivers may reserve memory as I/O regions for memory-mapped devices, making the memory unavailable to the operating system and applications.

The amount of physical memory retrieved by the GetPhysicallyInstalledSystemMemory function must be equal to or greater than the amount reported by the GlobalMemoryStatusEx function; if it is less, the SMBIOS data is malformed and the function fails with ERROR_INVALID_DATA. Malformed SMBIOS data may indicate a problem with the user's computer.

Requirements

Minimum supported client

Windows Vista with SP1 [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

EnumSystemFirmwareTables
GetSystemFirmwareTable
GlobalMemoryStatusEx

 

 

Community Additions

ADD
Show:
© 2014 Microsoft