18.11.2014 Views

Using Virtual Memory in your application

Using Virtual Memory in your application

Using Virtual Memory in your application

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

例<br />

void ma<strong>in</strong>(){<br />

// Step 1: Reserve 64 KB <br />

PVOID buffer=<strong>Virtual</strong>Alloc(NULL, 64*1024,MEM_RESERVE,PAGE_READWRITE);<br />

if(buffer==NULL)<br />

ShowError();<br />

// Step 2: , 1 page <br />

buffer=<strong>Virtual</strong>Alloc(buffer, 4*1024,MEM_COMMIT,PAGE_READWRITE);<br />

if(buffer==NULL)<br />

ShowError();<br />

<br />

Page protected <br />

PAGE_READONLY<br />

// Step 3: 例<br />

for(<strong>in</strong>t i=0;i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!