BOOL CSysInfo::getMemory( ULONG *m_ulPhysicalMemory, ULONG *m_ulSwapSize) { CMemory memoryInfo; ULONGLONG ulTotalRAM, ulTotalSwap; AddLog( _T( "getMemory...\n")); ulTotalRAM = memoryInfo.getTotalRAM() / ONE_MEGABYTE; *m_ulPhysicalMemory = (ULONG) ulTotalRAM; ulTotalSwap = memoryInfo.getTotalPageFile() / ONE_MEGABYTE; *m_ulSwapSize = (ULONG) ulTotalSwap; AddLog( _T( "\t\t<Physical: %I64u bytes><Swap: %I64u bytes>\n\tOK\n"), memoryInfo.getTotalRAM(), memoryInfo.getTotalPageFile()); return TRUE; }
BOOL CSysInfo::getMemorySlots( CMemorySlotList *pMyList) { CMemory memoryInfo; ULONGLONG ulTotalSlot, ulTotalRAM; // First, try SMBios/DMI if (m_dmiInfo.GetMemorySlots( pMyList)) { ulTotalSlot = pMyList->GetTotalMemory(); ulTotalRAM = memoryInfo.getTotalRAM() / ONE_MEGABYTE; // 32 bits Windows OS can only use 3235 MB max if ((getAddressWidthOS() < 64) && (ulTotalSlot > 3235)) // More than 3 GB memory on 32 bits OS, so assume result is OK return TRUE; // 64 bits OS od less than 3 GB on 32 bits OS // Try to check if part of memory is used by video, either less than 128 MB or less than 15% if (((ulTotalSlot - ulTotalRAM) < 128) || ((ulTotalSlot - ulTotalRAM) < (ulTotalRAM/15))) // DMI query seems OK return TRUE; } // Last try WMI return m_wmiInfo.GetMemorySlots( pMyList); }