srounet / Pymem

A python library for windows, providing the needed functions to start working on your own with memory editing.
MIT License
303 stars 45 forks source link

Bug ? #52

Closed Ulusamay closed 3 years ago

Ulusamay commented 3 years ago

the function needs 3 arguments, I inform the 3 but the program says I put 4

from pymem import from pymem.process import import psutil, win32process, win32api, win32gui import psutil, win32process, win32api, win32gui import struct

def enderecoBase(): PROCESS_ALL_ACCESS = 0x1F0FFF for proc in psutil.process_iter(): if proc.name() == 'gta_sa.exe': pid = proc.pid PROCESS_ALL_ACCESS = 0x1F0FFF processHandle = win32api.OpenProcess(PROCESS_ALL_ACCESS, False, pid) modules = win32process.EnumProcessModules(processHandle) processHandle.close() base_addr = modules[0] return base_addr

def floatconvert(integer): return struct.unpack('!f', struct.pack('!I', integer))[0] def SomaLocalMaisOffsets(local, offsets): endereco = pm.read_int(local) print('endereco: ', endereco) for i in offsets: if i != offsets[-1]: endereco = pm.read_int(endereco + 1) return endereco + offsets[-1] base = enderecoBase()

print('base:', base, type(base)) pm = pymem.Pymem('gta_sa.exe') localPlayer = (0xB6F5F0) offsets = [0x14, 0x30] resultado = SomaLocalMaisOffsets(localPlayer, offsets) print('resultado:', resultado, type(resultado)) pm.write_float(base, 0x11E424D0, 20) erro

StarrFox commented 3 years ago

you only pass the address and the value to write to write_float

https://pymem.readthedocs.io/en/latest/api.html#pymem.Pymem.write_float

srounet commented 3 years ago

Hi,

straight to the point:

See there: https://github.com/srounet/Pymem/blob/master/tests/test_memory.py#L187

Le 20 avr. 2021 à 18:41, Darlan Amaral da Silva @.***> a écrit :

 the function needs 3 arguments, I inform the 3 but the program says I put 4

from pymem import from pymem.process import import psutil, win32process, win32api, win32gui import psutil, win32process, win32api, win32gui import struct

def enderecoBase(): PROCESS_ALL_ACCESS = 0x1F0FFF for proc in psutil.process_iter(): if proc.name() == 'gta_sa.exe': pid = proc.pid PROCESS_ALL_ACCESS = 0x1F0FFF processHandle = win32api.OpenProcess(PROCESS_ALL_ACCESS, False, pid) modules = win32process.EnumProcessModules(processHandle) processHandle.close() base_addr = modules[0] return base_addr

def floatconvert(integer): return struct.unpack('!f', struct.pack('!I', integer))[0] def SomaLocalMaisOffsets(local, offsets): endereco = pm.read_int(local) print('endereco: ', endereco) for i in offsets: if i != offsets[-1]: endereco = pm.read_int(endereco + 1) return endereco + offsets[-1] base = enderecoBase()

print('base:', base, type(base)) pm = pymem.Pymem('gta_sa.exe') localPlayer = (0xB6F5F0) offsets = [0x14, 0x30] resultado = SomaLocalMaisOffsets(localPlayer, offsets) print('resultado:', resultado, type(resultado)) pm.write_float(base, 0x11E424D0, 20)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Ulusamay commented 3 years ago

thanks starrfox and srounet