Hyperlisk Posted March 12, 2009 Share Posted March 12, 2009 (edited) 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, 2009 by Hyperlisk Link to comment
0xFF Posted March 12, 2009 Share Posted March 12, 2009 (edited) You're using VirtualProtect to remove protection from that memory region, right ? (00BA76A0) Edited March 12, 2009 by Rot1 Link to comment
Killboy Posted March 12, 2009 Share Posted March 12, 2009 The last param can't be NULL. It has to be a var that takes the old protection. Link to comment
Hyperlisk Posted March 12, 2009 Author Share Posted March 12, 2009 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. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now