Here is my code
Code:
DWORD *Add = (DWORD *)((ModuleBase) + t_luaState);
lua_State *State = (lua_State *)*Add;
s_luapushcclosure(State,(lua_CFunction)os_execute,0);
s_lua_setfield(State,LUA_GLOBALSINDEX,"OSexecute");
the define of struct lua_State is in lua.h (version 5.1.4)
And the i get "Add" by tracing "lua_newstate" and it's 0xABEF10 of 4.3.4(rebased)
Code:
int os_execute (lua_State *L) {
MessageBox(NULL,"1","2",0);
LUATOSTRING s_lua_tostring = (LUATOSTRING)((ModuleBase) + t_lua_tostring);
MessageBox(NULL,"1",s_lua_tostring(L,-1),0);
return 0;
}
i have modified "FrameScript::InvalidPtrChec" , So it won't work
it works fine when i run the macro in WOW as "/run print("OSexecute")"
but when i run "/run OSexecute("123")", after the first MessageBox, WOW crashes... who knows why?