网站建设资讯

NEWS

网站建设资讯

【API】获取系统内存所有状态

    SYSTEM_INFO sysInfo = {0};

    GetSystemInfo(&sysInfo);

    DWORD dwMinAddr = (DWORD)sysInfo.lpMinimumApplicationAddress;
    DWORD dwMaxAddr = (DWORD)sysInfo.lpMaximumApplicationAddress;

    MEMORY_BASIC_INFORMATION memBase;
    int i = 0;

    for (dwMinAddr; dwMinAddr < dwMaxAddr;)
    {
        if (VirtualQuery((LPVOID)dwMinAddr, &memBase, sizeof(memBase)) == sizeof(memBase))
        {
            wprintf(_T("%d %x %x %d\r\n"),i ++,memBase.BaseAddress, memBase.RegionSize,memBase.AllocationProtect);
        }
        dwMinAddr += memBase.RegionSize;
    }

typedef struct _MEMORY_BASIC_INFORMATION 
{ 
    PVOID BaseAddress; 
    PVOID AllocationBase; 
    DWORD AllocationProtect; 
    DWORD RegionSize; 
    DWORD State; 
    DWORD Protect; 
    DWORD Type; 
} MEMORY_BASIC_INFORMATION;

【API】获取系统内存所有状态

创新互联致力于互联网网站建设与网站营销,提供成都做网站、成都网站建设、网站开发、seo优化、网站排名、互联网营销、微信小程序、公众号商城、等建站开发,创新互联网站建设策划专家,为不同类型的客户提供良好的互联网应用定制解决方案,帮助客户在新的全球化互联网环境中保持优势。


本文名称:【API】获取系统内存所有状态
链接分享:http://cdweb.net/article/gsdshg.html