Hi,

I have, for example, the memory address of a double value which is: 245CEA20


I need to do something like this:

double * value = 0;
value+= 0x245CEA20;
std::cout << value << std::endl;

I get a value like 22E75100 which is wrong even if you convert it to decimal format.

Basically asking, how do you get the value from a particular memory address (assume that you know the memory address beforehand).

Hi,

That crashed the program. When debugging my program, it seemed says that 0x245CEA20 is the actual value of *a.

edit:

I'm not 100% sure, but do I have a problem because I am using a windows vista operating system and the code is correct, but the operating system won't let me perform the above? Or is it something else?

Each program on specific operating system is alloted its own memory space which is usually parted into 3 components: stack, heap and data.

When you say that you know the value at location 0x245CEA20, You may be mistaken!!

Suppose I have a variable named a in a program A which is of integer type. I can easily print its address by using the address-of operator.
Now suppose, I build another program which would ask the user to enter a Hex,Decimal value and to print the value pointed by it, it would not be the case that I would find the same value. as a has.
So you can't say "I get a value like 22E75100 which is wrong", you actually can never find the value at a particular location before running the program.

There is more complexity involved than this. The Operating system may continuously change the memory map of your program during its run time !! But you never know the difference as these things are abstracted from you. "Hidden backstage"

You will never need a construct like this though. That is, you would never need to fetch the value of a arbitrary memory location.

> I am using a windows vista operating system and the code is correct,
How do you know the code is correct?

The evidence so far would suggest that the code isn't correct.

Post an actual runnable subset of the code which crashes, not 1-line snippets of your guesses at the solution.

Hi,

This is my code

int main()
{
       double *a = (double*)0x00BB0071;
		std::cout << (*a);                                
}

I have attached a picture showing what my debug window says. No error messages actually occur except for the message saying that there has been a problem.

Now, i get the memory address from cheat engine (I'm not using it for cheating/hacking games though!). Cheat engine shows me the value and the memory address.

Attachments Untitled.jpg 34.18 KB
This article has been dead for over six months. Start a new discussion instead.