LongBeardedLion Expert Cheater
Reputation: 0
Joined: 10 Apr 2020 Posts: 174
|
Posted: Sun May 31, 2020 6:07 pm Post subject: Cant build DLL injection when assembly contain push |
|
|
Is this not possible?
So basically i suceeded at compiling and injecting in many instances. The only thing that intrigues me is why in the world an assembly code injection that has push cant compile in Visual Studio.
I know this is not cheat engine related. But its General Gamehacking. And i wouldn't be anywhere near doing this if it wasn't for cheat engine.
Please help me.
I get this error:
Error C2414 illegal number of operands hook C:\Source.cpp 29
Error C2400 inline assembler syntax error in 'first operand'; found ',' hook C:\Source.cpp 29
This is the full code of my dll injection, pls skip to function void __declspec(naked) ourFunct() or line 29 to see where the error is :
PASTEBIN:
https:// pastebin. com/HGZbxcj6
Code:
| Code: | #include <Windows.h>
bool Hook(void* toHook, void* ourFunct, int len) {
if (len < 5) {
return false;
}
DWORD curProtection;
VirtualProtect(toHook, len, PAGE_EXECUTE_READWRITE, &curProtection);
memset(toHook, 0x90, len);
DWORD relativeAddress = ((DWORD)ourFunct - (DWORD)toHook) - 5;
*(BYTE*)toHook = 0xE9;
*(DWORD*)((DWORD)toHook + 1) = relativeAddress;
DWORD temp;
VirtualProtect(toHook, len, curProtection, &temp);
return true;
}
DWORD jmpBackAddy;
void __declspec(naked) ourFunct() {
__asm {
mov ebp, dword ptr[esp + 0x10]
xor eax, eax
push, esi
push, edi
}
}
DWORD WINAPI MainThread(LPVOID param) {
int hookLength = 8;
DWORD hookAddress = 0x43C6E3;
jmpBackAddy = hookAddress + hookLength;
Hook((void*)hookAddress, ourFunct, hookLength);
while (true) {
if (GetAsyncKeyState(VK_ESCAPE)) break;
Sleep(50);
}
FreeLibraryAndExitThread((HMODULE)param, 0);
return 0;
}
BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved) {
switch (dwReason) {
case DLL_PROCESS_ATTACH:
CreateThread(0, 0, MainThread, hModule, 0, 0);
break;
}
return TRUE;
} |
|
|