Windows 虚拟内存

2018-08-29  本文已影响0人  szn好色仙人

GetSystemInfo
Retrieves information about the current system.
To retrieve accurate information for an application running on WOW64, call the GetNativeSystemInfo function.

typedef struct _SYSTEM_INFO {
    union {
        DWORD dwOemId;          // Obsolete field...do not use
        struct {
            WORD wProcessorArchitecture;    //The processor architecture of the installed operating system
            /*
            PROCESSOR_ARCHITECTURE_AMD64    9       x64 (AMD or Intel)
            PROCESSOR_ARCHITECTURE_ARM      5       ARM
            PROCESSOR_ARCHITECTURE_ARM64    12      ARM64
            PROCESSOR_ARCHITECTURE_IA64     6       Intel Itanium-based
            PROCESSOR_ARCHITECTURE_INTEL    0       x86
            PROCESSOR_ARCHITECTURE_UNKNOWN  0xffff  Unknown architecture.
            */
            WORD wReserved;
        } DUMMYSTRUCTNAME;
    } DUMMYUNIONNAME;
    DWORD dwPageSize;                       //CPU页面大小,x86和x64机器下为4096, IA-64下为8192
    LPVOID lpMinimumApplicationAddress;     //给出每个进程可用地址空间的最小内存地址,一般为65536
    LPVOID lpMaximumApplicationAddress;     //给出每个进程的私有地址空间中最大的可用内存地址
    DWORD_PTR dwActiveProcessorMask;        //表示当前处于活动状态的CPU,是一个位掩码
    DWORD dwNumberOfProcessors;             //CPU数量
    DWORD dwProcessorType;                  //作废字段
    DWORD dwAllocationGranularity;          //预定地址空间区域的分配粒度,一般为65536
    WORD wProcessorLevel;                   //进一步细分的处理器体系结构
    WORD wProcessorRevision;                //进一步对wProcessorLevel进行细分
} SYSTEM_INFO, *LPSYSTEM_INFO;

IsWow64Process
Determines whether the specified process is running under WOW64.(WOW64 is the x86 emulator(仿真器) that allows 32-bit Windows-based applications to run seamlessly(无空隙地) on 64-bit Windows.)

GlobalMemoryStatusEx
Retrieves information about the system's current usage(使用) of both physical and virtual memory.

GetProcessMemoryInfo

typedef struct _PROCESS_MEMORY_COUNTERS {
    DWORD cb;                           
    //The size of the structure, in bytes.

    DWORD PageFaultCount;               
    //The number of page faults.

    SIZE_T PeakWorkingSetSize;         
    //The peak(最高点) working set size, in bytes.      (对应任务管理器中的 峰值工作设置(内存))

    SIZE_T WorkingSetSize;              
    //The current working set size, in bytes.   (对应任务管理器中的 工作设置(内存))

    SIZE_T QuotaPeakPagedPoolUsage;     
    //The peak paged pool usage, in bytes.     

    SIZE_T QuotaPagedPoolUsage;        
    //The current paged pool usage, in bytes.   (对应任务管理器中的 分页池)

    SIZE_T QuotaPeakNonPagedPoolUsage;  
    //The peak nonpaged pool usage, in bytes.

    SIZE_T QuotaNonPagedPoolUsage;     
    //The current nonpaged pool usage, in bytes.(对应任务管理器中的 非页面缓存池)

    SIZE_T PagefileUsage;              
    /*The Commit Charge value in bytes for this process.    (对应任务管理器中的 提交大小)
    Commit Charge is the total amount of memory that the memory manager 
    has committed for a running process.*/

    SIZE_T PeakPagefileUsage;           
    //The peak value in bytes of the Commit Charge during the lifetime of this process.

} PROCESS_MEMORY_COUNTERS;
typedef PROCESS_MEMORY_COUNTERS *PPROCESS_MEMORY_COUNTERS;

VirtualQuery
Retrieves information about a range of pages in the virtual address space of the calling process.
To retrieve information about a range of pages in the address space of another process, use the VirtualQueryEx function.

AWE

使用AWE(地址窗口扩展),可以让应用程序分配一块或多块内存,当一开始分配时,在进程的地址空间中是看不见这些内存的,然后在需要的时候将一块内存指定到利用VirtualAlloc预定的地址上并对内存进行访问。利用AWE可以让32位程序使用大于2GB的内存。

上一篇 下一篇

猜你喜欢

热点阅读