require "alien"
--the address im trying to edit in the Mahjong game on Win7
local SCOREREF = 0x0744D554
--this should give me full access to the process
local ACCESS = 0x001F0FFF
--this is my process ID for my open window of Mahjong
local PID = 1136
--function to open proc
local op = alien.Kernel32.OpenProcess
op:types{ ret = "pointer", abi = "stdcall"; "int", "int", "int"}
--function to write to proc mem
local wm = alien.Kernel32.WriteProcessMemory
wm:types{ ret = "long", abi = "stdcall"; "pointer", "pointer", "pointer", "long", "pointer" }
local pRef = op(ACCESS, true, PID)
local buf = alien.buffer("99")
-- ptr,uint32,byte arr (no idea what to make this),int, ptr
print( wm( pRef, SCOREREF, buf, 4, nil))
--prints 1 if success, 0 if failed
这就是我的代码。我什至不确定我是否正确设置了类型。
我完全迷失了,需要一些指导。我真的希望有更多关于外星人的在线帮助/文档,这让我可怜的大脑感到困惑。
令我完全困惑的是,WriteProcessMemory有时会成功完成(尽管据我所知,它什么都不做),有时也会无法成功完成。正如我所说,我的大脑很痛。
任何帮助表示赞赏。