|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
movss Cheater Reputation: 0
Joined: 10 Feb 2018 Posts: 38
|
Posted: Fri Apr 06, 2018 11:01 am Post subject: customer function setwindowontop,crash |
|
|
SetWindowPos (hwnd, -1, 0, 0, 0, 0, 3)
Code: |
function SetWindowTop(form)
if cheatEngineIs64Bit() then
handle = readQwordLocal(userDataToInteger(form)+0x538)
script = [[
alloc(thread,128)
createthread(thread)
thread:
lea rsp,[rsp-40]
mov rcx,handle
mov edx,-1
mov r8d,0
mov r9d,0
push 0
push 0
push 3
call user32.SetWindowPos
lea rsp,[rsp+40]
ret
]]
script=script:gsub('handle', string.format('%X',handle))
autoAssemble(script,true)
else
handle = bAnd( readQwordLocal(userDataToInteger(form)+0x330) , 0xFFFFFFFF)
script = [[
alloc(thread,128)
createthread(thread)
thread:
push 3
push 0
push 0
push 0
push 0
push -1
push handle
call user32.SetWindowPos
ret
]]
script=script:gsub('handle', string.format('%X',handle))
autoAssemble(script,true)
end
end
|
when i run this function ,it crash, WTF
help,me
_________________
A wild programmer |
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Fri Apr 06, 2018 11:19 am Post subject: |
|
|
If your passing a form object to the function any way, then why not just us "form.bringToFront()". That and the WinControl class has a "Handle" property, and the control class has a "setPosition" function.
EDIT:
But I think the crash is because the thread is created with not instructions:
Code: |
alloc(thread,128)
createthread(thread) //// you create a thread with no instructions, just nulls.
thread: //// Then you add the instructions, after the thread has already been ran.
// ...
ret |
Code: |
alloc(thread,128)
thread: //// Add the instructions first.
// ...
ret
createthread(thread) //// Then create a thread. |
But I'm not actually real sure how CE would handle this, it may correct this for you; but I don't think you should count on that even if it is.
_________________
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|