Index: trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
===================================================================
--- trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp	(revision 26322)
+++ trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp	(revision 26323)
@@ -378,6 +378,6 @@
         CHECK_ERROR_RET(a->virtualBox, OpenRemoteSession(a->session, uuid, sessionType,
                                                          env, progress.asOutParam()), rc);
-        RTPrintf("Waiting for the remote session to open...\n");
-        CHECK_ERROR_RET(progress, WaitForCompletion (-1), 1);
+        RTPrintf("Waiting for the VM to power on...\n");
+        CHECK_ERROR_RET(progress, WaitForCompletion(-1), 1);
 
         BOOL completed;
@@ -396,5 +396,5 @@
         else
         {
-            RTPrintf("Remote session has been successfully opened.\n");
+            RTPrintf("VM has been successfully started.\n");
         }
     }
Index: trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 26322)
+++ trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 26323)
@@ -49,4 +49,5 @@
 
 #include "Global.h"
+#include "VirtualBoxErrorInfoImpl.h"
 #include "GuestImpl.h"
 #include "KeyboardImpl.h"
@@ -7406,4 +7407,5 @@
         /* Notify the progress object of the success */
         task->mProgress->notifyComplete(S_OK);
+        console->mControl->SetPowerUpInfo(NULL);
     }
     else
@@ -7411,4 +7413,22 @@
         /* The progress object will fetch the current error info */
         task->mProgress->notifyComplete(rc);
+        ProgressErrorInfo info(task->mProgress);
+        ComObjPtr<VirtualBoxErrorInfo> errorInfo;
+        rc = errorInfo.createObject();
+        if (SUCCEEDED(rc))
+        {
+            errorInfo->init(info.getResultCode(),
+                            info.getInterfaceID(),
+                            info.getComponent(),
+                            info.getText());
+            console->mControl->SetPowerUpInfo(errorInfo);
+        }
+        else
+        {
+            /* If it's not possible to create an IVirtualBoxErrorInfo object
+             * signal success, as not signalling anything will cause a stuck
+             * progress object in VBoxSVC. */
+            console->mControl->SetPowerUpInfo(NULL);
+        }
 
         LogRel(("Power up failed (vrc=%Rrc, rc=%Rhrc (%#08X))\n", vrc, rc, rc));
Index: trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- trunk/src/VBox/Main/MachineImpl.cpp	(revision 26322)
+++ trunk/src/VBox/Main/MachineImpl.cpp	(revision 26323)
@@ -267,8 +267,8 @@
 {
     LogFlowThisFuncEnter();
-    LogFlowThisFunc (("aConfigFile='%s', aMode=%d\n", strConfigFile.raw(), aMode));
-
-    AssertReturn (aParent, E_INVALIDARG);
-    AssertReturn (!strConfigFile.isEmpty(), E_INVALIDARG);
+    LogFlowThisFunc(("aConfigFile='%s', aMode=%d\n", strConfigFile.raw(), aMode));
+
+    AssertReturn(aParent, E_INVALIDARG);
+    AssertReturn(!strConfigFile.isEmpty(), E_INVALIDARG);
     AssertReturn(aMode != Init_New || (aName != NULL && *aName != '\0'),
                   E_INVALIDARG);
@@ -389,5 +389,5 @@
 
                     /* Apply BIOS defaults */
-                    mBIOSSettings->applyDefaults (aOsType);
+                    mBIOSSettings->applyDefaults(aOsType);
 
                     /* Apply network adapters defaults */
@@ -545,5 +545,5 @@
             LogWarningThisFunc(("Setting state to Aborted!\n"));
             /* set machine state using SessionMachine reimplementation */
-            static_cast<Machine*>(mData->mSession.mMachine)->setMachineState (MachineState_Aborted);
+            static_cast<Machine*>(mData->mSession.mMachine)->setMachineState(MachineState_Aborted);
         }
 
@@ -579,5 +579,5 @@
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP Machine::COMGETTER(Parent) (IVirtualBox **aParent)
+STDMETHODIMP Machine::COMGETTER(Parent)(IVirtualBox **aParent)
 {
     CheckComArgOutPointerValid(aParent);
@@ -592,5 +592,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(Accessible) (BOOL *aAccessible)
+STDMETHODIMP Machine::COMGETTER(Accessible)(BOOL *aAccessible)
 {
     CheckComArgOutPointerValid(aAccessible);
@@ -646,5 +646,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(AccessError) (IVirtualBoxErrorInfo **aAccessError)
+STDMETHODIMP Machine::COMGETTER(AccessError)(IVirtualBoxErrorInfo **aAccessError)
 {
     CheckComArgOutPointerValid(aAccessError);
@@ -668,8 +668,8 @@
     if (SUCCEEDED(rc))
     {
-        errorInfo->init (mData->mAccessError.getResultCode(),
-                         mData->mAccessError.getInterfaceID(),
-                         mData->mAccessError.getComponent(),
-                         mData->mAccessError.getText());
+        errorInfo->init(mData->mAccessError.getResultCode(),
+                        mData->mAccessError.getInterfaceID(),
+                        mData->mAccessError.getComponent(),
+                        mData->mAccessError.getText());
         rc = errorInfo.queryInterfaceTo(aAccessError);
     }
@@ -678,5 +678,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(Name) (BSTR *aName)
+STDMETHODIMP Machine::COMGETTER(Name)(BSTR *aName)
 {
     CheckComArgOutPointerValid(aName);
@@ -692,7 +692,7 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(Name) (IN_BSTR aName)
-{
-    CheckComArgNotNull (aName);
+STDMETHODIMP Machine::COMSETTER(Name)(IN_BSTR aName)
+{
+    CheckComArgNotNull(aName);
 
     if (!*aName)
@@ -715,5 +715,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(Description) (BSTR *aDescription)
+STDMETHODIMP Machine::COMGETTER(Description)(BSTR *aDescription)
 {
     CheckComArgOutPointerValid(aDescription);
@@ -729,5 +729,5 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(Description) (IN_BSTR aDescription)
+STDMETHODIMP Machine::COMSETTER(Description)(IN_BSTR aDescription)
 {
     AutoCaller autoCaller(this);
@@ -746,5 +746,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(Id) (BSTR *aId)
+STDMETHODIMP Machine::COMGETTER(Id)(BSTR *aId)
 {
     CheckComArgOutPointerValid(aId);
@@ -760,5 +760,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(OSTypeId) (BSTR *aOSTypeId)
+STDMETHODIMP Machine::COMGETTER(OSTypeId)(BSTR *aOSTypeId)
 {
     CheckComArgOutPointerValid(aOSTypeId);
@@ -774,7 +774,7 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(OSTypeId) (IN_BSTR aOSTypeId)
-{
-    CheckComArgNotNull (aOSTypeId);
+STDMETHODIMP Machine::COMSETTER(OSTypeId)(IN_BSTR aOSTypeId)
+{
+    CheckComArgNotNull(aOSTypeId);
 
     AutoCaller autoCaller(this);
@@ -783,6 +783,5 @@
     /* look up the object by Id to check it is valid */
     ComPtr<IGuestOSType> guestOSType;
-    HRESULT rc = mParent->GetGuestOSType (aOSTypeId,
-                                          guestOSType.asOutParam());
+    HRESULT rc = mParent->GetGuestOSType(aOSTypeId, guestOSType.asOutParam());
     if (FAILED(rc)) return rc;
 
@@ -790,5 +789,5 @@
      * by ID is case-insensitive and the input value may have different case */
     Bstr osTypeId;
-    rc = guestOSType->COMGETTER(Id) (osTypeId.asOutParam());
+    rc = guestOSType->COMGETTER(Id)(osTypeId.asOutParam());
     if (FAILED(rc)) return rc;
 
@@ -806,5 +805,5 @@
 
 
-STDMETHODIMP Machine::COMGETTER(FirmwareType) (FirmwareType_T *aFirmwareType)
+STDMETHODIMP Machine::COMGETTER(FirmwareType)(FirmwareType_T *aFirmwareType)
 {
     CheckComArgOutPointerValid(aFirmwareType);
@@ -820,5 +819,5 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(FirmwareType) (FirmwareType_T aFirmwareType)
+STDMETHODIMP Machine::COMSETTER(FirmwareType)(FirmwareType_T aFirmwareType)
 {
     AutoCaller autoCaller(this);
@@ -836,5 +835,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(HardwareVersion) (BSTR *aHWVersion)
+STDMETHODIMP Machine::COMGETTER(HardwareVersion)(BSTR *aHWVersion)
 {
     if (!aHWVersion)
@@ -851,10 +850,10 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(HardwareVersion) (IN_BSTR aHWVersion)
+STDMETHODIMP Machine::COMSETTER(HardwareVersion)(IN_BSTR aHWVersion)
 {
     /* check known version */
     Utf8Str hwVersion = aHWVersion;
-    if (    hwVersion.compare ("1") != 0
-        &&  hwVersion.compare ("2") != 0)
+    if (    hwVersion.compare("1") != 0
+        &&  hwVersion.compare("2") != 0)
         return setError(E_INVALIDARG,
                         tr("Invalid hardware version: %ls\n"), aHWVersion);
@@ -892,5 +891,5 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(HardwareUUID) (IN_BSTR aUUID)
+STDMETHODIMP Machine::COMSETTER(HardwareUUID)(IN_BSTR aUUID)
 {
     Guid hardwareUUID(aUUID);
@@ -916,5 +915,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(MemorySize) (ULONG *memorySize)
+STDMETHODIMP Machine::COMGETTER(MemorySize)(ULONG *memorySize)
 {
     if (!memorySize)
@@ -931,5 +930,5 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(MemorySize) (ULONG memorySize)
+STDMETHODIMP Machine::COMSETTER(MemorySize)(ULONG memorySize)
 {
     /* check RAM limits */
@@ -956,5 +955,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(CPUCount) (ULONG *CPUCount)
+STDMETHODIMP Machine::COMGETTER(CPUCount)(ULONG *CPUCount)
 {
     if (!CPUCount)
@@ -971,5 +970,5 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(CPUCount) (ULONG CPUCount)
+STDMETHODIMP Machine::COMSETTER(CPUCount)(ULONG CPUCount)
 {
     /* check CPU limits */
@@ -1008,5 +1007,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(CPUHotPlugEnabled) (BOOL *enabled)
+STDMETHODIMP Machine::COMGETTER(CPUHotPlugEnabled)(BOOL *enabled)
 {
     if (!enabled)
@@ -1023,5 +1022,5 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(CPUHotPlugEnabled) (BOOL enabled)
+STDMETHODIMP Machine::COMSETTER(CPUHotPlugEnabled)(BOOL enabled)
 {
     HRESULT rc = S_OK;
@@ -1081,5 +1080,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(VRAMSize) (ULONG *memorySize)
+STDMETHODIMP Machine::COMGETTER(VRAMSize)(ULONG *memorySize)
 {
     if (!memorySize)
@@ -1096,5 +1095,5 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(VRAMSize) (ULONG memorySize)
+STDMETHODIMP Machine::COMSETTER(VRAMSize)(ULONG memorySize)
 {
     /* check VRAM limits */
@@ -1121,5 +1120,5 @@
 
 /** @todo this method should not be public */
-STDMETHODIMP Machine::COMGETTER(MemoryBalloonSize) (ULONG *memoryBalloonSize)
+STDMETHODIMP Machine::COMGETTER(MemoryBalloonSize)(ULONG *memoryBalloonSize)
 {
     if (!memoryBalloonSize)
@@ -1137,11 +1136,11 @@
 
 /** @todo this method should not be public */
-STDMETHODIMP Machine::COMSETTER(MemoryBalloonSize) (ULONG memoryBalloonSize)
+STDMETHODIMP Machine::COMSETTER(MemoryBalloonSize)(ULONG memoryBalloonSize)
 {
     /* check limits */
-    if (memoryBalloonSize >= VMMDEV_MAX_MEMORY_BALLOON (mHWData->mMemorySize))
+    if (memoryBalloonSize >= VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize))
         return setError(E_INVALIDARG,
                         tr("Invalid memory balloon size: %lu MB (must be in range [%lu, %lu] MB)"),
-                        memoryBalloonSize, 0, VMMDEV_MAX_MEMORY_BALLOON (mHWData->mMemorySize));
+                        memoryBalloonSize, 0, VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize));
 
     AutoCaller autoCaller(this);
@@ -1161,5 +1160,5 @@
 
 /** @todo this method should not be public */
-STDMETHODIMP Machine::COMGETTER(StatisticsUpdateInterval) (ULONG *statisticsUpdateInterval)
+STDMETHODIMP Machine::COMGETTER(StatisticsUpdateInterval)(ULONG *statisticsUpdateInterval)
 {
     if (!statisticsUpdateInterval)
@@ -1177,5 +1176,5 @@
 
 /** @todo this method should not be public */
-STDMETHODIMP Machine::COMSETTER(StatisticsUpdateInterval) (ULONG statisticsUpdateInterval)
+STDMETHODIMP Machine::COMSETTER(StatisticsUpdateInterval)(ULONG statisticsUpdateInterval)
 {
     AutoCaller autoCaller(this);
@@ -1264,5 +1263,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(MonitorCount) (ULONG *monitorCount)
+STDMETHODIMP Machine::COMGETTER(MonitorCount)(ULONG *monitorCount)
 {
     if (!monitorCount)
@@ -1279,5 +1278,5 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(MonitorCount) (ULONG monitorCount)
+STDMETHODIMP Machine::COMSETTER(MonitorCount)(ULONG monitorCount)
 {
     /* make sure monitor count is a sensible number */
@@ -1636,5 +1635,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(SnapshotFolder) (BSTR *aSnapshotFolder)
+STDMETHODIMP Machine::COMGETTER(SnapshotFolder)(BSTR *aSnapshotFolder)
 {
     CheckComArgOutPointerValid(aSnapshotFolder);
@@ -1650,5 +1649,5 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(SnapshotFolder) (IN_BSTR aSnapshotFolder)
+STDMETHODIMP Machine::COMSETTER(SnapshotFolder)(IN_BSTR aSnapshotFolder)
 {
     /* @todo (r=dmik):
@@ -1754,5 +1753,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(USBController) (IUSBController **aUSBController)
+STDMETHODIMP Machine::COMGETTER(USBController)(IUSBController **aUSBController)
 {
 #ifdef VBOX_WITH_USB
@@ -1777,5 +1776,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(SettingsFilePath) (BSTR *aFilePath)
+STDMETHODIMP Machine::COMGETTER(SettingsFilePath)(BSTR *aFilePath)
 {
     CheckComArgOutPointerValid(aFilePath);
@@ -1790,5 +1789,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(SettingsModified) (BOOL *aModified)
+STDMETHODIMP Machine::COMGETTER(SettingsModified)(BOOL *aModified)
 {
     CheckComArgOutPointerValid(aModified);
@@ -1813,5 +1812,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(SessionState) (SessionState_T *aSessionState)
+STDMETHODIMP Machine::COMGETTER(SessionState)(SessionState_T *aSessionState)
 {
     CheckComArgOutPointerValid(aSessionState);
@@ -1827,5 +1826,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(SessionType) (BSTR *aSessionType)
+STDMETHODIMP Machine::COMGETTER(SessionType)(BSTR *aSessionType)
 {
     CheckComArgOutPointerValid(aSessionType);
@@ -1844,5 +1843,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(SessionPid) (ULONG *aSessionPid)
+STDMETHODIMP Machine::COMGETTER(SessionPid)(ULONG *aSessionPid)
 {
     CheckComArgOutPointerValid(aSessionPid);
@@ -1858,5 +1857,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(State) (MachineState_T *machineState)
+STDMETHODIMP Machine::COMGETTER(State)(MachineState_T *machineState)
 {
     if (!machineState)
@@ -1873,5 +1872,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(LastStateChange) (LONG64 *aLastStateChange)
+STDMETHODIMP Machine::COMGETTER(LastStateChange)(LONG64 *aLastStateChange)
 {
     CheckComArgOutPointerValid(aLastStateChange);
@@ -1882,10 +1881,10 @@
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aLastStateChange = RTTimeSpecGetMilli (&mData->mLastStateChange);
-
-    return S_OK;
-}
-
-STDMETHODIMP Machine::COMGETTER(StateFilePath) (BSTR *aStateFilePath)
+    *aLastStateChange = RTTimeSpecGetMilli(&mData->mLastStateChange);
+
+    return S_OK;
+}
+
+STDMETHODIMP Machine::COMGETTER(StateFilePath)(BSTR *aStateFilePath)
 {
     CheckComArgOutPointerValid(aStateFilePath);
@@ -1904,5 +1903,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(LogFolder) (BSTR *aLogFolder)
+STDMETHODIMP Machine::COMGETTER(LogFolder)(BSTR *aLogFolder)
 {
     CheckComArgOutPointerValid(aLogFolder);
@@ -1914,5 +1913,5 @@
 
     Utf8Str logFolder;
-    getLogFolder (logFolder);
+    getLogFolder(logFolder);
 
     Bstr (logFolder).cloneTo(aLogFolder);
@@ -1951,5 +1950,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(CurrentStateModified) (BOOL *aCurrentStateModified)
+STDMETHODIMP Machine::COMGETTER(CurrentStateModified)(BOOL *aCurrentStateModified)
 {
     CheckComArgOutPointerValid(aCurrentStateModified);
@@ -1971,5 +1970,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(SharedFolders) (ComSafeArrayOut(ISharedFolder *, aSharedFolders))
+STDMETHODIMP Machine::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolders))
 {
     CheckComArgOutSafeArrayPointerValid(aSharedFolders);
@@ -1986,5 +1985,5 @@
 }
 
-STDMETHODIMP Machine::COMGETTER(ClipboardMode) (ClipboardMode_T *aClipboardMode)
+STDMETHODIMP Machine::COMGETTER(ClipboardMode)(ClipboardMode_T *aClipboardMode)
 {
     CheckComArgOutPointerValid(aClipboardMode);
@@ -2001,5 +2000,5 @@
 
 STDMETHODIMP
-Machine::COMSETTER(ClipboardMode) (ClipboardMode_T aClipboardMode)
+Machine::COMSETTER(ClipboardMode)(ClipboardMode_T aClipboardMode)
 {
     AutoCaller autoCaller(this);
@@ -2059,5 +2058,5 @@
 
 STDMETHODIMP
-Machine::COMGETTER(StorageControllers) (ComSafeArrayOut(IStorageController *, aStorageControllers))
+Machine::COMGETTER(StorageControllers)(ComSafeArrayOut(IStorageController *, aStorageControllers))
 {
     CheckComArgOutSafeArrayPointerValid(aStorageControllers);
@@ -2068,5 +2067,5 @@
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IStorageController> ctrls (*mStorageControllers.data());
+    SafeIfaceArray<IStorageController> ctrls(*mStorageControllers.data());
     ctrls.detachTo(ComSafeArrayOutArg(aStorageControllers));
 
@@ -2261,5 +2260,5 @@
     if (aPosition < 1 || aPosition > SchemaDefs::MaxBootPosition)
         return setError(E_INVALIDARG,
-                        tr ("Invalid boot position: %lu (must be in range [1, %lu])"),
+                        tr("Invalid boot position: %lu (must be in range [1, %lu])"),
                         aPosition, SchemaDefs::MaxBootPosition);
 
@@ -2283,5 +2282,5 @@
 }
 
-STDMETHODIMP Machine::GetBootOrder (ULONG aPosition, DeviceType_T *aDevice)
+STDMETHODIMP Machine::GetBootOrder(ULONG aPosition, DeviceType_T *aDevice)
 {
     if (aPosition < 1 || aPosition > SchemaDefs::MaxBootPosition)
@@ -3329,5 +3328,5 @@
 }
 
-STDMETHODIMP Machine::GetSnapshot (IN_BSTR aId, ISnapshot **aSnapshot)
+STDMETHODIMP Machine::GetSnapshot(IN_BSTR aId, ISnapshot **aSnapshot)
 {
     CheckComArgOutPointerValid(aSnapshot);
@@ -3360,7 +3359,7 @@
 }
 
-STDMETHODIMP Machine::FindSnapshot (IN_BSTR aName, ISnapshot **aSnapshot)
-{
-    CheckComArgNotNull (aName);
+STDMETHODIMP Machine::FindSnapshot(IN_BSTR aName, ISnapshot **aSnapshot)
+{
+    CheckComArgNotNull(aName);
     CheckComArgOutPointerValid(aSnapshot);
 
@@ -3378,5 +3377,5 @@
 }
 
-STDMETHODIMP Machine::SetCurrentSnapshot (IN_BSTR /* aId */)
+STDMETHODIMP Machine::SetCurrentSnapshot(IN_BSTR /* aId */)
 {
     /// @todo (dmik) don't forget to set
@@ -3386,5 +3385,5 @@
 }
 
-STDMETHODIMP Machine::CreateSharedFolder (IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
+STDMETHODIMP Machine::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
 {
     CheckComArgNotNull(aName);
@@ -3400,5 +3399,5 @@
 
     ComObjPtr<SharedFolder> sharedFolder;
-    rc = findSharedFolder (aName, sharedFolder, false /* aSetError */);
+    rc = findSharedFolder(aName, sharedFolder, false /* aSetError */);
     if (SUCCEEDED(rc))
         return setError(VBOX_E_OBJECT_IN_USE,
@@ -3412,5 +3411,5 @@
     setModified(IsModified_SharedFolders);
     mHWData.backup();
-    mHWData->mSharedFolders.push_back (sharedFolder);
+    mHWData->mSharedFolders.push_back(sharedFolder);
 
     /* inform the direct session if any */
@@ -3421,7 +3420,7 @@
 }
 
-STDMETHODIMP Machine::RemoveSharedFolder (IN_BSTR aName)
-{
-    CheckComArgNotNull (aName);
+STDMETHODIMP Machine::RemoveSharedFolder(IN_BSTR aName)
+{
+    CheckComArgNotNull(aName);
 
     AutoCaller autoCaller(this);
@@ -3434,10 +3433,10 @@
 
     ComObjPtr<SharedFolder> sharedFolder;
-    rc = findSharedFolder (aName, sharedFolder, true /* aSetError */);
+    rc = findSharedFolder(aName, sharedFolder, true /* aSetError */);
     if (FAILED(rc)) return rc;
 
     setModified(IsModified_SharedFolders);
     mHWData.backup();
-    mHWData->mSharedFolders.remove (sharedFolder);
+    mHWData->mSharedFolders.remove(sharedFolder);
 
     /* inform the direct session if any */
@@ -3448,5 +3447,5 @@
 }
 
-STDMETHODIMP Machine::CanShowConsoleWindow (BOOL *aCanShow)
+STDMETHODIMP Machine::CanShowConsoleWindow(BOOL *aCanShow)
 {
     CheckComArgOutPointerValid(aCanShow);
@@ -3475,13 +3474,13 @@
 
     ULONG64 dummy;
-    return directControl->OnShowWindow (TRUE /* aCheck */, aCanShow, &dummy);
-}
-
-STDMETHODIMP Machine::ShowConsoleWindow (ULONG64 *aWinId)
+    return directControl->OnShowWindow(TRUE /* aCheck */, aCanShow, &dummy);
+}
+
+STDMETHODIMP Machine::ShowConsoleWindow(ULONG64 *aWinId)
 {
     CheckComArgOutPointerValid(aWinId);
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     ComPtr<IInternalSessionControl> directControl;
@@ -3502,5 +3501,5 @@
 
     BOOL dummy;
-    return directControl->OnShowWindow (FALSE /* aCheck */, &dummy, aWinId);
+    return directControl->OnShowWindow(FALSE /* aCheck */, &dummy, aWinId);
 }
 
@@ -3510,7 +3509,7 @@
                                        BSTR *aFlags)
 {
-#if !defined (VBOX_WITH_GUEST_PROPS)
+#ifndef VBOX_WITH_GUEST_PROPS
     ReturnComNotImplemented();
-#else
+#else // VBOX_WITH_GUEST_PROPS
     CheckComArgNotNull(aName);
     CheckComArgOutPointerValid(aValue);
@@ -3561,24 +3560,24 @@
             rc = E_FAIL;
         else
-            rc = directControl->AccessGuestProperty (aName, NULL, NULL,
-                                                     false /* isSetter */,
-                                                     aValue, aTimestamp, aFlags);
+            rc = directControl->AccessGuestProperty(aName, NULL, NULL,
+                                                    false /* isSetter */,
+                                                    aValue, aTimestamp, aFlags);
     }
     return rc;
-#endif /* else !defined (VBOX_WITH_GUEST_PROPS) */
-}
-
-STDMETHODIMP Machine::GetGuestPropertyValue (IN_BSTR aName, BSTR *aValue)
+#endif // VBOX_WITH_GUEST_PROPS
+}
+
+STDMETHODIMP Machine::GetGuestPropertyValue(IN_BSTR aName, BSTR *aValue)
 {
     ULONG64 dummyTimestamp;
     BSTR dummyFlags;
-    return GetGuestProperty (aName, aValue, &dummyTimestamp, &dummyFlags);
-}
-
-STDMETHODIMP Machine::GetGuestPropertyTimestamp (IN_BSTR aName, ULONG64 *aTimestamp)
+    return GetGuestProperty(aName, aValue, &dummyTimestamp, &dummyFlags);
+}
+
+STDMETHODIMP Machine::GetGuestPropertyTimestamp(IN_BSTR aName, ULONG64 *aTimestamp)
 {
     BSTR dummyValue;
     BSTR dummyFlags;
-    return GetGuestProperty (aName, &dummyValue, aTimestamp, &dummyFlags);
+    return GetGuestProperty(aName, &dummyValue, aTimestamp, &dummyFlags);
 }
 
@@ -3587,12 +3586,12 @@
                                        IN_BSTR aFlags)
 {
-#if !defined (VBOX_WITH_GUEST_PROPS)
+#ifndef VBOX_WITH_GUEST_PROPS
     ReturnComNotImplemented();
-#else
+#else // VBOX_WITH_GUEST_PROPS
     using namespace guestProp;
 
     CheckComArgNotNull(aName);
     CheckComArgNotNull(aValue);
-    if ((aFlags != NULL) && !VALID_PTR (aFlags))
+    if ((aFlags != NULL) && !VALID_PTR(aFlags))
         return E_INVALIDARG;
 
@@ -3615,5 +3614,5 @@
         uint32_t fFlags = NILFLAG;
         if (    (aFlags != NULL)
-             && RT_FAILURE(validateFlags (utf8Flags.raw(), &fFlags))
+             && RT_FAILURE(validateFlags(utf8Flags.raw(), &fFlags))
            )
             return setError(E_INVALIDARG,
@@ -3664,5 +3663,5 @@
                     if (aFlags != NULL)
                         property.mFlags = fFlags;
-                    mHWData->mGuestProperties.push_back (property);
+                    mHWData->mGuestProperties.push_back(property);
                 }
             }
@@ -3676,5 +3675,5 @@
                 property.mTimestamp = RTTimeSpecGetNano(RTTimeNow(&time));
                 property.mFlags = fFlags;
-                mHWData->mGuestProperties.push_back (property);
+                mHWData->mGuestProperties.push_back(property);
             }
             if (   SUCCEEDED(rc)
@@ -3715,10 +3714,10 @@
 
     return rc;
-#endif /* else !defined (VBOX_WITH_GUEST_PROPS) */
-}
-
-STDMETHODIMP Machine::SetGuestPropertyValue (IN_BSTR aName, IN_BSTR aValue)
-{
-    return SetGuestProperty (aName, aValue, NULL);
+#endif // VBOX_WITH_GUEST_PROPS
+}
+
+STDMETHODIMP Machine::SetGuestPropertyValue(IN_BSTR aName, IN_BSTR aValue)
+{
+    return SetGuestProperty(aName, aValue, NULL);
 }
 
@@ -3729,8 +3728,8 @@
                                                ComSafeArrayOut(BSTR, aFlags))
 {
-#if !defined (VBOX_WITH_GUEST_PROPS)
+#ifndef VBOX_WITH_GUEST_PROPS
     ReturnComNotImplemented();
-#else
-    if (!VALID_PTR (aPatterns) && (aPatterns != NULL))
+#else // VBOX_WITH_GUEST_PROPS
+    if (!VALID_PTR(aPatterns) && (aPatterns != NULL))
         return E_POINTER;
 
@@ -3772,8 +3771,8 @@
          */
         size_t cEntries = propList.size();
-        SafeArray<BSTR> names (cEntries);
-        SafeArray<BSTR> values (cEntries);
-        SafeArray<ULONG64> timestamps (cEntries);
-        SafeArray<BSTR> flags (cEntries);
+        SafeArray<BSTR> names(cEntries);
+        SafeArray<BSTR> values(cEntries);
+        SafeArray<ULONG64> timestamps(cEntries);
+        SafeArray<BSTR> flags(cEntries);
         size_t iProp = 0;
         for (HWData::GuestPropertyList::iterator it = propList.begin();
@@ -3812,5 +3811,5 @@
     }
     return rc;
-#endif /* else !defined (VBOX_WITH_GUEST_PROPS) */
+#endif // VBOX_WITH_GUEST_PROPS
 }
 
@@ -3884,5 +3883,5 @@
     ComObjPtr<StorageController> ctrl;
 
-    rc = getStorageControllerByName (aName, ctrl, false /* aSetError */);
+    rc = getStorageControllerByName(aName, ctrl, false /* aSetError */);
     if (SUCCEEDED(rc))
         return setError(VBOX_E_OBJECT_IN_USE,
@@ -3912,5 +3911,5 @@
     setModified(IsModified_Storage);
     mStorageControllers.backup();
-    mStorageControllers->push_back (ctrl);
+    mStorageControllers->push_back(ctrl);
 
     ctrl.queryInterfaceTo(controller);
@@ -3935,5 +3934,5 @@
     ComObjPtr<StorageController> ctrl;
 
-    HRESULT rc = getStorageControllerByName (aName, ctrl, true /* aSetError */);
+    HRESULT rc = getStorageControllerByName(aName, ctrl, true /* aSetError */);
     if (SUCCEEDED(rc))
         ctrl.queryInterfaceTo(aStorageController);
@@ -3979,5 +3978,5 @@
 
     ComObjPtr<StorageController> ctrl;
-    rc = getStorageControllerByName (aName, ctrl, true /* aSetError */);
+    rc = getStorageControllerByName(aName, ctrl, true /* aSetError */);
     if (FAILED(rc)) return rc;
 
@@ -4000,5 +3999,5 @@
     ctrl->unshare();
 
-    mStorageControllers->remove (ctrl);
+    mStorageControllers->remove(ctrl);
 
     /* inform the direct session if any */
@@ -4056,7 +4055,7 @@
                     if (typeOfBlock == u32Type)
                     {
-                        if (cbBlock > 2 * sizeof (uint32_t))
+                        if (cbBlock > 2 * sizeof(uint32_t))
                         {
-                            cbData = cbBlock - 2 * sizeof (uint32_t);
+                            cbData = cbBlock - 2 * sizeof(uint32_t);
                             pu8Data = (uint8_t *)RTMemAlloc(cbData);
                             if (pu8Data == NULL)
@@ -4444,9 +4443,9 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AssertReturn (!mData->m_strConfigFileFull.isEmpty(), VERR_GENERAL_FAILURE);
+    AssertReturn(!mData->m_strConfigFileFull.isEmpty(), VERR_GENERAL_FAILURE);
 
     Utf8Str strSettingsDir = mData->m_strConfigFileFull;
@@ -4475,9 +4474,9 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), (void) 0);
+    AssertComRCReturn(autoCaller.rc(), (void)0);
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AssertReturnVoid (!mData->m_strConfigFileFull.isEmpty());
+    AssertReturnVoid(!mData->m_strConfigFileFull.isEmpty());
 
     Utf8Str settingsDir = mData->m_strConfigFileFull;
@@ -4499,16 +4498,16 @@
  *  \a aLogFolder argument.
  */
-void Machine::getLogFolder (Utf8Str &aLogFolder)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+void Machine::getLogFolder(Utf8Str &aLogFolder)
+{
+    AutoCaller autoCaller(this);
+    AssertComRCReturnVoid(autoCaller.rc());
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     Utf8Str settingsDir;
-    if (isInOwnDir (&settingsDir))
+    if (isInOwnDir(&settingsDir))
     {
         /* Log folder is <Machines>/<VM_Name>/Logs */
-        aLogFolder = Utf8StrFmt ("%s%cLogs", settingsDir.raw(), RTPATH_DELIMITER);
+        aLogFolder = Utf8StrFmt("%s%cLogs", settingsDir.raw(), RTPATH_DELIMITER);
     }
     else
@@ -4727,11 +4726,4 @@
     }
 
-    if (mData->mSession.mProgress)
-    {
-        /* finalize the progress after setting the state, for consistency */
-        mData->mSession.mProgress->notifyComplete(rc);
-        mData->mSession.mProgress.setNull();
-    }
-
     /* Leave the lock since SessionMachine::uninit() locks VirtualBox which
      * would break the lock order */
@@ -4781,5 +4773,5 @@
 
     /* may not be busy */
-    AssertReturn(!Global::IsOnlineOrTransient (mData->mMachineState), E_FAIL);
+    AssertReturn(!Global::IsOnlineOrTransient(mData->mMachineState), E_FAIL);
 
     /* get the path to the executable */
@@ -4821,12 +4813,12 @@
                     if (*var)
                     {
-                        char *val = strchr (var, '=');
+                        char *val = strchr(var, '=');
                         if (val)
                         {
                             *val++ = '\0';
-                            vrc2 = RTEnvSetEx (env, var, val);
+                            vrc2 = RTEnvSetEx(env, var, val);
                         }
                         else
-                            vrc2 = RTEnvUnsetEx (env, var);
+                            vrc2 = RTEnvUnsetEx(env, var);
                         if (RT_FAILURE(vrc2))
                             break;
@@ -4836,7 +4828,7 @@
             }
             if (RT_SUCCESS(vrc2) && *var)
-                vrc2 = RTEnvPutEx (env, var);
-
-            AssertRCBreakStmt (vrc2, vrc = vrc2);
+                vrc2 = RTEnvPutEx(env, var);
+
+            AssertRCBreakStmt(vrc2, vrc = vrc2);
         }
         while (0);
@@ -4857,6 +4849,6 @@
         const char VirtualBox_exe[] = "VirtualBox" HOSTSUFF_EXE;
 # endif
-        Assert(sz >= sizeof (VirtualBox_exe));
-        strcpy (cmd, VirtualBox_exe);
+        Assert(sz >= sizeof(VirtualBox_exe));
+        strcpy(cmd, VirtualBox_exe);
 
         Utf8Str idStr = mData->mUuid.toString();
@@ -4880,6 +4872,6 @@
     {
         const char VBoxSDL_exe[] = "VBoxSDL" HOSTSUFF_EXE;
-        Assert(sz >= sizeof (VBoxSDL_exe));
-        strcpy (cmd, VBoxSDL_exe);
+        Assert(sz >= sizeof(VBoxSDL_exe));
+        strcpy(cmd, VBoxSDL_exe);
 
         Utf8Str idStr = mData->mUuid.toString();
@@ -4908,6 +4900,6 @@
     {
         const char VBoxHeadless_exe[] = "VBoxHeadless" HOSTSUFF_EXE;
-        Assert(sz >= sizeof (VBoxHeadless_exe));
-        strcpy (cmd, VBoxHeadless_exe);
+        Assert(sz >= sizeof(VBoxHeadless_exe));
+        strcpy(cmd, VBoxHeadless_exe);
 
         Utf8Str idStr = mData->mUuid.toString();
@@ -4917,5 +4909,5 @@
 # else
         Utf8Str strName = mUserData->mName;
-        const char * args[] ={szPath, "--comment", strName.c_str(), "--startvm", idStr.c_str(), 0, 0, 0 };
+        const char * args[] = {szPath, "--comment", strName.c_str(), "--startvm", idStr.c_str(), 0, 0, 0 };
 # endif
 #ifdef VBOX_WITH_VRDP
@@ -4940,5 +4932,5 @@
     else
     {
-        RTEnvDestroy (env);
+        RTEnvDestroy(env);
         return setError(E_INVALIDARG,
                         tr("Invalid session type: '%s'"),
@@ -4946,5 +4938,5 @@
     }
 
-    RTEnvDestroy (env);
+    RTEnvDestroy(env);
 
     if (RT_FAILURE(vrc))
@@ -4966,5 +4958,5 @@
     /* inform the session that it will be a remote one */
     LogFlowThisFunc(("Calling AssignMachine (NULL)...\n"));
-    HRESULT rc = aControl->AssignMachine (NULL);
+    HRESULT rc = aControl->AssignMachine(NULL);
     LogFlowThisFunc(("AssignMachine (NULL) returned %08X\n", rc));
 
@@ -4994,5 +4986,5 @@
  *        (outside the lock).
  */
-HRESULT Machine::openExistingSession (IInternalSessionControl *aControl)
+HRESULT Machine::openExistingSession(IInternalSessionControl *aControl)
 {
     LogFlowThisFuncEnter();
@@ -5087,22 +5079,22 @@
  * @note locks this object for reading.
  */
-#if defined (RT_OS_WINDOWS)
-bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine,
-                             ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
-                             HANDLE *aIPCSem /*= NULL*/,
-                             bool aAllowClosing /*= false*/)
-#elif defined (RT_OS_OS2)
-bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine,
-                             ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
-                             HMTX *aIPCSem /*= NULL*/,
-                             bool aAllowClosing /*= false*/)
+#if defined(RT_OS_WINDOWS)
+bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
+                            ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
+                            HANDLE *aIPCSem /*= NULL*/,
+                            bool aAllowClosing /*= false*/)
+#elif defined(RT_OS_OS2)
+bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
+                            ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
+                            HMTX *aIPCSem /*= NULL*/,
+                            bool aAllowClosing /*= false*/)
 #else
-bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine,
-                             ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
-                             bool aAllowClosing /*= false*/)
+bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
+                            ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
+                            bool aAllowClosing /*= false*/)
 #endif
 {
     AutoLimitedCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), false);
+    AssertComRCReturn(autoCaller.rc(), false);
 
     /* just return false for inaccessible machines */
@@ -5122,5 +5114,5 @@
             *aControl = mData->mSession.mDirectControl;
 
-#if defined (RT_OS_WINDOWS) || defined (RT_OS_OS2)
+#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
         /* Additional session data */
         if (aIPCSem != NULL)
@@ -5143,6 +5135,6 @@
  * @note locks this object for reading.
  */
-#if defined (RT_OS_WINDOWS) || defined (RT_OS_OS2)
-bool Machine::isSessionSpawning (RTPROCESS *aPID /*= NULL*/)
+#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
+bool Machine::isSessionSpawning(RTPROCESS *aPID /*= NULL*/)
 #else
 bool Machine::isSessionSpawning()
@@ -5150,5 +5142,5 @@
 {
     AutoLimitedCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), false);
+    AssertComRCReturn(autoCaller.rc(), false);
 
     /* just return false for inaccessible machines */
@@ -5160,5 +5152,5 @@
     if (mData->mSession.mState == SessionState_Spawning)
     {
-#if defined (RT_OS_WINDOWS) || defined (RT_OS_OS2)
+#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
         /* Additional session data */
         if (aPID != NULL)
@@ -5249,5 +5241,5 @@
         mData->mSession.mState = SessionState_Closed;
 
-        /* finalize the progress after setting the state, for consistency */
+        /* finalize the progress after setting the state */
         if (!mData->mSession.mProgress.isNull())
         {
@@ -5380,5 +5372,5 @@
     {
         /* we may have had implicit modifications we want to cancel on failure*/
-        rollback (false /* aNotify */);
+        rollback(false /* aNotify */);
     }
 
@@ -5405,7 +5397,7 @@
  * @note Locks this object for writing.
  */
-HRESULT Machine::addStateDependency (StateDependency aDepType /* = AnyStateDep */,
-                                     MachineState_T *aState /* = NULL */,
-                                     BOOL *aRegistered /* = NULL */)
+HRESULT Machine::addStateDependency(StateDependency aDepType /* = AnyStateDep */,
+                                    MachineState_T *aState /* = NULL */,
+                                    BOOL *aRegistered /* = NULL */)
 {
     AutoCaller autoCaller(this);
@@ -5452,10 +5444,10 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AssertReturnVoid (mData->mMachineStateDeps != 0
-                      /* releaseStateDependency() w/o addStateDependency()? */);
+    /* releaseStateDependency() w/o addStateDependency()? */
+    AssertReturnVoid(mData->mMachineStateDeps != 0);
     -- mData->mMachineStateDeps;
 
@@ -5563,6 +5555,6 @@
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
-    AssertComRCReturn (autoCaller.state() == InInit ||
-                       autoCaller.state() == Limited, E_FAIL);
+    AssertComRCReturn(autoCaller.state() == InInit ||
+                      autoCaller.state() == Limited, E_FAIL);
 
     AssertReturn(!mData->mAccessible, E_FAIL);
@@ -5716,5 +5708,5 @@
                 continue;
             HRESULT rc = hd->detachFrom(mData->mUuid, getSnapshotId());
-            AssertComRC (rc);
+            AssertComRC(rc);
         }
     }
@@ -5760,5 +5752,5 @@
 void Machine::ensureNoStateDependencies()
 {
-    AssertReturnVoid (isWriteLockOnCurrentThread());
+    AssertReturnVoid(isWriteLockOnCurrentThread());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -5769,5 +5761,5 @@
         /* lazy semaphore creation */
         if (mData->mMachineStateDepsSem == NIL_RTSEMEVENTMULTI)
-            RTSemEventMultiCreate (&mData->mMachineStateDepsSem);
+            RTSemEventMultiCreate(&mData->mMachineStateDepsSem);
 
         LogFlowThisFunc(("Waiting for state deps (%d) to drop to zero...\n",
@@ -5778,9 +5770,9 @@
         /* reset the semaphore before waiting, the last dependant will signal
          * it */
-        RTSemEventMultiReset (mData->mMachineStateDepsSem);
+        RTSemEventMultiReset(mData->mMachineStateDepsSem);
 
         alock.leave();
 
-        RTSemEventMultiWait (mData->mMachineStateDepsSem, RT_INDEFINITE_WAIT);
+        RTSemEventMultiWait(mData->mMachineStateDepsSem, RT_INDEFINITE_WAIT);
 
         alock.enter();
@@ -5798,5 +5790,5 @@
  * @note Locks this object for writing.
  */
-HRESULT Machine::setMachineState (MachineState_T aMachineState)
+HRESULT Machine::setMachineState(MachineState_T aMachineState)
 {
     LogFlowThisFuncEnter();
@@ -5804,5 +5796,5 @@
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -5815,5 +5807,5 @@
         mData->mMachineState = aMachineState;
 
-        RTTimeNow (&mData->mLastStateChange);
+        RTTimeNow(&mData->mLastStateChange);
 
         mParent->onMachineStateChange(mData->mUuid, aMachineState);
@@ -5838,7 +5830,7 @@
  *      must be called from under the object's lock!
  */
-HRESULT Machine::findSharedFolder (CBSTR aName,
-                                   ComObjPtr<SharedFolder> &aSharedFolder,
-                                   bool aSetError /* = false */)
+HRESULT Machine::findSharedFolder(CBSTR aName,
+                                  ComObjPtr<SharedFolder> &aSharedFolder,
+                                  bool aSetError /* = false */)
 {
     bool found = false;
@@ -5905,5 +5897,5 @@
         }
         else
-            unconst (mData->mUuid) = mData->m_pMachineConfigFile->uuid;
+            unconst(mData->mUuid) = mData->m_pMachineConfigFile->uuid;
 
         /* name (required) */
@@ -6365,5 +6357,5 @@
  * @param aNode        <HardDiskAttachments> node.
  * @param aRegistered  true when the machine is being loaded on VirtualBox
- *                     startup, or when a snapshot is being loaded (wchich
+ *                     startup, or when a snapshot is being loaded (which
  *                     currently can happen on startup only)
  * @param aSnapshotId  pointer to the snapshot ID if this is a snapshot machine
@@ -6649,5 +6641,5 @@
     }
 
-    aSnapshot = mData->mFirstSnapshot->findChildOrSelf (aName);
+    aSnapshot = mData->mFirstSnapshot->findChildOrSelf(aName);
 
     if (!aSnapshot)
@@ -6673,5 +6665,5 @@
                                             bool aSetError /* = false */)
 {
-    AssertReturn (!aName.isEmpty(), E_INVALIDARG);
+    AssertReturn(!aName.isEmpty(), E_INVALIDARG);
 
     for (StorageControllerList::const_iterator it = mStorageControllers->begin();
@@ -6772,5 +6764,5 @@
             {
                 newConfigDir.stripFilename();
-                newConfigDir = Utf8StrFmt ("%s%c%s",
+                newConfigDir = Utf8StrFmt("%s%c%s",
                     newConfigDir.raw(), RTPATH_DELIMITER, newName.raw());
                 /* new dir and old dir cannot be equal here because of 'if'
@@ -6780,5 +6772,5 @@
                 {
                     /* perform real rename only if the machine is not new */
-                    vrc = RTPathRename (configDir.raw(), newConfigDir.raw(), 0);
+                    vrc = RTPathRename(configDir.raw(), newConfigDir.raw(), 0);
                     if (RT_FAILURE(vrc))
                     {
@@ -6794,5 +6786,5 @@
             }
 
-            newConfigFile = Utf8StrFmt ("%s%c%s.xml",
+            newConfigFile = Utf8StrFmt("%s%c%s.xml",
                 newConfigDir.raw(), RTPATH_DELIMITER, newName.raw());
 
@@ -6808,5 +6800,5 @@
                 {
                     /* perform real rename only if the machine is not new */
-                    vrc = RTFileRename (configFile.raw(), newConfigFile.raw(), 0);
+                    vrc = RTFileRename(configFile.raw(), newConfigFile.raw(), 0);
                     if (RT_FAILURE(vrc))
                     {
@@ -6828,5 +6820,5 @@
             /* try to get the relative path for mConfigFile */
             Utf8Str path = newConfigFile;
-            mParent->calculateRelativePath (path, path);
+            mParent->calculateRelativePath(path, path);
             mData->m_strConfigFile = path;
 
@@ -6851,5 +6843,5 @@
                                   path.raw() + configDir.length());
                 mUserData->mSnapshotFolderFull = path;
-                calculateRelativePath (path, path);
+                calculateRelativePath(path, path);
                 mUserData->mSnapshotFolder = path;
             }
@@ -7082,5 +7074,5 @@
     catch (...)
     {
-        rc = VirtualBox::handleUnexpectedExceptions (RT_SRC_POS);
+        rc = VirtualBox::handleUnexpectedExceptions(RT_SRC_POS);
     }
 
@@ -7109,5 +7101,5 @@
 HRESULT Machine::saveAllSnapshots()
 {
-    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
+    AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
 
     HRESULT rc = S_OK;
@@ -7141,5 +7133,5 @@
     catch (...)
     {
-        rc = VirtualBox::handleUnexpectedExceptions (RT_SRC_POS);
+        rc = VirtualBox::handleUnexpectedExceptions(RT_SRC_POS);
     }
 
@@ -7485,5 +7477,5 @@
     catch (...)
     {
-        rc = VirtualBox::handleUnexpectedExceptions (RT_SRC_POS);
+        rc = VirtualBox::handleUnexpectedExceptions(RT_SRC_POS);
     }
 
@@ -7535,5 +7527,5 @@
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -7565,5 +7557,5 @@
                     Medium* pHD = pAtt->getMedium();
                     Assert(pHD);
-                    rc = pHD->LockRead (NULL);
+                    rc = pHD->LockRead(NULL);
                     if (FAILED(rc)) throw rc;
                     lockedMedia.push_back(pHD);
@@ -7691,5 +7683,5 @@
     if (FAILED(rc))
     {
-        MultiResultRef mrc (rc);
+        MultiResultRef mrc(rc);
 
         mrc = deleteImplicitDiffs(pfNeedsSaveSettings);
@@ -7714,5 +7706,5 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -7742,5 +7734,5 @@
             rc = hd->detachFrom(mData->mUuid);
             AssertComRC(rc);
-            implicitAtts.push_back (*it);
+            implicitAtts.push_back(*it);
             continue;
         }
@@ -7761,5 +7753,5 @@
     mMediaData.rollback();
 
-    MultiResult mrc (S_OK);
+    MultiResult mrc(S_OK);
 
     /* delete unused implicit diffs */
@@ -7775,5 +7767,5 @@
              && oldState != MachineState_DeletingSnapshot
            )
-            setMachineState (MachineState_SettingUp);
+            setMachineState(MachineState_SettingUp);
 
         alock.leave();
@@ -7803,5 +7795,5 @@
         if (mData->mMachineState == MachineState_SettingUp)
         {
-            setMachineState (oldState);
+            setMachineState(oldState);
         }
     }
@@ -7909,5 +7901,5 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -8137,5 +8129,5 @@
         *aSettingsDir = settingsDir;
 
-    return Bstr (dirName) == mUserData->mName;
+    return Bstr(dirName) == mUserData->mName;
 }
 
@@ -8150,5 +8142,5 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), (void) 0);
+    AssertComRCReturn(autoCaller.rc(), (void)0);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -8281,8 +8273,8 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
-
-    AutoCaller peerCaller (mPeer);
-    AssertComRCReturnVoid (peerCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
+
+    AutoCaller peerCaller(mPeer);
+    AssertComRCReturnVoid(peerCaller.rc());
 
     AutoMultiWriteLock2 alock(mPeer, this COMMA_LOCKVAL_SRC_POS);
@@ -8912,6 +8904,14 @@
         Assert(mData->mSession.mState == SessionState_Closing);
         Assert(!mData->mSession.mProgress.isNull());
-
-        mData->mSession.mProgress->notifyComplete (S_OK);
+    }
+    if (mData->mSession.mProgress)
+    {
+        if (aReason == Uninit::Normal)
+            mData->mSession.mProgress->notifyComplete(S_OK);
+	else
+            mData->mSession.mProgress->notifyComplete(E_FAIL,
+                                                      COM_IIDOF(ISession),
+                                                      getComponentName(),
+                                                      tr("The VM session was aborted"));
         mData->mSession.mProgress.setNull();
     }
@@ -8929,13 +8929,13 @@
 #if defined(RT_OS_WINDOWS)
     if (mIPCSem)
-        ::CloseHandle (mIPCSem);
+        ::CloseHandle(mIPCSem);
     mIPCSem = NULL;
 #elif defined(RT_OS_OS2)
     if (mIPCSem != NULLHANDLE)
-        ::DosCloseMutexSem (mIPCSem);
+        ::DosCloseMutexSem(mIPCSem);
     mIPCSem = NULLHANDLE;
 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     if (mIPCSem >= 0)
-        ::semctl (mIPCSem, 0, IPC_RMID);
+        ::semctl(mIPCSem, 0, IPC_RMID);
     mIPCSem = -1;
 # ifdef VBOX_WITH_NEW_SYS_V_KEYGEN
@@ -8947,5 +8947,5 @@
 
     /* fire an event */
-    mParent->onSessionStateChange (mData->mUuid, SessionState_Closed);
+    mParent->onSessionStateChange(mData->mUuid, SessionState_Closed);
 
     uninitDataAndChildObjects();
@@ -8985,5 +8985,5 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -8997,7 +8997,7 @@
  *  @note Locks the same as #setMachineState() does.
  */
-STDMETHODIMP SessionMachine::UpdateState (MachineState_T aMachineState)
-{
-    return setMachineState (aMachineState);
+STDMETHODIMP SessionMachine::UpdateState(MachineState_T aMachineState)
+{
+    return setMachineState(aMachineState);
 }
 
@@ -9005,8 +9005,8 @@
  *  @note Locks this object for reading.
  */
-STDMETHODIMP SessionMachine::GetIPCId (BSTR *aId)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+STDMETHODIMP SessionMachine::GetIPCId(BSTR *aId)
+{
+    AutoCaller autoCaller(this);
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -9028,4 +9028,48 @@
 
 /**
+ *  @note Locks this object for writing.
+ */
+STDMETHODIMP SessionMachine::SetPowerUpInfo(IVirtualBoxErrorInfo *aError)
+{
+    AutoCaller autoCaller(this);
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (   mData->mSession.mState == SessionState_Open
+        && mData->mSession.mProgress)
+    {
+        /* Finalize the progress, since the remote session has completed
+         * power on (successful or not). */
+        if (aError)
+        {
+            /* Transfer error information immediately, as the
+             * IVirtualBoxErrorInfo object is most likely transient. */
+            HRESULT rc;
+            LONG rRc = S_OK;
+            rc = aError->COMGETTER(ResultCode)(&rRc);
+            AssertComRCReturnRC(rc);
+            Bstr rIID;
+            rc = aError->COMGETTER(InterfaceID)(rIID.asOutParam());
+            AssertComRCReturnRC(rc);
+            Bstr rComponent;
+            rc = aError->COMGETTER(Component)(rComponent.asOutParam());
+            AssertComRCReturnRC(rc);
+            Bstr rText;
+            rc = aError->COMGETTER(Text)(rText.asOutParam());
+            AssertComRCReturnRC(rc);
+            mData->mSession.mProgress->notifyComplete(rRc, Guid(rIID), rComponent, Utf8Str(rText).raw());
+        }
+        else
+            mData->mSession.mProgress->notifyComplete(S_OK);
+        mData->mSession.mProgress.setNull();
+
+        return S_OK;
+    }
+    else
+        return VBOX_E_INVALID_OBJECT_STATE;
+}
+
+/**
  *  Goes through the USB filters of the given machine to see if the given
  *  device matches any filter or not.
@@ -9033,18 +9077,18 @@
  *  @note Locks the same as USBController::hasMatchingFilter() does.
  */
-STDMETHODIMP SessionMachine::RunUSBDeviceFilters (IUSBDevice *aUSBDevice,
-                                                  BOOL *aMatched,
-                                                  ULONG *aMaskedIfs)
+STDMETHODIMP SessionMachine::RunUSBDeviceFilters(IUSBDevice *aUSBDevice,
+                                                 BOOL *aMatched,
+                                                 ULONG *aMaskedIfs)
 {
     LogFlowThisFunc(("\n"));
 
-    CheckComArgNotNull (aUSBDevice);
+    CheckComArgNotNull(aUSBDevice);
     CheckComArgOutPointerValid(aMatched);
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
 #ifdef VBOX_WITH_USB
-    *aMatched = mUSBController->hasMatchingFilter (aUSBDevice, aMaskedIfs);
+    *aMatched = mUSBController->hasMatchingFilter(aUSBDevice, aMaskedIfs);
 #else
     NOREF(aUSBDevice);
@@ -9059,5 +9103,5 @@
  *  @note Locks the same as Host::captureUSBDevice() does.
  */
-STDMETHODIMP SessionMachine::CaptureUSBDevice (IN_BSTR aId)
+STDMETHODIMP SessionMachine::CaptureUSBDevice(IN_BSTR aId)
 {
     LogFlowThisFunc(("\n"));
@@ -9073,5 +9117,5 @@
     USBProxyService *service = mParent->host()->usbProxyService();
     AssertReturn(service, E_FAIL);
-    return service->captureDeviceForVM (this, Guid(aId));
+    return service->captureDeviceForVM(this, Guid(aId));
 #else
     NOREF(aId);
@@ -9083,15 +9127,15 @@
  *  @note Locks the same as Host::detachUSBDevice() does.
  */
-STDMETHODIMP SessionMachine::DetachUSBDevice (IN_BSTR aId, BOOL aDone)
+STDMETHODIMP SessionMachine::DetachUSBDevice(IN_BSTR aId, BOOL aDone)
 {
     LogFlowThisFunc(("\n"));
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
 #ifdef VBOX_WITH_USB
     USBProxyService *service = mParent->host()->usbProxyService();
     AssertReturn(service, E_FAIL);
-    return service->detachDeviceFromVM (this, Guid(aId), !!aDone);
+    return service->detachDeviceFromVM(this, Guid(aId), !!aDone);
 #else
     NOREF(aId);
@@ -9114,14 +9158,14 @@
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
 #ifdef VBOX_WITH_USB
-    HRESULT rc = mUSBController->notifyProxy (true /* aInsertFilters */);
+    HRESULT rc = mUSBController->notifyProxy(true /* aInsertFilters */);
     AssertComRC(rc);
-    NOREF (rc);
+    NOREF(rc);
 
     USBProxyService *service = mParent->host()->usbProxyService();
     AssertReturn(service, E_FAIL);
-    return service->autoCaptureDevicesForVM (this);
+    return service->autoCaptureDevicesForVM(this);
 #else
     return S_OK;
@@ -9139,19 +9183,19 @@
  *  @note Locks what called methods lock.
  */
-STDMETHODIMP SessionMachine::DetachAllUSBDevices (BOOL aDone)
+STDMETHODIMP SessionMachine::DetachAllUSBDevices(BOOL aDone)
 {
     LogFlowThisFunc(("\n"));
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
 #ifdef VBOX_WITH_USB
-    HRESULT rc = mUSBController->notifyProxy (false /* aInsertFilters */);
+    HRESULT rc = mUSBController->notifyProxy(false /* aInsertFilters */);
     AssertComRC(rc);
-    NOREF (rc);
+    NOREF(rc);
 
     USBProxyService *service = mParent->host()->usbProxyService();
     AssertReturn(service, E_FAIL);
-    return service->detachAllDevicesFromVM (this, !!aDone, false /* aAbnormal */);
+    return service->detachAllDevicesFromVM(this, !!aDone, false /* aAbnormal */);
 #else
     NOREF(aDone);
@@ -9163,6 +9207,6 @@
  *  @note Locks this object for writing.
  */
-STDMETHODIMP SessionMachine::OnSessionEnd (ISession *aSession,
-                                           IProgress **aProgress)
+STDMETHODIMP SessionMachine::OnSessionEnd(ISession *aSession,
+                                          IProgress **aProgress)
 {
     LogFlowThisFuncEnter();
@@ -9181,5 +9225,5 @@
 
     /* get IInternalSessionControl interface */
-    ComPtr<IInternalSessionControl> control (aSession);
+    ComPtr<IInternalSessionControl> control(aSession);
 
     ComAssertRet(!control.isNull(), E_INVALIDARG);
@@ -9205,11 +9249,23 @@
         LogFlowThisFunc(("Direct control is set to NULL\n"));
 
+        if (mData->mSession.mProgress)
+        {
+            /* finalize the progress, someone might wait if a frontend
+             * closes the session before powering on the VM. */
+            mData->mSession.mProgress->notifyComplete(E_FAIL,
+                                                      COM_IIDOF(ISession),
+                                                      getComponentName(),
+                                                      tr("The VM session was closed before any attempt to power it on"));
+            mData->mSession.mProgress.setNull();
+        }
+
         /*  Create the progress object the client will use to wait until
          * #checkForDeath() is called to uninitialize this session object after
          * it releases the IPC semaphore. */
+        Assert(mData->mSession.mProgress.isNull());
         ComObjPtr<Progress> progress;
         progress.createObject();
-        progress->init (mParent, static_cast <IMachine *> (mPeer),
-                        Bstr (tr ("Closing session")), FALSE /* aCancelable */);
+        progress->init(mParent, static_cast<IMachine *>(mPeer),
+                       Bstr(tr("Closing session")), FALSE /* aCancelable */);
         progress.queryInterfaceTo(aProgress);
         mData->mSession.mProgress = progress;
@@ -9222,12 +9278,12 @@
         while (it != mData->mSession.mRemoteControls.end())
         {
-            if (control.equalsTo (*it))
+            if (control.equalsTo(*it))
                 break;
             ++it;
         }
         BOOL found = it != mData->mSession.mRemoteControls.end();
-        ComAssertMsgRet (found, ("The session is not found in the session list!"),
+        ComAssertMsgRet(found, ("The session is not found in the session list!"),
                          E_INVALIDARG);
-        mData->mSession.mRemoteControls.remove (*it);
+        mData->mSession.mRemoteControls.remove(*it);
     }
 
@@ -9239,5 +9295,5 @@
  *  @note Locks this object for writing.
  */
-STDMETHODIMP SessionMachine::BeginSavingState (IProgress *aProgress, BSTR *aStateFilePath)
+STDMETHODIMP SessionMachine::BeginSavingState(IProgress *aProgress, BSTR *aStateFilePath)
 {
     LogFlowThisFuncEnter();
@@ -9247,5 +9303,5 @@
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -9259,8 +9315,8 @@
     /* memorize the progress ID and add it to the global collection */
     Bstr progressId;
-    HRESULT rc = aProgress->COMGETTER(Id) (progressId.asOutParam());
-    AssertComRCReturn (rc, rc);
-    rc = mParent->addProgress (aProgress);
-    AssertComRCReturn (rc, rc);
+    HRESULT rc = aProgress->COMGETTER(Id)(progressId.asOutParam());
+    AssertComRCReturn(rc, rc);
+    rc = mParent->addProgress(aProgress);
+    AssertComRCReturn(rc, rc);
 
     Bstr stateFilePath;
@@ -9268,7 +9324,7 @@
     if (mData->mMachineState == MachineState_Paused)
     {
-        stateFilePath = Utf8StrFmt ("%ls%c{%RTuuid}.sav",
-                                    mUserData->mSnapshotFolderFull.raw(),
-                                    RTPATH_DELIMITER, mData->mUuid.raw());
+        stateFilePath = Utf8StrFmt("%ls%c{%RTuuid}.sav",
+                                   mUserData->mSnapshotFolderFull.raw(),
+                                   RTPATH_DELIMITER, mData->mUuid.raw());
     }
 
@@ -9279,5 +9335,5 @@
 
     /* set the state to Saving (this is expected by Console::SaveState()) */
-    setMachineState (MachineState_Saving);
+    setMachineState(MachineState_Saving);
 
     stateFilePath.cloneTo(aStateFilePath);
@@ -9289,10 +9345,10 @@
  *  @note Locks mParent + this object for writing.
  */
-STDMETHODIMP SessionMachine::EndSavingState (BOOL aSuccess)
+STDMETHODIMP SessionMachine::EndSavingState(BOOL aSuccess)
 {
     LogFlowThisFunc(("\n"));
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     /* endSavingState() need mParent lock */
@@ -9312,9 +9368,9 @@
      */
     if (aSuccess)
-        setMachineState (MachineState_Saved);
+        setMachineState(MachineState_Saved);
     else
-        setMachineState (mSnapshotData.mLastState);
-
-    return endSavingState (aSuccess);
+        setMachineState(mSnapshotData.mLastState);
+
+    return endSavingState(aSuccess);
 }
 
@@ -9322,5 +9378,5 @@
  *  @note Locks this object for writing.
  */
-STDMETHODIMP SessionMachine::AdoptSavedState (IN_BSTR aSavedStateFile)
+STDMETHODIMP SessionMachine::AdoptSavedState(IN_BSTR aSavedStateFile)
 {
     LogFlowThisFunc(("\n"));
@@ -9329,5 +9385,5 @@
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -9351,5 +9407,5 @@
      * update the settings file */
 
-    return setMachineState (MachineState_Saved);
+    return setMachineState(MachineState_Saved);
 }
 
@@ -9365,5 +9421,5 @@
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -9375,8 +9431,8 @@
 
     size_t cEntries = mHWData->mGuestProperties.size();
-    com::SafeArray<BSTR> names (cEntries);
-    com::SafeArray<BSTR> values (cEntries);
-    com::SafeArray<ULONG64> timestamps (cEntries);
-    com::SafeArray<BSTR> flags (cEntries);
+    com::SafeArray<BSTR> names(cEntries);
+    com::SafeArray<BSTR> values(cEntries);
+    com::SafeArray<ULONG64> timestamps(cEntries);
+    com::SafeArray<BSTR> flags(cEntries);
     unsigned i = 0;
     for (HWData::GuestPropertyList::iterator it = mHWData->mGuestProperties.begin();
@@ -9638,8 +9694,8 @@
 #if defined(RT_OS_WINDOWS)
 
-        AssertMsg (mIPCSem, ("semaphore must be created"));
+        AssertMsg(mIPCSem, ("semaphore must be created"));
 
         /* release the IPC mutex */
-        ::ReleaseMutex (mIPCSem);
+        ::ReleaseMutex(mIPCSem);
 
         terminated = true;
@@ -9647,8 +9703,8 @@
 #elif defined(RT_OS_OS2)
 
-        AssertMsg (mIPCSem, ("semaphore must be created"));
+        AssertMsg(mIPCSem, ("semaphore must be created"));
 
         /* release the IPC mutex */
-        ::DosReleaseMutexSem (mIPCSem);
+        ::DosReleaseMutexSem(mIPCSem);
 
         terminated = true;
@@ -9656,7 +9712,7 @@
 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
 
-        AssertMsg (mIPCSem >= 0, ("semaphore must be created"));
-
-        int val = ::semctl (mIPCSem, 0, GETVAL);
+        AssertMsg(mIPCSem >= 0, ("semaphore must be created"));
+
+        int val = ::semctl(mIPCSem, 0, GETVAL);
         if (val > 0)
         {
@@ -9672,5 +9728,5 @@
 
     if (terminated)
-        uninit (reason);
+        uninit(reason);
 
     return terminated;
@@ -9680,10 +9736,10 @@
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onNetworkAdapterChange (INetworkAdapter *networkAdapter, BOOL changeAdapter)
+HRESULT SessionMachine::onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter)
 {
     LogFlowThisFunc(("\n"));
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     ComPtr<IInternalSessionControl> directControl;
@@ -9697,5 +9753,5 @@
         return S_OK;
 
-    return directControl->OnNetworkAdapterChange (networkAdapter, changeAdapter);
+    return directControl->OnNetworkAdapterChange(networkAdapter, changeAdapter);
 }
 
@@ -9703,10 +9759,10 @@
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onSerialPortChange (ISerialPort *serialPort)
+HRESULT SessionMachine::onSerialPortChange(ISerialPort *serialPort)
 {
     LogFlowThisFunc(("\n"));
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     ComPtr<IInternalSessionControl> directControl;
@@ -9720,5 +9776,5 @@
         return S_OK;
 
-    return directControl->OnSerialPortChange (serialPort);
+    return directControl->OnSerialPortChange(serialPort);
 }
 
@@ -9726,5 +9782,5 @@
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onParallelPortChange (IParallelPort *parallelPort)
+HRESULT SessionMachine::onParallelPortChange(IParallelPort *parallelPort)
 {
     LogFlowThisFunc(("\n"));
@@ -9749,10 +9805,10 @@
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onStorageControllerChange ()
+HRESULT SessionMachine::onStorageControllerChange()
 {
     LogFlowThisFunc(("\n"));
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     ComPtr<IInternalSessionControl> directControl;
@@ -9766,5 +9822,5 @@
         return S_OK;
 
-    return directControl->OnStorageControllerChange ();
+    return directControl->OnStorageControllerChange();
 }
 
@@ -9777,5 +9833,5 @@
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     ComPtr<IInternalSessionControl> directControl;
@@ -9823,5 +9879,5 @@
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     ComPtr<IInternalSessionControl> directControl;
@@ -9846,5 +9902,5 @@
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     ComPtr<IInternalSessionControl> directControl;
@@ -9881,5 +9937,5 @@
         return S_OK;
 
-    return directControl->OnSharedFolderChange (FALSE /* aGlobal */);
+    return directControl->OnSharedFolderChange(FALSE /* aGlobal */);
 }
 
@@ -9890,5 +9946,5 @@
  *  @note Caller must have requested machine read lock.
  */
-bool SessionMachine::hasMatchingUSBFilter (const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
+bool SessionMachine::hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
 {
     AutoCaller autoCaller(this);
@@ -9910,5 +9966,5 @@
         /** @todo Live Migration: snapshoting & teleporting. Need to fend things of
          *        elsewhere... */
-            return mUSBController->hasMatchingFilter (aDevice, aMaskedIfs);
+            return mUSBController->hasMatchingFilter(aDevice, aMaskedIfs);
         default: break;
     }
@@ -9923,7 +9979,7 @@
  *  @note The calls shall hold no locks. Will temporarily lock this object for reading.
  */
-HRESULT SessionMachine::onUSBDeviceAttach (IUSBDevice *aDevice,
-                                           IVirtualBoxErrorInfo *aError,
-                                           ULONG aMaskedIfs)
+HRESULT SessionMachine::onUSBDeviceAttach(IUSBDevice *aDevice,
+                                          IVirtualBoxErrorInfo *aError,
+                                          ULONG aMaskedIfs)
 {
     LogFlowThisFunc(("\n"));
@@ -9947,8 +10003,8 @@
 
     /* No locks should be held at this point. */
-    AssertMsg (RTLockValidatorWriteLockGetCount (RTThreadSelf()) == 0, ("%d\n", RTLockValidatorWriteLockGetCount (RTThreadSelf())));
-    AssertMsg (RTLockValidatorReadLockGetCount (RTThreadSelf()) == 0, ("%d\n", RTLockValidatorReadLockGetCount (RTThreadSelf())));
-
-    return directControl->OnUSBDeviceAttach (aDevice, aError, aMaskedIfs);
+    AssertMsg(RTLockValidatorWriteLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorWriteLockGetCount(RTThreadSelf())));
+    AssertMsg(RTLockValidatorReadLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorReadLockGetCount(RTThreadSelf())));
+
+    return directControl->OnUSBDeviceAttach(aDevice, aError, aMaskedIfs);
 }
 
@@ -9956,6 +10012,6 @@
  *  @note The calls shall hold no locks. Will temporarily lock this object for reading.
  */
-HRESULT SessionMachine::onUSBDeviceDetach (IN_BSTR aId,
-                                           IVirtualBoxErrorInfo *aError)
+HRESULT SessionMachine::onUSBDeviceDetach(IN_BSTR aId,
+                                          IVirtualBoxErrorInfo *aError)
 {
     LogFlowThisFunc(("\n"));
@@ -9979,8 +10035,8 @@
 
     /* No locks should be held at this point. */
-    AssertMsg (RTLockValidatorWriteLockGetCount (RTThreadSelf()) == 0, ("%d\n", RTLockValidatorWriteLockGetCount (RTThreadSelf())));
-    AssertMsg (RTLockValidatorReadLockGetCount (RTThreadSelf()) == 0, ("%d\n", RTLockValidatorReadLockGetCount (RTThreadSelf())));
-
-    return directControl->OnUSBDeviceDetach (aId, aError);
+    AssertMsg(RTLockValidatorWriteLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorWriteLockGetCount(RTThreadSelf())));
+    AssertMsg(RTLockValidatorReadLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorReadLockGetCount(RTThreadSelf())));
+
+    return directControl->OnUSBDeviceDetach(aId, aError);
 }
 
@@ -9997,10 +10053,10 @@
  *  @note Locks mParent + this objects for writing.
  */
-HRESULT SessionMachine::endSavingState (BOOL aSuccess)
+HRESULT SessionMachine::endSavingState(BOOL aSuccess)
 {
     LogFlowThisFuncEnter();
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     /* saveSettings() needs mParent lock */
@@ -10057,5 +10113,5 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -10180,5 +10236,5 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -10196,7 +10252,7 @@
         MediumState_T state;
         if (it->second)
-            rc = it->first->UnlockWrite (&state);
+            rc = it->first->UnlockWrite(&state);
         else
-            rc = it->first->UnlockRead (&state);
+            rc = it->first->UnlockRead(&state);
 
         /* The second can happen if an object was re-locked in
@@ -10214,5 +10270,5 @@
  * @note Locks this object for writing.
  */
-HRESULT SessionMachine::setMachineState (MachineState_T aMachineState)
+HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
 {
     LogFlowThisFuncEnter();
@@ -10220,5 +10276,5 @@
 
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -10358,5 +10414,5 @@
 
     /* redirect to the underlying peer machine */
-    mPeer->setMachineState (aMachineState);
+    mPeer->setMachineState(aMachineState);
 
     if (   aMachineState == MachineState_PoweredOff
@@ -10381,5 +10437,5 @@
     }
 
-    rc = saveStateSettings (stsFlags);
+    rc = saveStateSettings(stsFlags);
 
     if (   (   oldMachineState != MachineState_PoweredOff
@@ -10410,5 +10466,5 @@
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     ComPtr<IInternalSessionControl> directControl;
@@ -10433,4 +10489,4 @@
     }
 
-    return directControl->UpdateMachineState (mData->mMachineState);
-}
+    return directControl->UpdateMachineState(mData->mMachineState);
+}
Index: trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 26322)
+++ trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 26323)
@@ -2689,5 +2689,6 @@
         console through it is invalid. It is recommended to use
         <link to="IProgress::waitForCompletion" /> or similar calls to wait for
-        completion.
+        completion. Completion is signalled when the VM is powered on. Error
+        messages etc. can be queried via the progress object, if available.
 
         As with all <link to="ISession" /> objects, it is recommended to call
@@ -3759,4 +3760,15 @@
     </method>
 
+    <method name="setPowerUpInfo">
+      <desc>
+        Transfers success (@c null) or error information for this session.
+        This method updates the progress object to signal completion of the
+        <link to="IVirtualBox::openRemoteSession"/> method if appropriate,
+        which means that the progress object returned by
+        <link to="IConsole::powerUp"/>.
+      </desc>
+      <param name="error" type="IVirtualBoxErrorInfo" dir="in"/>
+    </method>
+
     <method name="runUSBDeviceFilters">
       <desc>
Index: trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- trunk/src/VBox/Main/include/MachineImpl.h	(revision 26322)
+++ trunk/src/VBox/Main/include/MachineImpl.h	(revision 26323)
@@ -829,4 +829,5 @@
     STDMETHOD(UpdateState)(MachineState_T machineState);
     STDMETHOD(GetIPCId)(BSTR *id);
+    STDMETHOD(SetPowerUpInfo)(IVirtualBoxErrorInfo *aError);
     STDMETHOD(RunUSBDeviceFilters)(IUSBDevice *aUSBDevice, BOOL *aMatched, ULONG *aMaskedIfs);
     STDMETHOD(CaptureUSBDevice)(IN_BSTR aId);
