views:

171

answers:

2

Is there any library or software or any way of saving the state of a single process in Windows to a file, then restoring the running process to a running state with all the memory already loaded at a later time?

I am aware that open handles will have to be re-opened, threads may have to started, etc, but can the heap and a single thread stack at least be restored?

I saw this question, but the answers are all for linux and most of them say it can't be done.

I know I can make all of my data structures serializable and do it myself, but I'd like to know if it is possible without that.

+3  A: 

Raymond Chen (who may even kick Jon Skeet's ass when it comes to obscure Windows knowledge) says it isn't possible.

Essentially, unless your process uses absolutely no system resources (e.g. handles of any kind), there's always going to be some OS state which you can't save and restore.

The most practical way of solving this problem is to create a VM running another instance of Windows and run your process inside that:

  • You can make the guest OS as lightweight as possible by using nLite.
  • You can then use the VMWare VIX API to suspend/resume the VM programmatically.
  • This of course suspends the guest OS, and your process with it, solving the OS state problem.
snowcrash09
Thanks for the link. Very interesting. I'll consider the VM approach. I'm still out of luck if a guest os patch requires a reboot.
Carlos A. Ibarra
If it's security of the guest OS you're thinking of, I'd be tempted to just enable host-only or NAT-ed networking, so the guest isn't addressable from the Interwebs. And then take the risk of not patching...
snowcrash09
+1  A: 

>> •You can make the guest OS as lightweight as possible by using nLite.

To add to the above statement - The official lightweight version of Windows XP is "XP Embedded" or "Windows Embedded Standard". It is a heavily componentized version of XP that lets you slim down the XP image as small as 40 MB.

The "light weight" version of Windows 7 is Windows Embedded Standard 2011 , which is currently in Beta and available for download (connect.microsoft.com/windowsembedded)

Of course , it is not a freeware unlike NLite.

Thanks,

Srikanth

Srikanth Kamath