How to query Adapter RAM for cards with more than 4 GB (C++)

I’m currently using WMI and Win32_VideoController to gather info about a machines video card.(Win32_VideoController class - Win32 apps | Microsoft Docs)

It works well except the reported RAM maxes out at 4GB even with the variable is 64-bits wide. When running on a RTX 2070 it reports 4GB instead of 8 GB.


IWbemClassObject* pObj;

pObj->Get(L"AdapterRAM", 0, &var, NULL, NULL);
printf(“Adapter RAM: %I64u”, var.llVal);

Prints: “Adapter RAM: 4293918720”

You can also easily repro with a standard windows command prompt:

wmic PATH Win32_videocontroller GET adapterRAM

When I run DXDiag.exe it shows the proper 8GB. How can I access the correct gpu adapter RAM info?

Anyone have a solution for that ?


Data type: uint32

Access type: Read-only

Qualifiers: MappingStrings (“Win32Registry|HardwareInformation.MemorySize”), Units (“bytes”)

Memory size of the video adapter.

Example: 64000

Thank for the answer but that is the cut and paste from the class definition from Microsoft web site, That not really help us because the value stored in that class propriety can’t contain numeral value more the 4 GB then for all card who have more than 4gb we can’t base on that wmi class for any inventory or report.

The question of tylerrobertsondevelop and me is more how to have the real information of Vram in a wmi. because the Win32_videocontroller don’t give correct information for a card over 4gb