Posted By

NyX on 08/17/09



Versions (?)

Edit memory

 / Published in: C++

  1. void edit_memory(int address, BYTE *data, int length) {
  2. int protection; // memory protection information variable
  3. VirtualProtect((void *)address, length, PAGE_READWRITE, (PDWORD)&protection); // set READ WRITE access to memory, and save previous protection information
  4. memcpy((void *)address, (const void *)data, length); // copy length byte of data to address
  5. VirtualProtect((void *)address, length, protection, 0); // restore previously changed memory protection
  6. }

Report this snippet  

You need to login to post a comment.