more registers supported

develop
Warmist 2011-08-20 17:51:00 +03:00
parent f9c1556f7f
commit 3e75ac015c
4 changed files with 20 additions and 4 deletions

@ -1,15 +1,19 @@
.intel_syntax .intel_syntax
push eax push eax
push ebp
push esp
push esi
push edi
push edx push edx
push ecx push ecx
push ebx push ebx
push eax push eax
mov eax,[esp+20] mov eax,[esp+36]
push eax push eax
function: function:
call 0xdeadbee4 call 0xdeadbee0
function2: function2:
mov [0xdeadbeef],eax #self modifying code... :/ mov [0xdeadbeef],eax
pop eax pop eax
function3: function3:
jmp [0xdeadbeef] jmp [0xdeadbeef]

@ -20,6 +20,10 @@ function OnFunction(values)
for k,v in pairs(values) do for k,v in pairs(values) do
print(string.format("%s=%x",k,v)) print(string.format("%s=%x",k,v))
end 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 return onfunction.calls[values.ret] --returns real function to call
end end
function onfunction.patch(addr) function onfunction.patch(addr)

@ -129,7 +129,7 @@ static int GetMod(lua_State *L)
st.push(pos); st.push(pos);
return 1; 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(); lua::state st=lua::glua::Get();
st.getglobal("OnFunction"); 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.setfield("ecx");
st.push(edx); st.push(edx);
st.setfield("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.push(ret);
st.setfield("ret"); st.setfield("ret");
st.pcall(1,1); st.pcall(1,1);