STAB How do I cheat?
Reputation: 0
Joined: 11 Sep 2015 Posts: 4
|
Posted: Mon May 04, 2020 8:26 am Post subject: [c++] need help with code caving |
|
|
hello, im trying to get these zombies base address (from pvz) by hooking this function, but looks like something wrong with my code that causing it to crash but i dont know what it is.
| Code: | const int zCount = 1;
uintptr_t basezombie = 0x005318C3; //pos
uintptr_t jmpback = basezombie + 0x6;
Zombies* zombies[zCount]; //one for now
Zombies* zPtr;
bool alreadyThere = false;
__declspec(naked) void hookZombies() {
__asm {
fld dword ptr[esi + 0x2C] //original instruction
//mov zObj, esi
//push eax
mov eax, esi
mov[zPtr], eax
}
if (zPtr == nullptr) {
goto STOP;
}
for (int i = 0; i < zCount; i++) {
if (zombies[i] == zPtr) {
if (zombies[i]->health > 1 && zombies[i]->health < 1000) {
alreadyThere = true;
break;
} else
alreadyThere = false;
}
else
alreadyThere = false;
}
if (alreadyThere) goto STOP;
else {
for (int i = 0; i < zCount; i++) {
if (zombies[i] == 0) {
zombies[i] = zPtr;
break;
}
}
}
STOP:
__asm {
//pop eax
mov eax, [esi + 0x04] //original instruction
//jmp[jmpback]
ret
}
} |
if i just use this
| Code: |
__asm {
fld dword ptr[esi + 0x2C] //original instruction
mov eax, [esi + 0x04] //original instruction
//jmp[jmpback]
ret
} |
it works just fine.
maybe thats EDX should've not been 1, idk. please help
| Description: |
|
| Filesize: |
111.65 KB |
| Viewed: |
1026 Time(s) |

|
|
|