我真的没有时间去检查你正在使用的库,但这里有一些提示:
如果你的目标进程作为管理员你的程序将要,也。你也可能想要设置SeDebugPrivileges(如果lib没有自己做)。
If !A_IsAdmin {
Run *RunAs "%A_ScriptFullPath%"
ExitApp
}
SetSeDebugPrivilege()
SetSeDebugPrivilege(enable := True)
{
h := DllCall("OpenProcess", "UInt", 0x0400, "Int", false, "UInt", DllCall("GetCurrentProcessId"), "Ptr")
; Open an adjustable access token with this process (TOKEN_ADJUST_PRIVILEGES = 32)
DllCall("Advapi32.dll\OpenProcessToken", "Ptr", h, "UInt", 32, "PtrP", t)
VarSetCapacity(ti, 16, 0) ; structure of privileges
NumPut(1, ti, 0, "UInt") ; one entry in the privileges array...
; Retrieves the locally unique identifier of the debug privilege:
DllCall("Advapi32.dll\LookupPrivilegeValue", "Ptr", 0, "Str", "SeDebugPrivilege", "Int64P", luid)
NumPut(luid, ti, 4, "Int64")
if enable
NumPut(2, ti, 12, "UInt") ; enable this privilege: SE_PRIVILEGE_ENABLED = 2
; Update the privileges of this process with the new access token:
r := DllCall("Advapi32.dll\AdjustTokenPrivileges", "Ptr", t, "Int", false, "Ptr", &ti, "UInt", 0, "Ptr", 0, "Ptr", 0)
DllCall("CloseHandle", "Ptr", t) ; close this access token handle to save memory
DllCall("CloseHandle", "Ptr", h) ; close this process handle to save memory
return r
}
要读取偏移量,您只需将它们添加到您的地址。所以让我们假装你是阅读游戏的记忆。并且你想读取总是存储在["example.dll"+0x01088450]+0x4
(作为浮点值)的玩家的健康。然后,你会去像这样(如果你用生ReadProcessMemory或类似的工作):
player1moduleOffset := 0x01088450
healthOffset := 0x4
moduleBaseAddress := GetModuleAddr("example.dll")
player1BaseAddress := moduleBaseAddress+player1moduleOffset
player1Base := MemoryReasAsInt(player1BaseAddress)
player1HealthAddress := player1Base+healthOffset
player1Health := MemoryReasAsFloat(player1HealthAddress)
虽然我自己的答案是我需要的恰恰是,你已经把efford的大量提供这个答案。为此我会接受你的表达我的赞赏。 – icecub 2014-09-21 18:39:41