#NoEnv SetWorkingDir %A_ScriptDir% !q:: WinActivate, Cheat Engine 7.2 sleep, 200 Click, 420 544 2 sleep, 200 WinGetText, val, 改变数值 if instr(val, "5") { SendInput 30 } else { SendInput 1.5 } sleep, 100 Send {Enter} sleep, 100 WinActivate, Eternium return ; 群友提问与解答: 能读到内存的值,却写不进去。 原来是我OpenProcess的时候参数就不对 !z:: addr := 0x13191050 WinGet, pid, PID, Eternium ; handle := DllCall("OpenProcess", "UInt", 16, "Int", false, "UInt", pid) ; 原来是我OpenProcess的时候参数就不对【原文】 handle := DllCall("OpenProcess", "uint", 16, "int", false, "uint", pid, "ptr") VarSetCapacity(value, 4, 0 ) DllCall("ReadProcessMemory", "UInt", handle, "UInt", addr, "Str", value, "UInt", 4, "UIntP", 0) num := NumGet(value, 0, "Float") s := 1.5 if ( num == 1.5) { s := 50 } NumPut(s, value, "Float") nn := NumGet(value, 0, "Float") DllCall("VirtualProtectEx", "UInt", handle, "UInt", addr, "UInt",0x04, "UIntP",0) ;DllCall("WriteProcessMemory", "UInt", handle, "UInt", addr, "Str", value, "UInt", 4, "UIntP", 0) DllCall("WriteProcessMemory", "ptr", handle, "ptr", addr, "ptr", value, "uptr", 4, "ptrp", 0) DllCall("CloseHandle", "UInt", handle) return /* Tebayaki 反馈的记事本测试例子,但是我测试不行 WinGet, pid, PID, ahk_class Notepad addr := 0x7FFCA78592F4 ; 随便找的,测试用 if !(handle := DllCall("OpenProcess", "uint", 0x1fffff, "int", false, "uint", pid, "ptr")) throw Exception(A_LastError) if !(DllCall("ReadProcessMemory", "ptr", handle, "ptr", addr, "float*", value, "uptr", 4, "uptr*", 0)) throw Exception(A_LastError) MsgBox, % value value := 50 if !(DllCall("WriteProcessMemory", "ptr", handle, "ptr", addr, "float*", value, "uptr", 4, "uptr*", 0)) throw Exception(A_LastError) if !(DllCall("ReadProcessMemory", "ptr", handle, "ptr", addr, "float*", value, "uptr", 4, "uptr*", 0)) throw Exception(A_LastError) MsgBox, % value */
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)