JamesMenetrey / MemorySharp

A C# based memory editing library targeting Windows applications, offering various functions to extract and inject data and codes into remote processes to allow interoperability.
Other
634 stars 135 forks source link

equivalent to ReadProcessMemory #19

Closed AtefR closed 5 years ago

AtefR commented 5 years ago

I've been trying to achieve this code with MemorySharp read with address and pointer but without success,

`byte[] object_pointer = new byte[4];

int bytesRead;

var objAddress = Base + 0x4C5F4C;

ReadProcessMemory(App.GameProcess.Process.Handle, objAddress, object_pointer, 4, out bytesRead);`

but i get The relative address cannot be greater than the main module size.

I tried this IntPtr objectPointer = sharp.Read<IntPtr>(Base + 0x4C5F4C);

The problem is there's a pointer stored on memory address i want to read that pointer from the address, the code above works but i have to write more code to change from byte[] to IntPtr to use it again on assembly transaction.

AtefR commented 5 years ago

the solution was add false as second param IntPtr objectPointer = sharp.Read(Base + 0x4C5F4C, false); fml

JamesMenetrey commented 5 years ago

Hey @VincentAA,

This is correct!

Cheers