Sorry, I'm not familiar with English. I took advantage of Google translation.
Wow7.3 can not modify the memory, and I can not use registerLua, what is the way he can continue to use?
Here's my C++ code.
PHP Code:
DWORD registerLua(lua_State *state,const char *name, DWORD64* lua_Function)
{
_lua_pushcclosure _pushcclosure = (_lua_pushcclosure)(_BaseAddress+x_lua_pushcclosure);
_lua_setfield _setfield = (_lua_setfield)(_BaseAddress+x_lua_setfield);
int CodeLen = 12;
DWORD64 pCodeCave = GetBlankAddress(CodeLen);//Jump using code blank space
char temp[200];
DWORD old;
VirtualProtect((LPVOID)pCodeCave, CodeLen, PAGE_EXECUTE_READWRITE, &old);
*(BYTE *)pCodeCave = 0x48;
*(BYTE *)(pCodeCave + 1) = 0xB8;
*(DWORD64 *)(pCodeCave + 2) = (DWORD64)lua_Function;//My function
*(BYTE *)(pCodeCave + 10) = 0xff;
*(BYTE *)(pCodeCave + 11) = 0xe0;
VirtualProtect((LPVOID)pCodeCave, CodeLen, old, NULL);
_pushcclosure(state, pCodeCaveX, 0);
_setfield(state, -10002, name);
}
return 1;
}