 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Nov 20, 2008 9:20 pm Post subject: GetProcAddress inline hooking doesn't work? |
|
|
| Code: |
DWORD LL = (DWORD)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetProcAddress");
FARPROC (__stdcall * RealGetProcAddress)(HMODULE hModule, LPCSTR lpProcName) = GetProcAddress;
FARPROC WINAPI MyGPA(HMODULE hModule, LPCSTR lpProcName){
MessageBox(NULL,"GetProcAddress() called!", NULL, NULL);
return RealGetProcAddress(hModule, lpProcName);
}
void WINAPI MainT(){
for(;;Sleep(10)){
newmem = new char[10];
memcpy(newmem, (void*)LL, 5);
if(MemSnapshot != newmem){
*(PBYTE)LL = 0xE9;
*(PDWORD)(LL+0x01) = (DWORD)MyGPA - (DWORD)LL - 5;
MessageBox(NULL,"Lul GG tried to overwrite my hookz :3", NULL, NULL);
}
delete[] newmem;
}
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
hWnd = FindWindow("MapleStoryClass","MapleStory");
if(hWnd){
MessageBox(NULL, "OKIEZ WE GOT MS", NULL, NULL);
GetWindowThreadProcessId(hWnd, &pid);
hProc = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
FixMemEx(hProc, (LPVOID)LL, 5, PAGE_EXECUTE_READWRITE, NULL);
*(PBYTE)LL = 0xE9;
*(PDWORD)(LL+0x01) = (DWORD)MyGPA - (DWORD)LL - 5;
memcpy(MemSnapshot, (void*)LL, 10);
DisableThreadLibraryCalls(hModule);
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)&MainT, NULL, NULL, 0);
}
|
HMM? Doesn't seem to be getting the address...
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Thu Nov 20, 2008 9:48 pm Post subject: |
|
|
Your code is so ugly...
Anyways, are you injecting the dll at the ad?
Btw:
Use memcmp to compare the hook changes... not !=...
_________________
Last edited by lurc on Thu Nov 20, 2008 9:50 pm; edited 1 time in total |
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Nov 20, 2008 9:50 pm Post subject: |
|
|
| lurc wrote: | Your code is so ugly...
Anyways, are you injecting the dll at the ad? |
It was a template, I was in a hurry to see if this method would work or not. Yeah I am.
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Thu Nov 20, 2008 9:53 pm Post subject: |
|
|
LoadLibrary(_T("Kernel32.dll"))
instead of GetModuleHandle?
And btw, your basically gonna end up in an infinite loop... cause you're jumping back to GetProcAddress's addy, which is now patched to your hook
_________________
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Nov 20, 2008 9:56 pm Post subject: |
|
|
| lurc wrote: | LoadLibrary(_T("Kernel32.dll"))
instead of GetModuleHandle?
And btw, your basically gonna end up in an infinite loop... cause you're jumping back to GetProcAddress's addy, which is now patched to your hook  |
Lol there is only 1 infinite loop, and I put it there on purpose.
|
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|