?????????

???????????????????????????е??????????????????С?????????????GetSystemInfo?????????????й?????


VOID GetSystemInfo(LPSYSTEM_INFO psi);

SYSTEM_INFO?????????£?

typedef struct _SYSTEM_INFO{

    union{

                 struct  {

                              WORD wProcessorArchitecture;

                              WORD wReserved;

                           };
           };
    DWORD dwPageSize;

    LPVOID lpMinimumApplicationAddress;

    LPVOLID lpMaximumApplicationAddress;

    DWORD_PTR dwActiveProcessorMask;

    DWORD dwNumberOfProcessor;

    DWORD dwProcessorType;

    DWORD dwAllocationGranularity;

    WORD wProcessorLevel;

    WORD wProcessorRevision;

}SYSTEM_INFO??*LPSYSTEM_INFO;
 


???????????????????????????й??

????dwPageSize???cpu????С??x86??x64?????У?????4K??

????lpMinimumApplicationAddress?????????п????????С????????????????????????儷???64K??????????????64K??

????lpMaximumApplicationAddress?????????????е??????д??

???????????????

????dwAllocationGranularity????????????????????????????

???????????????????????

????wReserved?????????????????á?

????dwNumOfProcessor????cpu????????

????dwActiveProcessorMaskλ?????????????Щcpu?????????????????????????

????dwProcessorType??????????????á?

????wProcessorArchitecture????????????????????x86??x64;

????wProcessorLevel??????????????????????????Intel????2????4.

????wProcessorRevision???????wProcessLevel????????

????//???′???????????????漰???????????????????á?


#include"windows.h"
#include<iostream>
#include"tchar.h"
TCHAR TextData[]=TEXT("c:Usersyangyangdocumentsvisual studio 2010ProjectsMEM_RESETMEM_RESETmain.cppc:Usersyangyangdocumentsvisual studio 2010ProjectsMEM_RESETMEM_RESETmain.cpp");
int main(int argc??char**argv)
{
 
 PTSTR pszData=(PTSTR)VirtualAlloc(NULL??1024??MEM_RESERVE|MEM_COMMIT??PAGE_READWRITE);
 if(pszData==NULL)
 {
  MessageBox(NULL??TEXT("???????")??TEXT("")??MB_OK);
 }
 _tcscpy_s(pszData??1024??TextData);
 int ret=MessageBox(NULL??TEXT("???????????????棿")??TEXT("")??MB_YESNO);
 if(ret==IDNO)
 {
  MEMORY_BASIC_INFORMATION mbi;
  VirtualQuery(pszData??&mbi??sizeof(mbi));
  VirtualAlloc(pszData??mbi.RegionSize??MEM_RESET??PAGE_READWRITE);
 }

 MEMORYSTATUS mst;
 GlobalMemoryStatus(&mst);
 PVOID pvAddress=VirtualAlloc(NULL??mst.dwAvailVirtual??MEM_RESERVE|MEM_COMMIT??PAGE_READWRITE);
 if(pvAddress)
 {
  ZeroMemory(pvAddress??mst.dwAvailVirtual);
 }
 if(!_tcscmp(TextData??pszData))
 {
  MessageBox(NULL??TEXT("??????棡")??TEXT("")??MB_YESNO);
 }
 else
 {
  MessageBox(NULL??TEXT("δ???棡")??TEXT("")??MB_YESNO);
 }
 getchar();
 VirtualFree(pvAddress??0??MEM_RELEASE);
 VirtualFree(pszData??0??MEM_RELEASE);
 return 0;
}