here is my problem
#include <iostream>
#include <Windows.h>
int main()
{
int coins = 1;
std::cout << &coins <<std::endl;
Sleep(10000);
return 0;
}
the coins value is the one i want to change with the second program
here is the code of the second program
#include <iostream>
int main()
{
int* coins = reinterpret_cast<int*> (0x57da7ffe7c);
std::cout<<*coins<<"\n";
return 0;
}
i expected that it will print the value of coins witch is (1) but it gives me this error (exited with code=3221225477)
the editor i use is vs code
0x57da7ffe7c
is a fixed one in one process, you cannot access it from another like this.3221225477
--> This is0xC0000005
which is an Access Violation. Not sure where or how you expected a totally separate program with its own address space, plus has been terminated is supposed to magically retain0x57da7ffe7c
as the address to another, totally separate program. Imagine you ran program 1 on Monday, and program 2 on Friday -- did you expect the results to show1
after 4 days of your computer running thousands of processes?ReadProcessMemory
.