.net - Static pointer to Dynamic Address not working (x64) -
i dealing dynamic memory address when tried making game trainer in vb.net programming experience. first time using static pointer point dynamic memory address holds value of ammo clip in game. had run several scans find pointer (0x38bb640) or &h38bb640 in vb.net. 64-bit game had make target cpu x64 while compiling software using .net 4.5. otherwise i'd message saying "32-bit application cannot access memory 64-bit application" in code have makes sense me. have no idea why isn't working properly. return value 0 every time. if add pointer manually in ce offsets 0x30 0x0 0x98 works fine.
private function findaddress(byval phandle intptr, byval baseaddress intptr, byval staticpointer intptr, byval offsets() intptr) intptr ' create buffer 4 bytes on 32-bit system or 8 bytes on 64-bit system. dim tmp(intptr.size - 1) byte dim address intptr = baseaddress ' must check 32-bit vs 64-bit. if intptr.size = 4 address = new intptr(address.toint32 + staticpointer.toint32) else address = new intptr(address.toint64 + staticpointer.toint64) end if ' loop through each offset find address integer = 0 offsets.length - 1 winapi.readprocessmemory(phandle, address, tmp, intptr.size, 0) if intptr.size = 4 address = bitconverter.toint32(tmp, 0) + offsets(i).toint32() else address = bitconverter.toint64(tmp, 0) + offsets(i).toint64() end if next return address end function public sub getammovalue() dim hprocess process() = process.getprocessesbyname("watch_dogs") dim pid intptr = hprocess(0).handle dim base intptr = hprocess(0).mainmodule.baseaddress 'our static pointer ammo dim sptr intptr = &h38bb640 'offsets required base address dim offsets() intptr = {&h30, &h0, &h98} dim addr intptr = findaddress(pid, base, sptr, offsets) dim lpbuffer(8) byte winapi.readprocessmemory(hprocess(0).handle, addr, lpbuffer, 4, 0) msgbox(bitconverter.toint64(lpbuffer, 0)) end sub
winapi.vb:
<dllimport("kernel32.dll", setlasterror:=true)> _ public shared function readprocessmemory( _ byval hprocess intptr, _ byval lpbaseaddress intptr, _ <out()> byval lpbuffer byte(), _ byval dwsize intptr, _ byref lpnumberofbytesread intptr) boolean end function
any ideas why return value 0?
cheat engine shows following:
"disrupt_b64.dll"+038bb640 = 87575f70 + 0x30 = 4c5b3f58 + 0x0 = 61f3b190 + 0x98 = 61f3b226 61f3b226 our address. vb.net not point it. (it can't since returns 0)
Comments
Post a Comment