diff --git a/plugins/Dfusion/luafiles/onfunction/functions.asm b/plugins/Dfusion/luafiles/onfunction/functions.asm index 6f877090f..13ef23191 100644 --- a/plugins/Dfusion/luafiles/onfunction/functions.asm +++ b/plugins/Dfusion/luafiles/onfunction/functions.asm @@ -1,15 +1,19 @@ .intel_syntax push eax +push ebp +push esp +push esi +push edi push edx push ecx push ebx push eax -mov eax,[esp+20] +mov eax,[esp+36] push eax function: -call 0xdeadbee4 +call 0xdeadbee0 function2: -mov [0xdeadbeef],eax #self modifying code... :/ +mov [0xdeadbeef],eax pop eax function3: jmp [0xdeadbeef] diff --git a/plugins/Dfusion/luafiles/onfunction/functions.o b/plugins/Dfusion/luafiles/onfunction/functions.o index 3fafa5ecd..7b7d4a33f 100644 Binary files a/plugins/Dfusion/luafiles/onfunction/functions.o and b/plugins/Dfusion/luafiles/onfunction/functions.o differ diff --git a/plugins/Dfusion/luafiles/onfunction/plugin.lua b/plugins/Dfusion/luafiles/onfunction/plugin.lua index d1b27ca62..14d6e219c 100644 --- a/plugins/Dfusion/luafiles/onfunction/plugin.lua +++ b/plugins/Dfusion/luafiles/onfunction/plugin.lua @@ -20,6 +20,10 @@ function OnFunction(values) for k,v in pairs(values) do print(string.format("%s=%x",k,v)) end + print("stack:") + for i=0,2 do + print(string.format("%d %x",i,engine.peekd(values.esp+i*4))) + end return onfunction.calls[values.ret] --returns real function to call end function onfunction.patch(addr) diff --git a/plugins/Dfusion/src/lua_Misc.cpp b/plugins/Dfusion/src/lua_Misc.cpp index d01bb3c12..5ac4bd73b 100644 --- a/plugins/Dfusion/src/lua_Misc.cpp +++ b/plugins/Dfusion/src/lua_Misc.cpp @@ -129,7 +129,7 @@ static int GetMod(lua_State *L) st.push(pos); return 1; } -static size_t __stdcall PushValue(size_t ret,uint32_t eax,uint32_t ebx,uint32_t ecx,uint32_t edx) +static size_t __stdcall PushValue(size_t ret,uint32_t eax,uint32_t ebx,uint32_t ecx,uint32_t edx,uint32_t edi,uint32_t esi,uint32_t esp,uint32_t ebp) { lua::state st=lua::glua::Get(); st.getglobal("OnFunction"); @@ -144,6 +144,14 @@ static size_t __stdcall PushValue(size_t ret,uint32_t eax,uint32_t ebx,uint32_t st.setfield("ecx"); st.push(edx); st.setfield("edx"); + st.push(edi); + st.setfield("edi"); + st.push(esi); + st.setfield("esi"); + st.push(esp); + st.setfield("esp"); + st.push(ebp); + st.setfield("ebp"); st.push(ret); st.setfield("ret"); st.pcall(1,1);