??????δ???????????????洢???????????????4????????????????á?????????洢?????????????????????VirtualAlloc????NULL??GetLastError????ERROR_INVALID_ADDRESS??

????????????????MEM_RESET??VirtualAlloc???????????????????????????С????????????????????????????????????????????????????????????л???????????????????£????????????????????????????????????????????0???????????????????????????????????????????????????檔?????????????????????????????????á?

??????????MEM_RESET????????????????????????????????????á?????????????

????VirtualQuery??????

????VirtualQuery???????????????????й???????????????С???洢????????????????


DWORD VirtualQuery(

     LPCVOID pvAddress??

     PMEMORY_BASIC_INFORMATION pmbi??

     DWORD dwLength);
 


????pvAddress??????????????????????

????dwLength???MEMORY_BASIC_INFORMATION????С??

????pmbi????MEM_BASIC_INFORMATION??????????????????£?


typedef struct _MEMORY_BASIC_INFORMATION

{

    PVOID BaseAddress;//????pvAddress?????????????С??

    PVOID AllocationBase;//??????????

    DWORD AllocationProtect;//??????????????????

    SIZE_T RegionSize;//?????С??????????λ????BaseAddress?????????

    DWORD State;//????????????

    DWORD Protect;//????????

    DWORD Type;//

}MEMORY_BASIC_INFORMATION??*PMEMORY_BASIC_INFROMATION;
 


????VirtualQueryEx??VirtualQuery???????????????????????????????ζ?????????????????????????????

????GlobalMemoryStatus???????????????????????????


VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer);


????MEMORYSTATUS?????????£?


typedef struct _MEMORYSTATUS

 {

   DWORD dwLenght;//?????С?????ú??????????????

   DWORD dwMemoryLoad;//

   SIZE_T dwTotalPhys;

   SIZE_T dwAvailablePhys;

   SIZE_T dwTotalPageFile;

   SIZE_T dwAvailablePageFile;

   SIZE_T dwTotalVirtual;

   SIZE_T dwAvailVirtual;

  }MEMORYSTATUS??*LPMEMORYSTATUS;
 


????dwMemoryLoad????????????????????ж????????????0-100?????κ????????У???????????????

????dwTotalPhys???????????????????

????dwAvailPhys????????????????????????????????λ??

????dwTotalPageFile????????????????????????????????

????dwTotalVirtual??????????и???????е???????????????2G??128k.??0x00000000-0x0000FFFF?????????????????0x7FFF0000-0x7FFFFFFF??64KB?????????????????????ó?????????

????dwAvailVirtual???????????й??????????????ж???????????????????á???dwTotalVirtual-?????????????????dwAvailVirtual??