Originally Posted by
cold123321
Hello!
My code:
Code:
#include <windows.h>
DWORD ingameID;
HANDLE ingame;
DWORD WINAPI Game(LPVOID)
{
bool ammo = false;
HMODULE hModule = GetModuleHandleA("bf3.exe"); // I need help here
while (1) {
if(GetAsyncKeyState(VK_NUMPAD1)|| GetAsyncKeyState(VK_NUMPAD1) &1) { ammo = true;}
if(ammo) { // enable unlimited ammo
__asm { I need help here
pushad;
add [ebx+18],#21;
jmp 00FC6097;
popad;
};
} else { // lets disable it
__asm {
pushad;
add [ebx+18],eax;
jmp 00FC6097;
popad
}
}
}
return 0;
}
int WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
DisableThreadLibraryCalls(hInstance); //Disables some callbacks
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
ingame = CreateThread(0,0,Game,0,0,&ingameID);
break;
case DLL_PROCESS_DETACH:
break;
}
return true;
}
So I commented two parts I need some help with.
The base address I need to "hook" somehow is this:
"bf3.exe"+BC6088
What that assembly code does is creating unlimited ammo, but I need help to make sure it's executed at the right part.
I'm not sure if I even did it with the rest of the code. But hopefully it's ok.
First, please rephrase your question, I don't understand what you're trying to do here.
Second, this is going to go wrong:
Code:
pushad;
add [ebx+18],eax;
jmp 00FC6097;
popad
I do no know what is at address 00FC6097, but execution is not going to return to the popad instruction after it. You'll need a call instruction for that. If you don't use a call instruction the game will crash when returning to a function (unless is expects registers popped) which is not likely.
If you need to hook bf3.exe + BC6088, it'll look like this:
Code:
mov eax, hModule
add eax, 0BC6088h ; this is where we'll hook
call Label
Label: pop ebx ; this is where we'll jump too
; ex. ebx = hook location (change where needed)
mov byte ptr[eax], 0E9h
mov ecx, eax
sub ecx, ebx
sub ecx, 5 ; if this doesn't work, try sub ebx, ecx (i can't remember which one is the right one)
mov dword ptr[eax+1], ecx]
That code you can use to hook, I don't understand why you don't do this in C++ though.