Posted March 12, 200916 yr Okay, so I thought I knew how to do this, but apparently not... Here's the situation... I'm currently messing around with DLL injection, using Mine Sweeper as my target. I'm just trying to get my DLL code to be able to write in Mine Sweeper's executable memory. I thought that VirtualProtect() would help me there, but apparently not... Any suggestions? This is what I'm currently doing in my DLL code, just trying to do a 1-byte patch, lol: char* addr = (char*)0x00BA76A0; if(!VirtualProtect((LPVOID)addr,1,PAGE_EXECUTE_READWRITE,NULL)){ MessageBox(NULL,"Couldn't protect the memory...","Fail...",NULL); }EDIT: Nevermind, I'm stupid. I just used WriteProcessMemory() combined with GetCurrentProcess() Edited March 12, 200916 yr by Hyperlisk
March 12, 200916 yr You're using VirtualProtect to remove protection from that memory region, right ? (00BA76A0) Edited March 12, 200916 yr by Rot1
March 12, 200916 yr Author The last param can't be NULL. It has to be a var that takes the old protection.Ah, I just skimmed over the MSDN article, I just assumed it was like most of the output variables that you can leave NULL.
Create an account or sign in to comment