Can anyone give me a lil help here
using the lua_dostring function from here (Lua_DoString() in C++ w/ CreateRemoteThread/WriteProcessMemory + Security questions)
added a bit and updated the Framescript_ExecuteBuffer for 3.3.5a, i'm assuming its something really obvious, i'm just missing it
Code:
void Lua_DoString(string cmd) {
unsigned int Framescript_ExecuteBuffer = Mem.GetProcessBaseAddress(Mem.dwProcessID) + 0x00819210;
void* Handle = Mem.hProcess;
DWORD func = Framescript_ExecuteBuffer;
DWORD cbCodeSize = ((PBYTE)after_codeasm - (PBYTE)codeasm);
//cbCodeSize = 200; //^isn't that the size of the function? why are hard setting it to 200 then?
INJDATA mydata;
convertToASCII(cmd, mydata.command);
mydata.funcptr = func;
LPVOID pData = VirtualAllocEx(Handle, NULL, sizeof(func), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
LPVOID pLibRemote = VirtualAllocEx(Handle, NULL, cbCodeSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
WriteProcessMemory(Handle, pData, &mydata, sizeof(mydata), NULL);
WriteProcessMemory(Handle, pLibRemote, &codeasm, cbCodeSize, NULL);
// writes jmp pLibRemote + 0x62EE
// jmp pLibRemote + 0x62EE = add [eax],al
HANDLE hThread = CreateRemoteThread(Handle, NULL, 0, (LPTHREAD_START_ROUTINE)pLibRemote, pData, 0, NULL);
if (hThread != 0) {
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
VirtualFreeEx(Handle, pLibRemote, cbCodeSize, MEM_RELEASE);
VirtualFreeEx(Handle, pData, sizeof(func), MEM_RELEASE);
}
}
the error i get when i try to run do lua_dostring("print()") is
Code:
The instruction at "0x17F35C6E" referenced memory at "0x17F35C6E".
The memory could not be "written".
i can see why it is breaking but no clue how to fix it.
pLibRemote has a instruction to jmp to pLibRemote + 0x62EE
but where its breaking it pLibRemote + 0x62EE points back at pLibRemote + 0x62EE so its basicly in a forever loop?