Jump to content
Tuts 4 You

DLL Injection -> Writing in Executable Memory


Hyperlisk

Recommended Posts

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 by Hyperlisk
Link to comment

You're using VirtualProtect to remove protection from that memory region, right ? (00BA76A0)

Edited by Rot1
Link to comment
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...