.dll injection question...

Posts 15 of 5 · Page 1 of 1
.dll injection question...
How exactly do you write memory to a process by using a .dll I've done this the external way (using WriteProcessMemory).
By using takes a memcpy() function. It takes a couple parameters:
memcpy, wmemcpy (CRT)
memcpy(destination, source, num_of_bytes);

ofcourse you may have to change the protection of memory in order to write to it. That's what VirtualProtect() is for. VirtualProtect Function (Windows)

and I think you should change back the protection once you change whatever address you wan, but Im not sure. =/
Quote Originally Posted by why06 View Post
By using takes a memcpy() function. It takes a couple parameters:
memcpy, wmemcpy (CRT)
memcpy(destination, source, num_of_bytes);

ofcourse you may have to change the protection of memory in order to write to it. That's what VirtualProtect() is for. VirtualProtect Function (Windows)

and I think you should change back the protection once you change whatever address you wan, but Im not sure. =/
tyvm +thanks
yep that why sai is true
Code:
*(DWORD*)0x138732 = 541;
or

Code:
void PatchMem(LPVOID dwAddress, LPVOID bytes, DWORD dwSize)
{
	DWORD flOldProtect = 0;
	VirtualProtect((void*)dwAddress, dwSize, PAGE_EXECUTE_READWRITE, &flOldProtect);
	memcpy((void*) dwAddress, bytes, dwSize);
	VirtualProtect((void*)dwAddress, dwSize, flOldProtect, &flOldProtect);
}
then use that like
Code:
unsigned long* fireRecoil = 0x387489;
BYTE fireRecoilPatch[2] = {0x25, 0x5F};
PatchMem(fireRecoil, fireRecoilPatch, 2);
Posts 15 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?