Rob-- / memoryjs

Read and write process memory in Node.js (Windows API functions exposed via Node bindings)
MIT License
632 stars 86 forks source link

Writing to an adres using pointers #90

Closed stanlee786 closed 2 years ago

stanlee786 commented 2 years ago

Hello, I'm all quite new to this. I'm trying to figure out how this package works. Using assault cube to try reading and writing memory I use cheat engine to get the health address. Then I write to that address and give it a new value like so:

memoryjs.writeMemory(processObject.handle, 0x006C227C, 9999, "int");

Now the address will change when the game reboots and then that address doesn't hold the health value anymore. So in order to get the correct address for the health you would use pointers.

So how do I (if possible) use pointers?

The pointer to the health address is: ac_client.exe + 17B0B8 + EC

memoryjs.writeMemory(processObject.handle, POINTER???, 9999, "int");

Thanks!

Rob-- commented 2 years ago

You need to read the pointer to find the address of the health value, and then you can write the health value:

const pointer = memoryjs.readMemory(processObject.handle, processObject.modBaseAddr + 0x17B0B8, memoryjs.PTR);
memoryjs.writeMemory(processObject.handle, pointer + 0xEC, 9999, memoryjs.INT);
stanlee786 commented 2 years ago

Alright I'll try this, thanks!