Write Float to memory

Posts 1–3 of 3 · Page 1 of 1
Write Float to memory
Hello, so far ive been saving integer to memory like this:

Code:
RtlCopyMemory(           //routine copies the contents of a source memory block to a destination memory block.
			INT POINTER TO ADDRESS,				 //A pointer to the destination memory block to copy the bytes to.
		        INT POINTER WITH NUMBERS,            	 //A pointer to the source memory block to copy the bytes from.
			 sizeof(INT)   //The number of bytes to copy from the source to the destination.
			);
But today i tried to save float to the cheat engine tutorial( the 3rd test from the tutorial, the one that has health as float) and i cant get the float value to save correctly, i always get a -4,-2, etc. Ive tried it like this

Code:
RtlCopyMemory(           //routine copies the contents of a source memory block to a destination memory block.
			INT POINTER TO ADDRESS,				 //A pointer to the destination memory block to copy the bytes to.
		        FLOAT POINTER WITH NUMBERS,            	 //A pointer to the source memory block to copy the bytes from.
			 sizeof(FLOAT)   //The number of bytes to copy from the source to the destination.
			);
Im sending 98.888 as the float number

Why its not working with float but with int works just fine? From a programmer point of view aren't they doing the same thing, copy from a source to a destionation, but instead of int its using float
Your code is extremely messy and hard to understand.

Just define the function:
Code:
VOID RtlCopyMemory(
  _Out_       VOID UNALIGNED *Destination,
  _In_  const VOID UNALIGNED *Source,
  _In_        SIZE_T         Length
);
We can guess the parameters...

Anyways, try this:

Code:
float = 0.f;
const int addr = 0xdeaddead;

RtlCopyMemory( &f, PVOID( Address ), 4 );
Quote Originally Posted by Hitokiri~ View Post
Your code is extremely messy and hard to understand.

Just define the function:
Code:
VOID RtlCopyMemory(
  _Out_       VOID UNALIGNED *Destination,
  _In_  const VOID UNALIGNED *Source,
  _In_        SIZE_T         Length
);
We can guess the parameters...

Anyways, try this:

Code:
float = 0.f;
const int addr = 0xdeaddead;

RtlCopyMemory( &f, PVOID( Address ), 4 );
Hey dude, I was actually able to fix this by making a global variable to store the info and then writting that like you said. Does not work if i try it inside the function . Thanks for the response!
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us