????????????????洢???????????

????????????????????????洢???????????????е?????????????????VirtualFree??????


BOOL VirtualFree(

     LPVOID pvAddress??

     SIZE_T dwSize??

     DWORD fdwFreeType);
 


????pvAddress???????????????????????????????????VirtualAlloc?????????????????????????????????????С???????????????????0??dwSize??

??????????MEM_RELEASE??fdwFreeType???????????????????????????????????洢??????????????

????????????????????????????????????洢??????????????pvAddress??????????????????????????????????????dwSize????????????????????????洢????С????????MEM_DECOMMIT??fdwFreeType??

?????????????洢???????????????????????????????????????????????λ?????????У????????????????????檔???dwSize?0????pvAddress???????????????????VirtualFree????????????????????檔

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

???????????????????????????????洢???????????????磬???????д??????????????????????е??????????????????????С??????????????????????????????????????????????????????洢?????????????PAGE_READWRITE???????????????????FPAGE_NOACCESS?????????????????????????????????????????

??????????????VirtualProtect???????????????????????????


BOOL VirtualProtect(

    PVOID pvAddress??

    SIZE_T dwSize??

    DWORD flNewProtect??

    PDWORD pflOldProtect);
 


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

????dwSize???????????????С??????????λ??

????flNewProtect?????????PAGE_WRITECOPY??PAGE_EXECUTE_WRITECOPY?????κ?PAGE_*?????

????pflOldProtect??????????????????????????????????NULL?????????????Ч??????VirtualProtect???????????????

???????????????????????????洢?????????VirtualProtect????pvAddress??dwSize???????????????????????????????????????????????????????

????????????洢????????

???????????????????????????????????????????С?????ó???????????????????????????????棬??????????в?????????檔????????????棬?????????????檔???????????????????????????????Щ??檔?????????????????????????Щ??????????????????

????Windows???????????????ó????????????????????????????????????洢????????????洢?????????????????????????洢???????????б???????????????????????????????????????????????????д??????????????Щ??ó?????????С??????????洢??????????????洢???е???????????????????ó??????????????????б?????????????????????б???洢???

???????????洢??????ó?????????VirtualAlloc?????????????????д?MEM_RESET?????


PINT pnData=(PINT)VirtualAlloc(NULL??1024??

MEM_RELEASE|MEM_COMMIT??PAGE_READWRITE);

pnData[0]=100;

pnData[1]=200;

VirtualAlloc((PVOID)pnData??sizeof(int)??MEM_RESET??PAGE_READWRITE);