微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何指定基址的偏移量

如何解决如何指定基址的偏移量

我无法解决问题3天,我在整个Google上翻遍,但没有发现任何错误。我需要指定一个偏移量,但是我不知道如何在我的代码中使用它,我已经使所有方法失败了,仍然找不到解决方案。

这是我的代码

from ctypes import *
from ctypes import byref
import ctypes
import pymem

#View all Process

OpenProcess = OpenProcess = windll.kernel32.OpenProcess
ReadProcessMemory = windll.kernel32.ReadProcessMemory
CloseHandle = windll.kernel32.CloseHandle

PROCESS_ALL_ACESS = 0x1F0FFF

pid = 2376
buffer = c_char_p(b"The data goes here")
val = c_int()
bufferSize = len(buffer.value)
bytesRead = c_ulonglong(0)

#View Handle Process 

processHandle = OpenProcess(PROCESS_ALL_ACESS,False,pid)

pm = pymem.Pymem("dota2.exe")
dllhandle = pymem.process.module_from_name(pm.process_handle,"client.dll").lpBaSEOfDll

proseccadress = ReadProcessMemory(processHandle,c_int(dllhandle),buffer,bufferSize,byref(bytesRead))
proseccadress = ReadProcessMemory(processHandle,c_int(dllhandle + 0x02822790),c_int(dllhandle + 0x0),c_int(dllhandle + 0x98),c_int(dllhandle + 0x2D0),c_int(dllhandle + 0x340),c_int(dllhandle + 0x158),c_int(dllhandle + 0x388),c_int(dllhandle + 0x208),byref(bytesRead))

memmove(ctypes.byref(val),ctypes.sizeof(val))

print(val.value)
print(processHandle)
print(buffer)

CloseHandle(processHandle)

#Output

#543516756 address value
#288 ProcessH
#c_char_p(1002383236688) Buffer

尽管含义在那里,但它们是不正确的。 但是,如果指定一次性地址,则该值将是正确的。 也许我没有将偏移量正确添加到地址?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。