Page 1 of 1
Save a program's state
Posted: Mon Jan 03, 2005 5:03 pm
by Bonne_den_kule
Is it possible to save a programs current state/the programs memory?
Which program can do that?
Posted: Mon Jan 03, 2005 5:54 pm
by The_CodeMaster
That's verry difficult, since your program (and all your variables) are somehow randomly (where there is space available) allocated.
I mean if you were capable to capture a programs state, you'll have to put it back in the same memory-adress, else your pointers to variables wil be invalid. Now what if that particullar adress is not available because another program is using it....
A much safer way is to use preference files.
Posted: Mon Jan 03, 2005 7:44 pm
by PB
> A much safer way is to use preference files
From what I can tell, I don't think Bonne_den_kule means in a PureBasic app,
but in apps in general. I'm guessing he's looking for an "Action Replay" type
of app, but I don't think these exist (or are possible) for Windows.
Posted: Tue Jan 04, 2005 2:04 pm
by The_CodeMaster
WinXP can save it's entire state so when you reboot you'll get your desktop back as you left it. The problem is that this is only possible directly before windows starts.
But saving and restoring just a part of the memory

...
From what I can tell, I don't think Bonne_den_kule means in a PureBasic app,
but in apps in general. I'm guessing he's looking for an "Action Replay" type
of app, but I don't think these exist (or are possible) for Windows.
I know, that's why I suggested the use of preference files

Posted: Tue Jan 04, 2005 5:05 pm
by thefool
Action replay
hmm well you could use a macro to get it back to the state you want it in.
Program one in AutoIt [
http://www.hiddensoft.com/autoit3/]
Posted: Tue Jan 04, 2005 7:30 pm
by PB
>> I'm guessing he's looking for an "Action Replay" type of app
>
> I know, that's why I suggested the use of preference files
Do you mean he should code an app that grabs the memory space of an app,
and then save every byte of that memory as a prefs (binary) file?
Posted: Tue Jan 04, 2005 7:52 pm
by Bonne_den_kule
I was thinking about to use it on other programs.
Posted: Tue Jan 04, 2005 8:30 pm
by thefool
well its not easy to make a snapshot of a programs state.. but listen to my advice about the AutoIt..
Posted: Wed Jan 05, 2005 10:24 am
by PB
> its not easy to make a snapshot of a programs state
Hmm, I was just thinking about your trainer lib... what would happen if you
just queried and saved every byte of the app's memory, and then restored
it later? Crash? I would expect it would because the running app wouldn't
be loaded into the same memory space (as the CodeMaster already said).
But wouldn't there be some way around that? I don't know.
Actually (just thought about it some more) does it really matter where the
app is loaded? I regularly play Quake 2 and the address for health, ammo,
etc never changes... I just poke the same address every time. So what's
the reason behind that?