Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Tue May 22, 2012 5:35 pm Post subject: Stack Copy fix |
|
|
Some features of CE 6.2 can make and use a stack copy (structure spider, dissect data)
The problem with the copy is that it is an exact copy, so if it contains a pointer to a stack location, the pointer would still be useless for data (unless you made the stack copy and immediately froze the game)
This lua script will add a rightclick menu to the hexadecimal view of the memoryviewer called "Fix Stackcopy" which will adjust all pointers inside the stack to the local. You must give it the original ESP and size to function properly though
Also, it might change stuff that isn't a pointer like a floating point value with a hexadecimal value in the same range as the stackcopy, or a piece of text
script:
Code: |
--guid, to make sure no one else uses this same identifier (ffs, don't copy paste this line if you make your own scripts)
if scriptGUID_171AF2BAA45D11E19DE29B1B6288709B==true then return end
scriptGUID_171AF2BAA45D11E19DE29B1B6288709B=true
function replacePointers32(copybase, originalbase, size)
local i=0
while i<size do
local oldValue=readInteger(copybase+i)
if (oldValue>=originalbase) and (oldValue<originalbase+size) then
writeInteger(copybase+i, copybase+(oldValue-originalbase))
end
i=i+4
end
end
function replacePointers64(copybase, originalbase, size)
local i=0
while i<size do
local oldValue=readQword(copybase+i)
if (oldValue>=originalbase) and (oldValue<originalbase+size) then
writeQword(copybase+i, copybase+(oldValue-originalbase))
end
i=i+8
end
end
function stackcopyfix(sender)
local copybase=0
local originalbase=0
local size=0
local mv=getMemoryViewForm()
local hv=memoryview_getHexadecimalView(mv)
copybase=hexadecimalview_getTopAddress(hv)
control_setCaption(frmFixStack_edtCopy, string.format('%x', copybase))
edit_clear(frmFixStack_edtOriginal)
control_setCaption(frmFixStack_edtSize, '4096')
result=form_showModal(frmFixStack)
if (result~=mrCancel) then
if targetIs64Bit() then
replacePointers64(copybase, originalbase, size)
else
replacePointers32(copybase, originalbase, size)
end
end
end
mv=getMemoryViewForm()
hv=memoryview_getHexadecimalView(mv)
pm=control_getPopupMenu(hv)
pmi=menu_getItems(pm)
mi=createMenuItem(pmi)
menuItem_setCaption(mi, 'Fix stackcopy');
menuItem_insert(pmi, 16, mi) --above add this address to the list
menuItem_onClick(mi, stackcopyfix)
createFormFromFile(getCheatEngineDir()..[[autorun\frmFixStack.frm]])
|
Full package: http://cheatengine.org/download/stackfix.zip
just extract to your autorun folder, if it doesn't exist, redownload and reinstall ce, or make one, but reinstalling is recommended as the one that doesn't make it also ignores the modalResult
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|