Asking windows for memory on a fixed address
Hi,
I basically want to do something like this:
Code:
struct S
{
int* i;
S():i(new int(5)){}
}
int main()
{
//time t:
std::vector<char> M;
...
S* pS1 = new S; //I use my own version of new which puts the S object into my own memory M
save_M_to_disc();
return;
//time t+x:
load_M_from_disc();
S* pS1 = &M[0];
printf("%d\n", *(pS1->i) ); //prints 5
return;
}
Of course this will not work, because the address there M lives in memory (&M[0]) is probably different on t and t+x.
The solution would be to ask windows for a special range/page of memory which is always on the same address of the virtual process memory.
I think I've seen something like this done on a posix system.
Are there any known solutions for windows?
Thank you in advance!