如何指定基址的偏移量

问题描述

我无法解决问题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 (将#修改为@)