[vbox-dev] Save state of a headless vm launched with 'launchVmProcess' when windows host shutdown.

Thiago Padilha tpadilha84 at gmail.com
Tue Apr 9 10:00:57 PDT 2013


I've written a very small gui application(system tray icon) that runs
a headless virtualbox when I logon to windows(It is a command line app
so I just place a shortcut on start menu)

The only problem is that I can't make it cleanly exit the vm when I
reboot/shutdown/logoff my laptop. I can listen for windows
WM_ENDSESSION message(https://github.com/tarruda/VBoxTrayIcon/blob/master/api.cpp#L156-L163),
but when my cleanup
is executed the virtual machine is already aborted. I've tested this
by showing a messagebox before the cleanup code, which gave me time to
cancel the logoff and verify that the machine was aborted.

It seems that whatever process manages the background vm is being
killed by windows before I have a chance to send the save command.

How can I fix this issue? Please don't be afraid to look at the code,
the two files combined have like 400 lines of code.

Thanks in advance.

More information about the vbox-dev mailing list