Issue with graphics card memory detection

Hi! I want to detect video memory using NvAPI. The problem is that dedicatedVideoMemory always displays 0, but it should display 4096 MB.

Screenshot (NVIDIA Control Panel):
https://i.stack.imgur.com/BIWAK.png

Code:

NvAPI_Status result;
result = NvAPI_Initialize();

if (result != NVAPI_OK) {
    NvAPI_ShortString string;
    NvAPI_GetErrorMessage(result, string);
    printf("NVAPI NvAPI_Initialize: %s\n", string);
}

NvU32 cnt;
NvPhysicalGpuHandle phys;
result = NvAPI_EnumPhysicalGPUs(&phys, &cnt);

if (result != NVAPI_OK) {
    NvAPI_ShortString string;
    NvAPI_GetErrorMessage(result, string);
    printf("NVAPI NvAPI_EnumPhysicalGPUs: %s\n", string);
}

NV_DISPLAY_DRIVER_MEMORY_INFO nvidiaDisplayDriverMemory;
NvAPI_GPU_GetMemoryInfo(phys, &nvidiaDisplayDriverMemory);

qDebug() << nvidiaDisplayDriverMemory.dedicatedVideoMemory;
NvAPI_Unload();

How to fix this problem? Thanks in advance.