ExclamationInjecting DLL Error?

Posts 17 of 7 · Page 1 of 1
Injecting DLL Error?
Hi, im trying to make a MapleStory Trainer.
I have my injector which injects the code by doing this:
Code:
void Inject(string dll, string function, int index) {
	char wndName[255];
	sprintf(wndName, "MapleStory %i", index); 
	HWND hackWnd = FindWindow(0, wndName);
	if (hackWnd == 0) {
		MessageBox(0, "Cannot find MapleStory", "Failzor", 0);
	}
	DWORD pid;
	GetWindowThreadProcessId(hackWnd, &pid);
	HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
	if (hProcess == 0) {
		MessageBox(0, "Cannot find MapleStory Process", "Failzor", 0);
	}
	HMODULE dllModule = LoadLibrary(dll.c_str());
	FARPROC functionStart = GetProcAddress(dllModule, function.c_str());
	CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)functionStart, NULL, 0, NULL);
}
and this is the function that is called from the dll:
Code:
extern "C" __declspec(dllexport) void FullGodmodeOn() {
	DWORD addy = 0x00961B6C;
	BYTE Enable[] = {0x0F, 0x84, 0x59, 0x21, 0x00, 0x00};
	memcpy((void*)addy, Enable, sizeof(Enable));
}
When I run the Inject function Maplestory starts lagging and then stops working after about a second.
Is there something wrong with my injection method, my dll or is it just maplestory?
Why not just use WriteProcessMemory?

and you are not injecting a dll.
You can use write process memory to write an array of bytes?
of course you can
Code:
WriteProcessMemory(hProcess, (void*)0x00961B6C, &Enable, 6, NULL);
or
WriteProcessMemory(hProcess, (void*)0x00961B6C, "\x0F\x84\x59\x21\x00\x00", 6, NULL);
Well that works DD thanks you but I have one problem and idk what it is.
When I use cheat engine to write the aob I use
Code:
db 0F 84
So in c++ Im guessing I write the bytes
Code:
BYTE bytes[] = {0x0F, 0x84}
but that does not change it correctly?
with the posted code you load the dll in your injectors' process and then create a thread to 0x00000000 in the target process.
as for the byte string: unsigned char* bytestr = "\x0F\x84";
it works kindof :/ well the kindof is a problem in my code that I know how to fix. Also the reason maplestory was crashing is because 0x00961B6C isnt an address I forgot to takeout the 2 zeros when I came over from cheat engine the real address is 0x961B6C and thank you the new way of writing bytes works
Posts 17 of 7 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?