switch (mbi.State)
{
case MEM_FREE:
BufState="空闲";
break;
case MEM_COMMIT:
BufState="分配";
if (mbi.Protect==PAGE_READWRITE)
BufProtect="可读写";
else
BufProtect="不可访问";
break;
case MEM_RESERVE:
BufState="保留";
}
typedef struct _MEMORY_BASIC_INFORMATION { // mbi
PVOID BaseAddress; // base address of region
PVOID AllocationBase; // allocation base address
DWORD AllocationProtect; // initial access protection
DWORD RegionSize; // size, in bytes, of region
DWORD State; // committed, reserved, free
DWORD Protect; // current access protection
DWORD Type; // type of pages
} MEMORY_BASIC_INFORMATION;