friendship fixes.

develop
Warmist 2013-02-15 20:19:55 +02:00
parent e707d4552f
commit bb5d98e895
2 changed files with 13 additions and 1 deletions

@ -178,6 +178,7 @@ end
function BinaryPlugin:move_to_df()
local _,addr=df.sizeof(self.data)
markAsExecutable(addr)
return addr
end
function BinaryPlugin:print_data()
local out=""

@ -9,9 +9,18 @@ FriendshipRainbow.name="FriendshipRainbow"
-- os independant... I think...
FriendshipRainbow.ATTRS{filename="hack/lua/plugins/dfusion/friendship.o",name="FriendshipRainbow",race_data=DEFAULT_NIL}
FriendshipRainbow.class_status="valid, not installed"
function FriendshipRainbow:findall_needles(codesg,needle) -- todo move to memscan.lua
local cidx,caddr=codesg.uint8_t:find(needle)
local ret={}
while cidx~=nil do
table.insert(ret,{cidx,caddr})
cidx,caddr=codesg.uint8_t:find(needle,cidx+1)
end
return ret
end
function FriendshipRainbow:find_one(codesg,needle,crace)
dfu.concatTables(needle,dfu.dwordToTable(crace))
return codesg.uint8_t:findall(needle)
return self:findall_needles(codesg,needle)
end
function FriendshipRainbow:find_all()
local code=ms.get_code_segment()
@ -68,7 +77,9 @@ end
function FriendshipRainbow:patchCalls(target)
local addrs=self:find_all()
local swaps={}
print("target=",target)
for k,adr in ipairs(addrs) do
print(k,adr[1])
local newval=dfu.makeCall(adr[1],target)
table.insert(newval,adr[2])
for t,val in ipairs(newval) do