VirtualBox

Changeset 26323 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 8, 2010 11:13:28 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57404
Message:

Main/Machine+Console: Extend the scope of the power up progress object, and collect error information from the frontend. Much better error signalling when the VM is started via openRemoteSession. Adjusted documentation accordingly, and finally fixed the incomprehensible messages emitted by VBoxManage startvm.

Location:
trunk/src/VBox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp

    r25377 r26323  
    378378        CHECK_ERROR_RET(a->virtualBox, OpenRemoteSession(a->session, uuid, sessionType,
    379379                                                         env, progress.asOutParam()), rc);
    380         RTPrintf("Waiting for the remote session to open...\n");
    381         CHECK_ERROR_RET(progress, WaitForCompletion (-1), 1);
     380        RTPrintf("Waiting for the VM to power on...\n");
     381        CHECK_ERROR_RET(progress, WaitForCompletion(-1), 1);
    382382
    383383        BOOL completed;
     
    396396        else
    397397        {
    398             RTPrintf("Remote session has been successfully opened.\n");
     398            RTPrintf("VM has been successfully started.\n");
    399399        }
    400400    }
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r26313 r26323  
    4949
    5050#include "Global.h"
     51#include "VirtualBoxErrorInfoImpl.h"
    5152#include "GuestImpl.h"
    5253#include "KeyboardImpl.h"
     
    74067407        /* Notify the progress object of the success */
    74077408        task->mProgress->notifyComplete(S_OK);
     7409        console->mControl->SetPowerUpInfo(NULL);
    74087410    }
    74097411    else
     
    74117413        /* The progress object will fetch the current error info */
    74127414        task->mProgress->notifyComplete(rc);
     7415        ProgressErrorInfo info(task->mProgress);
     7416        ComObjPtr<VirtualBoxErrorInfo> errorInfo;
     7417        rc = errorInfo.createObject();
     7418        if (SUCCEEDED(rc))
     7419        {
     7420            errorInfo->init(info.getResultCode(),
     7421                            info.getInterfaceID(),
     7422                            info.getComponent(),
     7423                            info.getText());
     7424            console->mControl->SetPowerUpInfo(errorInfo);
     7425        }
     7426        else
     7427        {
     7428            /* If it's not possible to create an IVirtualBoxErrorInfo object
     7429             * signal success, as not signalling anything will cause a stuck
     7430             * progress object in VBoxSVC. */
     7431            console->mControl->SetPowerUpInfo(NULL);
     7432        }
    74137433
    74147434        LogRel(("Power up failed (vrc=%Rrc, rc=%Rhrc (%#08X))\n", vrc, rc, rc));
  • trunk/src/VBox/Main/MachineImpl.cpp

    r26295 r26323  
    267267{
    268268    LogFlowThisFuncEnter();
    269     LogFlowThisFunc (("aConfigFile='%s', aMode=%d\n", strConfigFile.raw(), aMode));
    270 
    271     AssertReturn (aParent, E_INVALIDARG);
    272     AssertReturn (!strConfigFile.isEmpty(), E_INVALIDARG);
     269    LogFlowThisFunc(("aConfigFile='%s', aMode=%d\n", strConfigFile.raw(), aMode));
     270
     271    AssertReturn(aParent, E_INVALIDARG);
     272    AssertReturn(!strConfigFile.isEmpty(), E_INVALIDARG);
    273273    AssertReturn(aMode != Init_New || (aName != NULL && *aName != '\0'),
    274274                  E_INVALIDARG);
     
    389389
    390390                    /* Apply BIOS defaults */
    391                     mBIOSSettings->applyDefaults (aOsType);
     391                    mBIOSSettings->applyDefaults(aOsType);
    392392
    393393                    /* Apply network adapters defaults */
     
    545545            LogWarningThisFunc(("Setting state to Aborted!\n"));
    546546            /* set machine state using SessionMachine reimplementation */
    547             static_cast<Machine*>(mData->mSession.mMachine)->setMachineState (MachineState_Aborted);
     547            static_cast<Machine*>(mData->mSession.mMachine)->setMachineState(MachineState_Aborted);
    548548        }
    549549
     
    579579/////////////////////////////////////////////////////////////////////////////
    580580
    581 STDMETHODIMP Machine::COMGETTER(Parent) (IVirtualBox **aParent)
     581STDMETHODIMP Machine::COMGETTER(Parent)(IVirtualBox **aParent)
    582582{
    583583    CheckComArgOutPointerValid(aParent);
     
    592592}
    593593
    594 STDMETHODIMP Machine::COMGETTER(Accessible) (BOOL *aAccessible)
     594STDMETHODIMP Machine::COMGETTER(Accessible)(BOOL *aAccessible)
    595595{
    596596    CheckComArgOutPointerValid(aAccessible);
     
    646646}
    647647
    648 STDMETHODIMP Machine::COMGETTER(AccessError) (IVirtualBoxErrorInfo **aAccessError)
     648STDMETHODIMP Machine::COMGETTER(AccessError)(IVirtualBoxErrorInfo **aAccessError)
    649649{
    650650    CheckComArgOutPointerValid(aAccessError);
     
    668668    if (SUCCEEDED(rc))
    669669    {
    670         errorInfo->init (mData->mAccessError.getResultCode(),
    671                          mData->mAccessError.getInterfaceID(),
    672                          mData->mAccessError.getComponent(),
    673                          mData->mAccessError.getText());
     670        errorInfo->init(mData->mAccessError.getResultCode(),
     671                        mData->mAccessError.getInterfaceID(),
     672                        mData->mAccessError.getComponent(),
     673                        mData->mAccessError.getText());
    674674        rc = errorInfo.queryInterfaceTo(aAccessError);
    675675    }
     
    678678}
    679679
    680 STDMETHODIMP Machine::COMGETTER(Name) (BSTR *aName)
     680STDMETHODIMP Machine::COMGETTER(Name)(BSTR *aName)
    681681{
    682682    CheckComArgOutPointerValid(aName);
     
    692692}
    693693
    694 STDMETHODIMP Machine::COMSETTER(Name) (IN_BSTR aName)
    695 {
    696     CheckComArgNotNull (aName);
     694STDMETHODIMP Machine::COMSETTER(Name)(IN_BSTR aName)
     695{
     696    CheckComArgNotNull(aName);
    697697
    698698    if (!*aName)
     
    715715}
    716716
    717 STDMETHODIMP Machine::COMGETTER(Description) (BSTR *aDescription)
     717STDMETHODIMP Machine::COMGETTER(Description)(BSTR *aDescription)
    718718{
    719719    CheckComArgOutPointerValid(aDescription);
     
    729729}
    730730
    731 STDMETHODIMP Machine::COMSETTER(Description) (IN_BSTR aDescription)
     731STDMETHODIMP Machine::COMSETTER(Description)(IN_BSTR aDescription)
    732732{
    733733    AutoCaller autoCaller(this);
     
    746746}
    747747
    748 STDMETHODIMP Machine::COMGETTER(Id) (BSTR *aId)
     748STDMETHODIMP Machine::COMGETTER(Id)(BSTR *aId)
    749749{
    750750    CheckComArgOutPointerValid(aId);
     
    760760}
    761761
    762 STDMETHODIMP Machine::COMGETTER(OSTypeId) (BSTR *aOSTypeId)
     762STDMETHODIMP Machine::COMGETTER(OSTypeId)(BSTR *aOSTypeId)
    763763{
    764764    CheckComArgOutPointerValid(aOSTypeId);
     
    774774}
    775775
    776 STDMETHODIMP Machine::COMSETTER(OSTypeId) (IN_BSTR aOSTypeId)
    777 {
    778     CheckComArgNotNull (aOSTypeId);
     776STDMETHODIMP Machine::COMSETTER(OSTypeId)(IN_BSTR aOSTypeId)
     777{
     778    CheckComArgNotNull(aOSTypeId);
    779779
    780780    AutoCaller autoCaller(this);
     
    783783    /* look up the object by Id to check it is valid */
    784784    ComPtr<IGuestOSType> guestOSType;
    785     HRESULT rc = mParent->GetGuestOSType (aOSTypeId,
    786                                           guestOSType.asOutParam());
     785    HRESULT rc = mParent->GetGuestOSType(aOSTypeId, guestOSType.asOutParam());
    787786    if (FAILED(rc)) return rc;
    788787
     
    790789     * by ID is case-insensitive and the input value may have different case */
    791790    Bstr osTypeId;
    792     rc = guestOSType->COMGETTER(Id) (osTypeId.asOutParam());
     791    rc = guestOSType->COMGETTER(Id)(osTypeId.asOutParam());
    793792    if (FAILED(rc)) return rc;
    794793
     
    806805
    807806
    808 STDMETHODIMP Machine::COMGETTER(FirmwareType) (FirmwareType_T *aFirmwareType)
     807STDMETHODIMP Machine::COMGETTER(FirmwareType)(FirmwareType_T *aFirmwareType)
    809808{
    810809    CheckComArgOutPointerValid(aFirmwareType);
     
    820819}
    821820
    822 STDMETHODIMP Machine::COMSETTER(FirmwareType) (FirmwareType_T aFirmwareType)
     821STDMETHODIMP Machine::COMSETTER(FirmwareType)(FirmwareType_T aFirmwareType)
    823822{
    824823    AutoCaller autoCaller(this);
     
    836835}
    837836
    838 STDMETHODIMP Machine::COMGETTER(HardwareVersion) (BSTR *aHWVersion)
     837STDMETHODIMP Machine::COMGETTER(HardwareVersion)(BSTR *aHWVersion)
    839838{
    840839    if (!aHWVersion)
     
    851850}
    852851
    853 STDMETHODIMP Machine::COMSETTER(HardwareVersion) (IN_BSTR aHWVersion)
     852STDMETHODIMP Machine::COMSETTER(HardwareVersion)(IN_BSTR aHWVersion)
    854853{
    855854    /* check known version */
    856855    Utf8Str hwVersion = aHWVersion;
    857     if (    hwVersion.compare ("1") != 0
    858         &&  hwVersion.compare ("2") != 0)
     856    if (    hwVersion.compare("1") != 0
     857        &&  hwVersion.compare("2") != 0)
    859858        return setError(E_INVALIDARG,
    860859                        tr("Invalid hardware version: %ls\n"), aHWVersion);
     
    892891}
    893892
    894 STDMETHODIMP Machine::COMSETTER(HardwareUUID) (IN_BSTR aUUID)
     893STDMETHODIMP Machine::COMSETTER(HardwareUUID)(IN_BSTR aUUID)
    895894{
    896895    Guid hardwareUUID(aUUID);
     
    916915}
    917916
    918 STDMETHODIMP Machine::COMGETTER(MemorySize) (ULONG *memorySize)
     917STDMETHODIMP Machine::COMGETTER(MemorySize)(ULONG *memorySize)
    919918{
    920919    if (!memorySize)
     
    931930}
    932931
    933 STDMETHODIMP Machine::COMSETTER(MemorySize) (ULONG memorySize)
     932STDMETHODIMP Machine::COMSETTER(MemorySize)(ULONG memorySize)
    934933{
    935934    /* check RAM limits */
     
    956955}
    957956
    958 STDMETHODIMP Machine::COMGETTER(CPUCount) (ULONG *CPUCount)
     957STDMETHODIMP Machine::COMGETTER(CPUCount)(ULONG *CPUCount)
    959958{
    960959    if (!CPUCount)
     
    971970}
    972971
    973 STDMETHODIMP Machine::COMSETTER(CPUCount) (ULONG CPUCount)
     972STDMETHODIMP Machine::COMSETTER(CPUCount)(ULONG CPUCount)
    974973{
    975974    /* check CPU limits */
     
    10081007}
    10091008
    1010 STDMETHODIMP Machine::COMGETTER(CPUHotPlugEnabled) (BOOL *enabled)
     1009STDMETHODIMP Machine::COMGETTER(CPUHotPlugEnabled)(BOOL *enabled)
    10111010{
    10121011    if (!enabled)
     
    10231022}
    10241023
    1025 STDMETHODIMP Machine::COMSETTER(CPUHotPlugEnabled) (BOOL enabled)
     1024STDMETHODIMP Machine::COMSETTER(CPUHotPlugEnabled)(BOOL enabled)
    10261025{
    10271026    HRESULT rc = S_OK;
     
    10811080}
    10821081
    1083 STDMETHODIMP Machine::COMGETTER(VRAMSize) (ULONG *memorySize)
     1082STDMETHODIMP Machine::COMGETTER(VRAMSize)(ULONG *memorySize)
    10841083{
    10851084    if (!memorySize)
     
    10961095}
    10971096
    1098 STDMETHODIMP Machine::COMSETTER(VRAMSize) (ULONG memorySize)
     1097STDMETHODIMP Machine::COMSETTER(VRAMSize)(ULONG memorySize)
    10991098{
    11001099    /* check VRAM limits */
     
    11211120
    11221121/** @todo this method should not be public */
    1123 STDMETHODIMP Machine::COMGETTER(MemoryBalloonSize) (ULONG *memoryBalloonSize)
     1122STDMETHODIMP Machine::COMGETTER(MemoryBalloonSize)(ULONG *memoryBalloonSize)
    11241123{
    11251124    if (!memoryBalloonSize)
     
    11371136
    11381137/** @todo this method should not be public */
    1139 STDMETHODIMP Machine::COMSETTER(MemoryBalloonSize) (ULONG memoryBalloonSize)
     1138STDMETHODIMP Machine::COMSETTER(MemoryBalloonSize)(ULONG memoryBalloonSize)
    11401139{
    11411140    /* check limits */
    1142     if (memoryBalloonSize >= VMMDEV_MAX_MEMORY_BALLOON (mHWData->mMemorySize))
     1141    if (memoryBalloonSize >= VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize))
    11431142        return setError(E_INVALIDARG,
    11441143                        tr("Invalid memory balloon size: %lu MB (must be in range [%lu, %lu] MB)"),
    1145                         memoryBalloonSize, 0, VMMDEV_MAX_MEMORY_BALLOON (mHWData->mMemorySize));
     1144                        memoryBalloonSize, 0, VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize));
    11461145
    11471146    AutoCaller autoCaller(this);
     
    11611160
    11621161/** @todo this method should not be public */
    1163 STDMETHODIMP Machine::COMGETTER(StatisticsUpdateInterval) (ULONG *statisticsUpdateInterval)
     1162STDMETHODIMP Machine::COMGETTER(StatisticsUpdateInterval)(ULONG *statisticsUpdateInterval)
    11641163{
    11651164    if (!statisticsUpdateInterval)
     
    11771176
    11781177/** @todo this method should not be public */
    1179 STDMETHODIMP Machine::COMSETTER(StatisticsUpdateInterval) (ULONG statisticsUpdateInterval)
     1178STDMETHODIMP Machine::COMSETTER(StatisticsUpdateInterval)(ULONG statisticsUpdateInterval)
    11801179{
    11811180    AutoCaller autoCaller(this);
     
    12641263}
    12651264
    1266 STDMETHODIMP Machine::COMGETTER(MonitorCount) (ULONG *monitorCount)
     1265STDMETHODIMP Machine::COMGETTER(MonitorCount)(ULONG *monitorCount)
    12671266{
    12681267    if (!monitorCount)
     
    12791278}
    12801279
    1281 STDMETHODIMP Machine::COMSETTER(MonitorCount) (ULONG monitorCount)
     1280STDMETHODIMP Machine::COMSETTER(MonitorCount)(ULONG monitorCount)
    12821281{
    12831282    /* make sure monitor count is a sensible number */
     
    16361635}
    16371636
    1638 STDMETHODIMP Machine::COMGETTER(SnapshotFolder) (BSTR *aSnapshotFolder)
     1637STDMETHODIMP Machine::COMGETTER(SnapshotFolder)(BSTR *aSnapshotFolder)
    16391638{
    16401639    CheckComArgOutPointerValid(aSnapshotFolder);
     
    16501649}
    16511650
    1652 STDMETHODIMP Machine::COMSETTER(SnapshotFolder) (IN_BSTR aSnapshotFolder)
     1651STDMETHODIMP Machine::COMSETTER(SnapshotFolder)(IN_BSTR aSnapshotFolder)
    16531652{
    16541653    /* @todo (r=dmik):
     
    17541753}
    17551754
    1756 STDMETHODIMP Machine::COMGETTER(USBController) (IUSBController **aUSBController)
     1755STDMETHODIMP Machine::COMGETTER(USBController)(IUSBController **aUSBController)
    17571756{
    17581757#ifdef VBOX_WITH_USB
     
    17771776}
    17781777
    1779 STDMETHODIMP Machine::COMGETTER(SettingsFilePath) (BSTR *aFilePath)
     1778STDMETHODIMP Machine::COMGETTER(SettingsFilePath)(BSTR *aFilePath)
    17801779{
    17811780    CheckComArgOutPointerValid(aFilePath);
     
    17901789}
    17911790
    1792 STDMETHODIMP Machine::COMGETTER(SettingsModified) (BOOL *aModified)
     1791STDMETHODIMP Machine::COMGETTER(SettingsModified)(BOOL *aModified)
    17931792{
    17941793    CheckComArgOutPointerValid(aModified);
     
    18131812}
    18141813
    1815 STDMETHODIMP Machine::COMGETTER(SessionState) (SessionState_T *aSessionState)
     1814STDMETHODIMP Machine::COMGETTER(SessionState)(SessionState_T *aSessionState)
    18161815{
    18171816    CheckComArgOutPointerValid(aSessionState);
     
    18271826}
    18281827
    1829 STDMETHODIMP Machine::COMGETTER(SessionType) (BSTR *aSessionType)
     1828STDMETHODIMP Machine::COMGETTER(SessionType)(BSTR *aSessionType)
    18301829{
    18311830    CheckComArgOutPointerValid(aSessionType);
     
    18441843}
    18451844
    1846 STDMETHODIMP Machine::COMGETTER(SessionPid) (ULONG *aSessionPid)
     1845STDMETHODIMP Machine::COMGETTER(SessionPid)(ULONG *aSessionPid)
    18471846{
    18481847    CheckComArgOutPointerValid(aSessionPid);
     
    18581857}
    18591858
    1860 STDMETHODIMP Machine::COMGETTER(State) (MachineState_T *machineState)
     1859STDMETHODIMP Machine::COMGETTER(State)(MachineState_T *machineState)
    18611860{
    18621861    if (!machineState)
     
    18731872}
    18741873
    1875 STDMETHODIMP Machine::COMGETTER(LastStateChange) (LONG64 *aLastStateChange)
     1874STDMETHODIMP Machine::COMGETTER(LastStateChange)(LONG64 *aLastStateChange)
    18761875{
    18771876    CheckComArgOutPointerValid(aLastStateChange);
     
    18821881    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    18831882
    1884     *aLastStateChange = RTTimeSpecGetMilli (&mData->mLastStateChange);
    1885 
    1886     return S_OK;
    1887 }
    1888 
    1889 STDMETHODIMP Machine::COMGETTER(StateFilePath) (BSTR *aStateFilePath)
     1883    *aLastStateChange = RTTimeSpecGetMilli(&mData->mLastStateChange);
     1884
     1885    return S_OK;
     1886}
     1887
     1888STDMETHODIMP Machine::COMGETTER(StateFilePath)(BSTR *aStateFilePath)
    18901889{
    18911890    CheckComArgOutPointerValid(aStateFilePath);
     
    19041903}
    19051904
    1906 STDMETHODIMP Machine::COMGETTER(LogFolder) (BSTR *aLogFolder)
     1905STDMETHODIMP Machine::COMGETTER(LogFolder)(BSTR *aLogFolder)
    19071906{
    19081907    CheckComArgOutPointerValid(aLogFolder);
     
    19141913
    19151914    Utf8Str logFolder;
    1916     getLogFolder (logFolder);
     1915    getLogFolder(logFolder);
    19171916
    19181917    Bstr (logFolder).cloneTo(aLogFolder);
     
    19511950}
    19521951
    1953 STDMETHODIMP Machine::COMGETTER(CurrentStateModified) (BOOL *aCurrentStateModified)
     1952STDMETHODIMP Machine::COMGETTER(CurrentStateModified)(BOOL *aCurrentStateModified)
    19541953{
    19551954    CheckComArgOutPointerValid(aCurrentStateModified);
     
    19711970}
    19721971
    1973 STDMETHODIMP Machine::COMGETTER(SharedFolders) (ComSafeArrayOut(ISharedFolder *, aSharedFolders))
     1972STDMETHODIMP Machine::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolders))
    19741973{
    19751974    CheckComArgOutSafeArrayPointerValid(aSharedFolders);
     
    19861985}
    19871986
    1988 STDMETHODIMP Machine::COMGETTER(ClipboardMode) (ClipboardMode_T *aClipboardMode)
     1987STDMETHODIMP Machine::COMGETTER(ClipboardMode)(ClipboardMode_T *aClipboardMode)
    19891988{
    19901989    CheckComArgOutPointerValid(aClipboardMode);
     
    20012000
    20022001STDMETHODIMP
    2003 Machine::COMSETTER(ClipboardMode) (ClipboardMode_T aClipboardMode)
     2002Machine::COMSETTER(ClipboardMode)(ClipboardMode_T aClipboardMode)
    20042003{
    20052004    AutoCaller autoCaller(this);
     
    20592058
    20602059STDMETHODIMP
    2061 Machine::COMGETTER(StorageControllers) (ComSafeArrayOut(IStorageController *, aStorageControllers))
     2060Machine::COMGETTER(StorageControllers)(ComSafeArrayOut(IStorageController *, aStorageControllers))
    20622061{
    20632062    CheckComArgOutSafeArrayPointerValid(aStorageControllers);
     
    20682067    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    20692068
    2070     SafeIfaceArray<IStorageController> ctrls (*mStorageControllers.data());
     2069    SafeIfaceArray<IStorageController> ctrls(*mStorageControllers.data());
    20712070    ctrls.detachTo(ComSafeArrayOutArg(aStorageControllers));
    20722071
     
    22612260    if (aPosition < 1 || aPosition > SchemaDefs::MaxBootPosition)
    22622261        return setError(E_INVALIDARG,
    2263                         tr ("Invalid boot position: %lu (must be in range [1, %lu])"),
     2262                        tr("Invalid boot position: %lu (must be in range [1, %lu])"),
    22642263                        aPosition, SchemaDefs::MaxBootPosition);
    22652264
     
    22832282}
    22842283
    2285 STDMETHODIMP Machine::GetBootOrder (ULONG aPosition, DeviceType_T *aDevice)
     2284STDMETHODIMP Machine::GetBootOrder(ULONG aPosition, DeviceType_T *aDevice)
    22862285{
    22872286    if (aPosition < 1 || aPosition > SchemaDefs::MaxBootPosition)
     
    33293328}
    33303329
    3331 STDMETHODIMP Machine::GetSnapshot (IN_BSTR aId, ISnapshot **aSnapshot)
     3330STDMETHODIMP Machine::GetSnapshot(IN_BSTR aId, ISnapshot **aSnapshot)
    33323331{
    33333332    CheckComArgOutPointerValid(aSnapshot);
     
    33603359}
    33613360
    3362 STDMETHODIMP Machine::FindSnapshot (IN_BSTR aName, ISnapshot **aSnapshot)
    3363 {
    3364     CheckComArgNotNull (aName);
     3361STDMETHODIMP Machine::FindSnapshot(IN_BSTR aName, ISnapshot **aSnapshot)
     3362{
     3363    CheckComArgNotNull(aName);
    33653364    CheckComArgOutPointerValid(aSnapshot);
    33663365
     
    33783377}
    33793378
    3380 STDMETHODIMP Machine::SetCurrentSnapshot (IN_BSTR /* aId */)
     3379STDMETHODIMP Machine::SetCurrentSnapshot(IN_BSTR /* aId */)
    33813380{
    33823381    /// @todo (dmik) don't forget to set
     
    33863385}
    33873386
    3388 STDMETHODIMP Machine::CreateSharedFolder (IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
     3387STDMETHODIMP Machine::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
    33893388{
    33903389    CheckComArgNotNull(aName);
     
    34003399
    34013400    ComObjPtr<SharedFolder> sharedFolder;
    3402     rc = findSharedFolder (aName, sharedFolder, false /* aSetError */);
     3401    rc = findSharedFolder(aName, sharedFolder, false /* aSetError */);
    34033402    if (SUCCEEDED(rc))
    34043403        return setError(VBOX_E_OBJECT_IN_USE,
     
    34123411    setModified(IsModified_SharedFolders);
    34133412    mHWData.backup();
    3414     mHWData->mSharedFolders.push_back (sharedFolder);
     3413    mHWData->mSharedFolders.push_back(sharedFolder);
    34153414
    34163415    /* inform the direct session if any */
     
    34213420}
    34223421
    3423 STDMETHODIMP Machine::RemoveSharedFolder (IN_BSTR aName)
    3424 {
    3425     CheckComArgNotNull (aName);
     3422STDMETHODIMP Machine::RemoveSharedFolder(IN_BSTR aName)
     3423{
     3424    CheckComArgNotNull(aName);
    34263425
    34273426    AutoCaller autoCaller(this);
     
    34343433
    34353434    ComObjPtr<SharedFolder> sharedFolder;
    3436     rc = findSharedFolder (aName, sharedFolder, true /* aSetError */);
     3435    rc = findSharedFolder(aName, sharedFolder, true /* aSetError */);
    34373436    if (FAILED(rc)) return rc;
    34383437
    34393438    setModified(IsModified_SharedFolders);
    34403439    mHWData.backup();
    3441     mHWData->mSharedFolders.remove (sharedFolder);
     3440    mHWData->mSharedFolders.remove(sharedFolder);
    34423441
    34433442    /* inform the direct session if any */
     
    34483447}
    34493448
    3450 STDMETHODIMP Machine::CanShowConsoleWindow (BOOL *aCanShow)
     3449STDMETHODIMP Machine::CanShowConsoleWindow(BOOL *aCanShow)
    34513450{
    34523451    CheckComArgOutPointerValid(aCanShow);
     
    34753474
    34763475    ULONG64 dummy;
    3477     return directControl->OnShowWindow (TRUE /* aCheck */, aCanShow, &dummy);
    3478 }
    3479 
    3480 STDMETHODIMP Machine::ShowConsoleWindow (ULONG64 *aWinId)
     3476    return directControl->OnShowWindow(TRUE /* aCheck */, aCanShow, &dummy);
     3477}
     3478
     3479STDMETHODIMP Machine::ShowConsoleWindow(ULONG64 *aWinId)
    34813480{
    34823481    CheckComArgOutPointerValid(aWinId);
    34833482
    34843483    AutoCaller autoCaller(this);
    3485     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     3484    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    34863485
    34873486    ComPtr<IInternalSessionControl> directControl;
     
    35023501
    35033502    BOOL dummy;
    3504     return directControl->OnShowWindow (FALSE /* aCheck */, &dummy, aWinId);
     3503    return directControl->OnShowWindow(FALSE /* aCheck */, &dummy, aWinId);
    35053504}
    35063505
     
    35103509                                       BSTR *aFlags)
    35113510{
    3512 #if !defined (VBOX_WITH_GUEST_PROPS)
     3511#ifndef VBOX_WITH_GUEST_PROPS
    35133512    ReturnComNotImplemented();
    3514 #else
     3513#else // VBOX_WITH_GUEST_PROPS
    35153514    CheckComArgNotNull(aName);
    35163515    CheckComArgOutPointerValid(aValue);
     
    35613560            rc = E_FAIL;
    35623561        else
    3563             rc = directControl->AccessGuestProperty (aName, NULL, NULL,
    3564                                                      false /* isSetter */,
    3565                                                      aValue, aTimestamp, aFlags);
     3562            rc = directControl->AccessGuestProperty(aName, NULL, NULL,
     3563                                                    false /* isSetter */,
     3564                                                    aValue, aTimestamp, aFlags);
    35663565    }
    35673566    return rc;
    3568 #endif /* else !defined (VBOX_WITH_GUEST_PROPS) */
    3569 }
    3570 
    3571 STDMETHODIMP Machine::GetGuestPropertyValue (IN_BSTR aName, BSTR *aValue)
     3567#endif // VBOX_WITH_GUEST_PROPS
     3568}
     3569
     3570STDMETHODIMP Machine::GetGuestPropertyValue(IN_BSTR aName, BSTR *aValue)
    35723571{
    35733572    ULONG64 dummyTimestamp;
    35743573    BSTR dummyFlags;
    3575     return GetGuestProperty (aName, aValue, &dummyTimestamp, &dummyFlags);
    3576 }
    3577 
    3578 STDMETHODIMP Machine::GetGuestPropertyTimestamp (IN_BSTR aName, ULONG64 *aTimestamp)
     3574    return GetGuestProperty(aName, aValue, &dummyTimestamp, &dummyFlags);
     3575}
     3576
     3577STDMETHODIMP Machine::GetGuestPropertyTimestamp(IN_BSTR aName, ULONG64 *aTimestamp)
    35793578{
    35803579    BSTR dummyValue;
    35813580    BSTR dummyFlags;
    3582     return GetGuestProperty (aName, &dummyValue, aTimestamp, &dummyFlags);
     3581    return GetGuestProperty(aName, &dummyValue, aTimestamp, &dummyFlags);
    35833582}
    35843583
     
    35873586                                       IN_BSTR aFlags)
    35883587{
    3589 #if !defined (VBOX_WITH_GUEST_PROPS)
     3588#ifndef VBOX_WITH_GUEST_PROPS
    35903589    ReturnComNotImplemented();
    3591 #else
     3590#else // VBOX_WITH_GUEST_PROPS
    35923591    using namespace guestProp;
    35933592
    35943593    CheckComArgNotNull(aName);
    35953594    CheckComArgNotNull(aValue);
    3596     if ((aFlags != NULL) && !VALID_PTR (aFlags))
     3595    if ((aFlags != NULL) && !VALID_PTR(aFlags))
    35973596        return E_INVALIDARG;
    35983597
     
    36153614        uint32_t fFlags = NILFLAG;
    36163615        if (    (aFlags != NULL)
    3617              && RT_FAILURE(validateFlags (utf8Flags.raw(), &fFlags))
     3616             && RT_FAILURE(validateFlags(utf8Flags.raw(), &fFlags))
    36183617           )
    36193618            return setError(E_INVALIDARG,
     
    36643663                    if (aFlags != NULL)
    36653664                        property.mFlags = fFlags;
    3666                     mHWData->mGuestProperties.push_back (property);
     3665                    mHWData->mGuestProperties.push_back(property);
    36673666                }
    36683667            }
     
    36763675                property.mTimestamp = RTTimeSpecGetNano(RTTimeNow(&time));
    36773676                property.mFlags = fFlags;
    3678                 mHWData->mGuestProperties.push_back (property);
     3677                mHWData->mGuestProperties.push_back(property);
    36793678            }
    36803679            if (   SUCCEEDED(rc)
     
    37153714
    37163715    return rc;
    3717 #endif /* else !defined (VBOX_WITH_GUEST_PROPS) */
    3718 }
    3719 
    3720 STDMETHODIMP Machine::SetGuestPropertyValue (IN_BSTR aName, IN_BSTR aValue)
    3721 {
    3722     return SetGuestProperty (aName, aValue, NULL);
     3716#endif // VBOX_WITH_GUEST_PROPS
     3717}
     3718
     3719STDMETHODIMP Machine::SetGuestPropertyValue(IN_BSTR aName, IN_BSTR aValue)
     3720{
     3721    return SetGuestProperty(aName, aValue, NULL);
    37233722}
    37243723
     
    37293728                                               ComSafeArrayOut(BSTR, aFlags))
    37303729{
    3731 #if !defined (VBOX_WITH_GUEST_PROPS)
     3730#ifndef VBOX_WITH_GUEST_PROPS
    37323731    ReturnComNotImplemented();
    3733 #else
    3734     if (!VALID_PTR (aPatterns) && (aPatterns != NULL))
     3732#else // VBOX_WITH_GUEST_PROPS
     3733    if (!VALID_PTR(aPatterns) && (aPatterns != NULL))
    37353734        return E_POINTER;
    37363735
     
    37723771         */
    37733772        size_t cEntries = propList.size();
    3774         SafeArray<BSTR> names (cEntries);
    3775         SafeArray<BSTR> values (cEntries);
    3776         SafeArray<ULONG64> timestamps (cEntries);
    3777         SafeArray<BSTR> flags (cEntries);
     3773        SafeArray<BSTR> names(cEntries);
     3774        SafeArray<BSTR> values(cEntries);
     3775        SafeArray<ULONG64> timestamps(cEntries);
     3776        SafeArray<BSTR> flags(cEntries);
    37783777        size_t iProp = 0;
    37793778        for (HWData::GuestPropertyList::iterator it = propList.begin();
     
    38123811    }
    38133812    return rc;
    3814 #endif /* else !defined (VBOX_WITH_GUEST_PROPS) */
     3813#endif // VBOX_WITH_GUEST_PROPS
    38153814}
    38163815
     
    38843883    ComObjPtr<StorageController> ctrl;
    38853884
    3886     rc = getStorageControllerByName (aName, ctrl, false /* aSetError */);
     3885    rc = getStorageControllerByName(aName, ctrl, false /* aSetError */);
    38873886    if (SUCCEEDED(rc))
    38883887        return setError(VBOX_E_OBJECT_IN_USE,
     
    39123911    setModified(IsModified_Storage);
    39133912    mStorageControllers.backup();
    3914     mStorageControllers->push_back (ctrl);
     3913    mStorageControllers->push_back(ctrl);
    39153914
    39163915    ctrl.queryInterfaceTo(controller);
     
    39353934    ComObjPtr<StorageController> ctrl;
    39363935
    3937     HRESULT rc = getStorageControllerByName (aName, ctrl, true /* aSetError */);
     3936    HRESULT rc = getStorageControllerByName(aName, ctrl, true /* aSetError */);
    39383937    if (SUCCEEDED(rc))
    39393938        ctrl.queryInterfaceTo(aStorageController);
     
    39793978
    39803979    ComObjPtr<StorageController> ctrl;
    3981     rc = getStorageControllerByName (aName, ctrl, true /* aSetError */);
     3980    rc = getStorageControllerByName(aName, ctrl, true /* aSetError */);
    39823981    if (FAILED(rc)) return rc;
    39833982
     
    40003999    ctrl->unshare();
    40014000
    4002     mStorageControllers->remove (ctrl);
     4001    mStorageControllers->remove(ctrl);
    40034002
    40044003    /* inform the direct session if any */
     
    40564055                    if (typeOfBlock == u32Type)
    40574056                    {
    4058                         if (cbBlock > 2 * sizeof (uint32_t))
     4057                        if (cbBlock > 2 * sizeof(uint32_t))
    40594058                        {
    4060                             cbData = cbBlock - 2 * sizeof (uint32_t);
     4059                            cbData = cbBlock - 2 * sizeof(uint32_t);
    40614060                            pu8Data = (uint8_t *)RTMemAlloc(cbData);
    40624061                            if (pu8Data == NULL)
     
    44444443{
    44454444    AutoCaller autoCaller(this);
    4446     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     4445    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    44474446
    44484447    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    44494448
    4450     AssertReturn (!mData->m_strConfigFileFull.isEmpty(), VERR_GENERAL_FAILURE);
     4449    AssertReturn(!mData->m_strConfigFileFull.isEmpty(), VERR_GENERAL_FAILURE);
    44514450
    44524451    Utf8Str strSettingsDir = mData->m_strConfigFileFull;
     
    44754474{
    44764475    AutoCaller autoCaller(this);
    4477     AssertComRCReturn (autoCaller.rc(), (void) 0);
     4476    AssertComRCReturn(autoCaller.rc(), (void)0);
    44784477
    44794478    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    44804479
    4481     AssertReturnVoid (!mData->m_strConfigFileFull.isEmpty());
     4480    AssertReturnVoid(!mData->m_strConfigFileFull.isEmpty());
    44824481
    44834482    Utf8Str settingsDir = mData->m_strConfigFileFull;
     
    44994498 *  \a aLogFolder argument.
    45004499 */
    4501 void Machine::getLogFolder (Utf8Str &aLogFolder)
    4502 {
    4503     AutoCaller autoCaller(this);
    4504     AssertComRCReturnVoid (autoCaller.rc());
     4500void Machine::getLogFolder(Utf8Str &aLogFolder)
     4501{
     4502    AutoCaller autoCaller(this);
     4503    AssertComRCReturnVoid(autoCaller.rc());
    45054504
    45064505    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    45074506
    45084507    Utf8Str settingsDir;
    4509     if (isInOwnDir (&settingsDir))
     4508    if (isInOwnDir(&settingsDir))
    45104509    {
    45114510        /* Log folder is <Machines>/<VM_Name>/Logs */
    4512         aLogFolder = Utf8StrFmt ("%s%cLogs", settingsDir.raw(), RTPATH_DELIMITER);
     4511        aLogFolder = Utf8StrFmt("%s%cLogs", settingsDir.raw(), RTPATH_DELIMITER);
    45134512    }
    45144513    else
     
    47274726    }
    47284727
    4729     if (mData->mSession.mProgress)
    4730     {
    4731         /* finalize the progress after setting the state, for consistency */
    4732         mData->mSession.mProgress->notifyComplete(rc);
    4733         mData->mSession.mProgress.setNull();
    4734     }
    4735 
    47364728    /* Leave the lock since SessionMachine::uninit() locks VirtualBox which
    47374729     * would break the lock order */
     
    47814773
    47824774    /* may not be busy */
    4783     AssertReturn(!Global::IsOnlineOrTransient (mData->mMachineState), E_FAIL);
     4775    AssertReturn(!Global::IsOnlineOrTransient(mData->mMachineState), E_FAIL);
    47844776
    47854777    /* get the path to the executable */
     
    48214813                    if (*var)
    48224814                    {
    4823                         char *val = strchr (var, '=');
     4815                        char *val = strchr(var, '=');
    48244816                        if (val)
    48254817                        {
    48264818                            *val++ = '\0';
    4827                             vrc2 = RTEnvSetEx (env, var, val);
     4819                            vrc2 = RTEnvSetEx(env, var, val);
    48284820                        }
    48294821                        else
    4830                             vrc2 = RTEnvUnsetEx (env, var);
     4822                            vrc2 = RTEnvUnsetEx(env, var);
    48314823                        if (RT_FAILURE(vrc2))
    48324824                            break;
     
    48364828            }
    48374829            if (RT_SUCCESS(vrc2) && *var)
    4838                 vrc2 = RTEnvPutEx (env, var);
    4839 
    4840             AssertRCBreakStmt (vrc2, vrc = vrc2);
     4830                vrc2 = RTEnvPutEx(env, var);
     4831
     4832            AssertRCBreakStmt(vrc2, vrc = vrc2);
    48414833        }
    48424834        while (0);
     
    48574849        const char VirtualBox_exe[] = "VirtualBox" HOSTSUFF_EXE;
    48584850# endif
    4859         Assert(sz >= sizeof (VirtualBox_exe));
    4860         strcpy (cmd, VirtualBox_exe);
     4851        Assert(sz >= sizeof(VirtualBox_exe));
     4852        strcpy(cmd, VirtualBox_exe);
    48614853
    48624854        Utf8Str idStr = mData->mUuid.toString();
     
    48804872    {
    48814873        const char VBoxSDL_exe[] = "VBoxSDL" HOSTSUFF_EXE;
    4882         Assert(sz >= sizeof (VBoxSDL_exe));
    4883         strcpy (cmd, VBoxSDL_exe);
     4874        Assert(sz >= sizeof(VBoxSDL_exe));
     4875        strcpy(cmd, VBoxSDL_exe);
    48844876
    48854877        Utf8Str idStr = mData->mUuid.toString();
     
    49084900    {
    49094901        const char VBoxHeadless_exe[] = "VBoxHeadless" HOSTSUFF_EXE;
    4910         Assert(sz >= sizeof (VBoxHeadless_exe));
    4911         strcpy (cmd, VBoxHeadless_exe);
     4902        Assert(sz >= sizeof(VBoxHeadless_exe));
     4903        strcpy(cmd, VBoxHeadless_exe);
    49124904
    49134905        Utf8Str idStr = mData->mUuid.toString();
     
    49174909# else
    49184910        Utf8Str strName = mUserData->mName;
    4919         const char * args[] ={szPath, "--comment", strName.c_str(), "--startvm", idStr.c_str(), 0, 0, 0 };
     4911        const char * args[] = {szPath, "--comment", strName.c_str(), "--startvm", idStr.c_str(), 0, 0, 0 };
    49204912# endif
    49214913#ifdef VBOX_WITH_VRDP
     
    49404932    else
    49414933    {
    4942         RTEnvDestroy (env);
     4934        RTEnvDestroy(env);
    49434935        return setError(E_INVALIDARG,
    49444936                        tr("Invalid session type: '%s'"),
     
    49464938    }
    49474939
    4948     RTEnvDestroy (env);
     4940    RTEnvDestroy(env);
    49494941
    49504942    if (RT_FAILURE(vrc))
     
    49664958    /* inform the session that it will be a remote one */
    49674959    LogFlowThisFunc(("Calling AssignMachine (NULL)...\n"));
    4968     HRESULT rc = aControl->AssignMachine (NULL);
     4960    HRESULT rc = aControl->AssignMachine(NULL);
    49694961    LogFlowThisFunc(("AssignMachine (NULL) returned %08X\n", rc));
    49704962
     
    49944986 *        (outside the lock).
    49954987 */
    4996 HRESULT Machine::openExistingSession (IInternalSessionControl *aControl)
     4988HRESULT Machine::openExistingSession(IInternalSessionControl *aControl)
    49974989{
    49984990    LogFlowThisFuncEnter();
     
    50875079 * @note locks this object for reading.
    50885080 */
    5089 #if defined (RT_OS_WINDOWS)
    5090 bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine,
    5091                              ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
    5092                              HANDLE *aIPCSem /*= NULL*/,
    5093                              bool aAllowClosing /*= false*/)
    5094 #elif defined (RT_OS_OS2)
    5095 bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine,
    5096                              ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
    5097                              HMTX *aIPCSem /*= NULL*/,
    5098                              bool aAllowClosing /*= false*/)
     5081#if defined(RT_OS_WINDOWS)
     5082bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
     5083                            ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
     5084                            HANDLE *aIPCSem /*= NULL*/,
     5085                            bool aAllowClosing /*= false*/)
     5086#elif defined(RT_OS_OS2)
     5087bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
     5088                            ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
     5089                            HMTX *aIPCSem /*= NULL*/,
     5090                            bool aAllowClosing /*= false*/)
    50995091#else
    5100 bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine,
    5101                              ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
    5102                              bool aAllowClosing /*= false*/)
     5092bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
     5093                            ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
     5094                            bool aAllowClosing /*= false*/)
    51035095#endif
    51045096{
    51055097    AutoLimitedCaller autoCaller(this);
    5106     AssertComRCReturn (autoCaller.rc(), false);
     5098    AssertComRCReturn(autoCaller.rc(), false);
    51075099
    51085100    /* just return false for inaccessible machines */
     
    51225114            *aControl = mData->mSession.mDirectControl;
    51235115
    5124 #if defined (RT_OS_WINDOWS) || defined (RT_OS_OS2)
     5116#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
    51255117        /* Additional session data */
    51265118        if (aIPCSem != NULL)
     
    51435135 * @note locks this object for reading.
    51445136 */
    5145 #if defined (RT_OS_WINDOWS) || defined (RT_OS_OS2)
    5146 bool Machine::isSessionSpawning (RTPROCESS *aPID /*= NULL*/)
     5137#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
     5138bool Machine::isSessionSpawning(RTPROCESS *aPID /*= NULL*/)
    51475139#else
    51485140bool Machine::isSessionSpawning()
     
    51505142{
    51515143    AutoLimitedCaller autoCaller(this);
    5152     AssertComRCReturn (autoCaller.rc(), false);
     5144    AssertComRCReturn(autoCaller.rc(), false);
    51535145
    51545146    /* just return false for inaccessible machines */
     
    51605152    if (mData->mSession.mState == SessionState_Spawning)
    51615153    {
    5162 #if defined (RT_OS_WINDOWS) || defined (RT_OS_OS2)
     5154#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
    51635155        /* Additional session data */
    51645156        if (aPID != NULL)
     
    52495241        mData->mSession.mState = SessionState_Closed;
    52505242
    5251         /* finalize the progress after setting the state, for consistency */
     5243        /* finalize the progress after setting the state */
    52525244        if (!mData->mSession.mProgress.isNull())
    52535245        {
     
    53805372    {
    53815373        /* we may have had implicit modifications we want to cancel on failure*/
    5382         rollback (false /* aNotify */);
     5374        rollback(false /* aNotify */);
    53835375    }
    53845376
     
    54055397 * @note Locks this object for writing.
    54065398 */
    5407 HRESULT Machine::addStateDependency (StateDependency aDepType /* = AnyStateDep */,
    5408                                      MachineState_T *aState /* = NULL */,
    5409                                      BOOL *aRegistered /* = NULL */)
     5399HRESULT Machine::addStateDependency(StateDependency aDepType /* = AnyStateDep */,
     5400                                    MachineState_T *aState /* = NULL */,
     5401                                    BOOL *aRegistered /* = NULL */)
    54105402{
    54115403    AutoCaller autoCaller(this);
     
    54525444{
    54535445    AutoCaller autoCaller(this);
    5454     AssertComRCReturnVoid (autoCaller.rc());
     5446    AssertComRCReturnVoid(autoCaller.rc());
    54555447
    54565448    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    54575449
    5458     AssertReturnVoid (mData->mMachineStateDeps != 0
    5459                       /* releaseStateDependency() w/o addStateDependency()? */);
     5450    /* releaseStateDependency() w/o addStateDependency()? */
     5451    AssertReturnVoid(mData->mMachineStateDeps != 0);
    54605452    -- mData->mMachineStateDeps;
    54615453
     
    55635555    AutoCaller autoCaller(this);
    55645556    AssertComRCReturnRC(autoCaller.rc());
    5565     AssertComRCReturn (autoCaller.state() == InInit ||
    5566                        autoCaller.state() == Limited, E_FAIL);
     5557    AssertComRCReturn(autoCaller.state() == InInit ||
     5558                      autoCaller.state() == Limited, E_FAIL);
    55675559
    55685560    AssertReturn(!mData->mAccessible, E_FAIL);
     
    57165708                continue;
    57175709            HRESULT rc = hd->detachFrom(mData->mUuid, getSnapshotId());
    5718             AssertComRC (rc);
     5710            AssertComRC(rc);
    57195711        }
    57205712    }
     
    57605752void Machine::ensureNoStateDependencies()
    57615753{
    5762     AssertReturnVoid (isWriteLockOnCurrentThread());
     5754    AssertReturnVoid(isWriteLockOnCurrentThread());
    57635755
    57645756    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    57695761        /* lazy semaphore creation */
    57705762        if (mData->mMachineStateDepsSem == NIL_RTSEMEVENTMULTI)
    5771             RTSemEventMultiCreate (&mData->mMachineStateDepsSem);
     5763            RTSemEventMultiCreate(&mData->mMachineStateDepsSem);
    57725764
    57735765        LogFlowThisFunc(("Waiting for state deps (%d) to drop to zero...\n",
     
    57785770        /* reset the semaphore before waiting, the last dependant will signal
    57795771         * it */
    5780         RTSemEventMultiReset (mData->mMachineStateDepsSem);
     5772        RTSemEventMultiReset(mData->mMachineStateDepsSem);
    57815773
    57825774        alock.leave();
    57835775
    5784         RTSemEventMultiWait (mData->mMachineStateDepsSem, RT_INDEFINITE_WAIT);
     5776        RTSemEventMultiWait(mData->mMachineStateDepsSem, RT_INDEFINITE_WAIT);
    57855777
    57865778        alock.enter();
     
    57985790 * @note Locks this object for writing.
    57995791 */
    5800 HRESULT Machine::setMachineState (MachineState_T aMachineState)
     5792HRESULT Machine::setMachineState(MachineState_T aMachineState)
    58015793{
    58025794    LogFlowThisFuncEnter();
     
    58045796
    58055797    AutoCaller autoCaller(this);
    5806     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     5798    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    58075799
    58085800    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    58155807        mData->mMachineState = aMachineState;
    58165808
    5817         RTTimeNow (&mData->mLastStateChange);
     5809        RTTimeNow(&mData->mLastStateChange);
    58185810
    58195811        mParent->onMachineStateChange(mData->mUuid, aMachineState);
     
    58385830 *      must be called from under the object's lock!
    58395831 */
    5840 HRESULT Machine::findSharedFolder (CBSTR aName,
    5841                                    ComObjPtr<SharedFolder> &aSharedFolder,
    5842                                    bool aSetError /* = false */)
     5832HRESULT Machine::findSharedFolder(CBSTR aName,
     5833                                  ComObjPtr<SharedFolder> &aSharedFolder,
     5834                                  bool aSetError /* = false */)
    58435835{
    58445836    bool found = false;
     
    59055897        }
    59065898        else
    5907             unconst (mData->mUuid) = mData->m_pMachineConfigFile->uuid;
     5899            unconst(mData->mUuid) = mData->m_pMachineConfigFile->uuid;
    59085900
    59095901        /* name (required) */
     
    63656357 * @param aNode        <HardDiskAttachments> node.
    63666358 * @param aRegistered  true when the machine is being loaded on VirtualBox
    6367  *                     startup, or when a snapshot is being loaded (wchich
     6359 *                     startup, or when a snapshot is being loaded (which
    63686360 *                     currently can happen on startup only)
    63696361 * @param aSnapshotId  pointer to the snapshot ID if this is a snapshot machine
     
    66496641    }
    66506642
    6651     aSnapshot = mData->mFirstSnapshot->findChildOrSelf (aName);
     6643    aSnapshot = mData->mFirstSnapshot->findChildOrSelf(aName);
    66526644
    66536645    if (!aSnapshot)
     
    66736665                                            bool aSetError /* = false */)
    66746666{
    6675     AssertReturn (!aName.isEmpty(), E_INVALIDARG);
     6667    AssertReturn(!aName.isEmpty(), E_INVALIDARG);
    66766668
    66776669    for (StorageControllerList::const_iterator it = mStorageControllers->begin();
     
    67726764            {
    67736765                newConfigDir.stripFilename();
    6774                 newConfigDir = Utf8StrFmt ("%s%c%s",
     6766                newConfigDir = Utf8StrFmt("%s%c%s",
    67756767                    newConfigDir.raw(), RTPATH_DELIMITER, newName.raw());
    67766768                /* new dir and old dir cannot be equal here because of 'if'
     
    67806772                {
    67816773                    /* perform real rename only if the machine is not new */
    6782                     vrc = RTPathRename (configDir.raw(), newConfigDir.raw(), 0);
     6774                    vrc = RTPathRename(configDir.raw(), newConfigDir.raw(), 0);
    67836775                    if (RT_FAILURE(vrc))
    67846776                    {
     
    67946786            }
    67956787
    6796             newConfigFile = Utf8StrFmt ("%s%c%s.xml",
     6788            newConfigFile = Utf8StrFmt("%s%c%s.xml",
    67976789                newConfigDir.raw(), RTPATH_DELIMITER, newName.raw());
    67986790
     
    68086800                {
    68096801                    /* perform real rename only if the machine is not new */
    6810                     vrc = RTFileRename (configFile.raw(), newConfigFile.raw(), 0);
     6802                    vrc = RTFileRename(configFile.raw(), newConfigFile.raw(), 0);
    68116803                    if (RT_FAILURE(vrc))
    68126804                    {
     
    68286820            /* try to get the relative path for mConfigFile */
    68296821            Utf8Str path = newConfigFile;
    6830             mParent->calculateRelativePath (path, path);
     6822            mParent->calculateRelativePath(path, path);
    68316823            mData->m_strConfigFile = path;
    68326824
     
    68516843                                  path.raw() + configDir.length());
    68526844                mUserData->mSnapshotFolderFull = path;
    6853                 calculateRelativePath (path, path);
     6845                calculateRelativePath(path, path);
    68546846                mUserData->mSnapshotFolder = path;
    68556847            }
     
    70827074    catch (...)
    70837075    {
    7084         rc = VirtualBox::handleUnexpectedExceptions (RT_SRC_POS);
     7076        rc = VirtualBox::handleUnexpectedExceptions(RT_SRC_POS);
    70857077    }
    70867078
     
    71097101HRESULT Machine::saveAllSnapshots()
    71107102{
    7111     AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
     7103    AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
    71127104
    71137105    HRESULT rc = S_OK;
     
    71417133    catch (...)
    71427134    {
    7143         rc = VirtualBox::handleUnexpectedExceptions (RT_SRC_POS);
     7135        rc = VirtualBox::handleUnexpectedExceptions(RT_SRC_POS);
    71447136    }
    71457137
     
    74857477    catch (...)
    74867478    {
    7487         rc = VirtualBox::handleUnexpectedExceptions (RT_SRC_POS);
     7479        rc = VirtualBox::handleUnexpectedExceptions(RT_SRC_POS);
    74887480    }
    74897481
     
    75357527
    75367528    AutoCaller autoCaller(this);
    7537     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     7529    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    75387530
    75397531    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    75657557                    Medium* pHD = pAtt->getMedium();
    75667558                    Assert(pHD);
    7567                     rc = pHD->LockRead (NULL);
     7559                    rc = pHD->LockRead(NULL);
    75687560                    if (FAILED(rc)) throw rc;
    75697561                    lockedMedia.push_back(pHD);
     
    76917683    if (FAILED(rc))
    76927684    {
    7693         MultiResultRef mrc (rc);
     7685        MultiResultRef mrc(rc);
    76947686
    76957687        mrc = deleteImplicitDiffs(pfNeedsSaveSettings);
     
    77147706{
    77157707    AutoCaller autoCaller(this);
    7716     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     7708    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    77177709
    77187710    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    77427734            rc = hd->detachFrom(mData->mUuid);
    77437735            AssertComRC(rc);
    7744             implicitAtts.push_back (*it);
     7736            implicitAtts.push_back(*it);
    77457737            continue;
    77467738        }
     
    77617753    mMediaData.rollback();
    77627754
    7763     MultiResult mrc (S_OK);
     7755    MultiResult mrc(S_OK);
    77647756
    77657757    /* delete unused implicit diffs */
     
    77757767             && oldState != MachineState_DeletingSnapshot
    77767768           )
    7777             setMachineState (MachineState_SettingUp);
     7769            setMachineState(MachineState_SettingUp);
    77787770
    77797771        alock.leave();
     
    78037795        if (mData->mMachineState == MachineState_SettingUp)
    78047796        {
    7805             setMachineState (oldState);
     7797            setMachineState(oldState);
    78067798        }
    78077799    }
     
    79097901{
    79107902    AutoCaller autoCaller(this);
    7911     AssertComRCReturnVoid (autoCaller.rc());
     7903    AssertComRCReturnVoid(autoCaller.rc());
    79127904
    79137905    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    81378129        *aSettingsDir = settingsDir;
    81388130
    8139     return Bstr (dirName) == mUserData->mName;
     8131    return Bstr(dirName) == mUserData->mName;
    81408132}
    81418133
     
    81508142{
    81518143    AutoCaller autoCaller(this);
    8152     AssertComRCReturn (autoCaller.rc(), (void) 0);
     8144    AssertComRCReturn(autoCaller.rc(), (void)0);
    81538145
    81548146    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    82818273{
    82828274    AutoCaller autoCaller(this);
    8283     AssertComRCReturnVoid (autoCaller.rc());
    8284 
    8285     AutoCaller peerCaller (mPeer);
    8286     AssertComRCReturnVoid (peerCaller.rc());
     8275    AssertComRCReturnVoid(autoCaller.rc());
     8276
     8277    AutoCaller peerCaller(mPeer);
     8278    AssertComRCReturnVoid(peerCaller.rc());
    82878279
    82888280    AutoMultiWriteLock2 alock(mPeer, this COMMA_LOCKVAL_SRC_POS);
     
    89128904        Assert(mData->mSession.mState == SessionState_Closing);
    89138905        Assert(!mData->mSession.mProgress.isNull());
    8914 
    8915         mData->mSession.mProgress->notifyComplete (S_OK);
     8906    }
     8907    if (mData->mSession.mProgress)
     8908    {
     8909        if (aReason == Uninit::Normal)
     8910            mData->mSession.mProgress->notifyComplete(S_OK);
     8911        else
     8912            mData->mSession.mProgress->notifyComplete(E_FAIL,
     8913                                                      COM_IIDOF(ISession),
     8914                                                      getComponentName(),
     8915                                                      tr("The VM session was aborted"));
    89168916        mData->mSession.mProgress.setNull();
    89178917    }
     
    89298929#if defined(RT_OS_WINDOWS)
    89308930    if (mIPCSem)
    8931         ::CloseHandle (mIPCSem);
     8931        ::CloseHandle(mIPCSem);
    89328932    mIPCSem = NULL;
    89338933#elif defined(RT_OS_OS2)
    89348934    if (mIPCSem != NULLHANDLE)
    8935         ::DosCloseMutexSem (mIPCSem);
     8935        ::DosCloseMutexSem(mIPCSem);
    89368936    mIPCSem = NULLHANDLE;
    89378937#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    89388938    if (mIPCSem >= 0)
    8939         ::semctl (mIPCSem, 0, IPC_RMID);
     8939        ::semctl(mIPCSem, 0, IPC_RMID);
    89408940    mIPCSem = -1;
    89418941# ifdef VBOX_WITH_NEW_SYS_V_KEYGEN
     
    89478947
    89488948    /* fire an event */
    8949     mParent->onSessionStateChange (mData->mUuid, SessionState_Closed);
     8949    mParent->onSessionStateChange(mData->mUuid, SessionState_Closed);
    89508950
    89518951    uninitDataAndChildObjects();
     
    89858985{
    89868986    AutoCaller autoCaller(this);
    8987     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     8987    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    89888988
    89898989    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    89978997 *  @note Locks the same as #setMachineState() does.
    89988998 */
    8999 STDMETHODIMP SessionMachine::UpdateState (MachineState_T aMachineState)
    9000 {
    9001     return setMachineState (aMachineState);
     8999STDMETHODIMP SessionMachine::UpdateState(MachineState_T aMachineState)
     9000{
     9001    return setMachineState(aMachineState);
    90029002}
    90039003
     
    90059005 *  @note Locks this object for reading.
    90069006 */
    9007 STDMETHODIMP SessionMachine::GetIPCId (BSTR *aId)
    9008 {
    9009     AutoCaller autoCaller(this);
    9010     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9007STDMETHODIMP SessionMachine::GetIPCId(BSTR *aId)
     9008{
     9009    AutoCaller autoCaller(this);
     9010    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    90119011
    90129012    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    90289028
    90299029/**
     9030 *  @note Locks this object for writing.
     9031 */
     9032STDMETHODIMP SessionMachine::SetPowerUpInfo(IVirtualBoxErrorInfo *aError)
     9033{
     9034    AutoCaller autoCaller(this);
     9035    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
     9036
     9037    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     9038
     9039    if (   mData->mSession.mState == SessionState_Open
     9040        && mData->mSession.mProgress)
     9041    {
     9042        /* Finalize the progress, since the remote session has completed
     9043         * power on (successful or not). */
     9044        if (aError)
     9045        {
     9046            /* Transfer error information immediately, as the
     9047             * IVirtualBoxErrorInfo object is most likely transient. */
     9048            HRESULT rc;
     9049            LONG rRc = S_OK;
     9050            rc = aError->COMGETTER(ResultCode)(&rRc);
     9051            AssertComRCReturnRC(rc);
     9052            Bstr rIID;
     9053            rc = aError->COMGETTER(InterfaceID)(rIID.asOutParam());
     9054            AssertComRCReturnRC(rc);
     9055            Bstr rComponent;
     9056            rc = aError->COMGETTER(Component)(rComponent.asOutParam());
     9057            AssertComRCReturnRC(rc);
     9058            Bstr rText;
     9059            rc = aError->COMGETTER(Text)(rText.asOutParam());
     9060            AssertComRCReturnRC(rc);
     9061            mData->mSession.mProgress->notifyComplete(rRc, Guid(rIID), rComponent, Utf8Str(rText).raw());
     9062        }
     9063        else
     9064            mData->mSession.mProgress->notifyComplete(S_OK);
     9065        mData->mSession.mProgress.setNull();
     9066
     9067        return S_OK;
     9068    }
     9069    else
     9070        return VBOX_E_INVALID_OBJECT_STATE;
     9071}
     9072
     9073/**
    90309074 *  Goes through the USB filters of the given machine to see if the given
    90319075 *  device matches any filter or not.
     
    90339077 *  @note Locks the same as USBController::hasMatchingFilter() does.
    90349078 */
    9035 STDMETHODIMP SessionMachine::RunUSBDeviceFilters (IUSBDevice *aUSBDevice,
    9036                                                   BOOL *aMatched,
    9037                                                   ULONG *aMaskedIfs)
     9079STDMETHODIMP SessionMachine::RunUSBDeviceFilters(IUSBDevice *aUSBDevice,
     9080                                                 BOOL *aMatched,
     9081                                                 ULONG *aMaskedIfs)
    90389082{
    90399083    LogFlowThisFunc(("\n"));
    90409084
    9041     CheckComArgNotNull (aUSBDevice);
     9085    CheckComArgNotNull(aUSBDevice);
    90429086    CheckComArgOutPointerValid(aMatched);
    90439087
    90449088    AutoCaller autoCaller(this);
    9045     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9089    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    90469090
    90479091#ifdef VBOX_WITH_USB
    9048     *aMatched = mUSBController->hasMatchingFilter (aUSBDevice, aMaskedIfs);
     9092    *aMatched = mUSBController->hasMatchingFilter(aUSBDevice, aMaskedIfs);
    90499093#else
    90509094    NOREF(aUSBDevice);
     
    90599103 *  @note Locks the same as Host::captureUSBDevice() does.
    90609104 */
    9061 STDMETHODIMP SessionMachine::CaptureUSBDevice (IN_BSTR aId)
     9105STDMETHODIMP SessionMachine::CaptureUSBDevice(IN_BSTR aId)
    90629106{
    90639107    LogFlowThisFunc(("\n"));
     
    90739117    USBProxyService *service = mParent->host()->usbProxyService();
    90749118    AssertReturn(service, E_FAIL);
    9075     return service->captureDeviceForVM (this, Guid(aId));
     9119    return service->captureDeviceForVM(this, Guid(aId));
    90769120#else
    90779121    NOREF(aId);
     
    90839127 *  @note Locks the same as Host::detachUSBDevice() does.
    90849128 */
    9085 STDMETHODIMP SessionMachine::DetachUSBDevice (IN_BSTR aId, BOOL aDone)
     9129STDMETHODIMP SessionMachine::DetachUSBDevice(IN_BSTR aId, BOOL aDone)
    90869130{
    90879131    LogFlowThisFunc(("\n"));
    90889132
    90899133    AutoCaller autoCaller(this);
    9090     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9134    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    90919135
    90929136#ifdef VBOX_WITH_USB
    90939137    USBProxyService *service = mParent->host()->usbProxyService();
    90949138    AssertReturn(service, E_FAIL);
    9095     return service->detachDeviceFromVM (this, Guid(aId), !!aDone);
     9139    return service->detachDeviceFromVM(this, Guid(aId), !!aDone);
    90969140#else
    90979141    NOREF(aId);
     
    91149158
    91159159    AutoCaller autoCaller(this);
    9116     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9160    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    91179161
    91189162#ifdef VBOX_WITH_USB
    9119     HRESULT rc = mUSBController->notifyProxy (true /* aInsertFilters */);
     9163    HRESULT rc = mUSBController->notifyProxy(true /* aInsertFilters */);
    91209164    AssertComRC(rc);
    9121     NOREF (rc);
     9165    NOREF(rc);
    91229166
    91239167    USBProxyService *service = mParent->host()->usbProxyService();
    91249168    AssertReturn(service, E_FAIL);
    9125     return service->autoCaptureDevicesForVM (this);
     9169    return service->autoCaptureDevicesForVM(this);
    91269170#else
    91279171    return S_OK;
     
    91399183 *  @note Locks what called methods lock.
    91409184 */
    9141 STDMETHODIMP SessionMachine::DetachAllUSBDevices (BOOL aDone)
     9185STDMETHODIMP SessionMachine::DetachAllUSBDevices(BOOL aDone)
    91429186{
    91439187    LogFlowThisFunc(("\n"));
    91449188
    91459189    AutoCaller autoCaller(this);
    9146     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9190    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    91479191
    91489192#ifdef VBOX_WITH_USB
    9149     HRESULT rc = mUSBController->notifyProxy (false /* aInsertFilters */);
     9193    HRESULT rc = mUSBController->notifyProxy(false /* aInsertFilters */);
    91509194    AssertComRC(rc);
    9151     NOREF (rc);
     9195    NOREF(rc);
    91529196
    91539197    USBProxyService *service = mParent->host()->usbProxyService();
    91549198    AssertReturn(service, E_FAIL);
    9155     return service->detachAllDevicesFromVM (this, !!aDone, false /* aAbnormal */);
     9199    return service->detachAllDevicesFromVM(this, !!aDone, false /* aAbnormal */);
    91569200#else
    91579201    NOREF(aDone);
     
    91639207 *  @note Locks this object for writing.
    91649208 */
    9165 STDMETHODIMP SessionMachine::OnSessionEnd (ISession *aSession,
    9166                                            IProgress **aProgress)
     9209STDMETHODIMP SessionMachine::OnSessionEnd(ISession *aSession,
     9210                                          IProgress **aProgress)
    91679211{
    91689212    LogFlowThisFuncEnter();
     
    91819225
    91829226    /* get IInternalSessionControl interface */
    9183     ComPtr<IInternalSessionControl> control (aSession);
     9227    ComPtr<IInternalSessionControl> control(aSession);
    91849228
    91859229    ComAssertRet(!control.isNull(), E_INVALIDARG);
     
    92059249        LogFlowThisFunc(("Direct control is set to NULL\n"));
    92069250
     9251        if (mData->mSession.mProgress)
     9252        {
     9253            /* finalize the progress, someone might wait if a frontend
     9254             * closes the session before powering on the VM. */
     9255            mData->mSession.mProgress->notifyComplete(E_FAIL,
     9256                                                      COM_IIDOF(ISession),
     9257                                                      getComponentName(),
     9258                                                      tr("The VM session was closed before any attempt to power it on"));
     9259            mData->mSession.mProgress.setNull();
     9260        }
     9261
    92079262        /*  Create the progress object the client will use to wait until
    92089263         * #checkForDeath() is called to uninitialize this session object after
    92099264         * it releases the IPC semaphore. */
     9265        Assert(mData->mSession.mProgress.isNull());
    92109266        ComObjPtr<Progress> progress;
    92119267        progress.createObject();
    9212         progress->init (mParent, static_cast <IMachine *> (mPeer),
    9213                         Bstr (tr ("Closing session")), FALSE /* aCancelable */);
     9268        progress->init(mParent, static_cast<IMachine *>(mPeer),
     9269                       Bstr(tr("Closing session")), FALSE /* aCancelable */);
    92149270        progress.queryInterfaceTo(aProgress);
    92159271        mData->mSession.mProgress = progress;
     
    92229278        while (it != mData->mSession.mRemoteControls.end())
    92239279        {
    9224             if (control.equalsTo (*it))
     9280            if (control.equalsTo(*it))
    92259281                break;
    92269282            ++it;
    92279283        }
    92289284        BOOL found = it != mData->mSession.mRemoteControls.end();
    9229         ComAssertMsgRet (found, ("The session is not found in the session list!"),
     9285        ComAssertMsgRet(found, ("The session is not found in the session list!"),
    92309286                         E_INVALIDARG);
    9231         mData->mSession.mRemoteControls.remove (*it);
     9287        mData->mSession.mRemoteControls.remove(*it);
    92329288    }
    92339289
     
    92399295 *  @note Locks this object for writing.
    92409296 */
    9241 STDMETHODIMP SessionMachine::BeginSavingState (IProgress *aProgress, BSTR *aStateFilePath)
     9297STDMETHODIMP SessionMachine::BeginSavingState(IProgress *aProgress, BSTR *aStateFilePath)
    92429298{
    92439299    LogFlowThisFuncEnter();
     
    92479303
    92489304    AutoCaller autoCaller(this);
    9249     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9305    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    92509306
    92519307    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    92599315    /* memorize the progress ID and add it to the global collection */
    92609316    Bstr progressId;
    9261     HRESULT rc = aProgress->COMGETTER(Id) (progressId.asOutParam());
    9262     AssertComRCReturn (rc, rc);
    9263     rc = mParent->addProgress (aProgress);
    9264     AssertComRCReturn (rc, rc);
     9317    HRESULT rc = aProgress->COMGETTER(Id)(progressId.asOutParam());
     9318    AssertComRCReturn(rc, rc);
     9319    rc = mParent->addProgress(aProgress);
     9320    AssertComRCReturn(rc, rc);
    92659321
    92669322    Bstr stateFilePath;
     
    92689324    if (mData->mMachineState == MachineState_Paused)
    92699325    {
    9270         stateFilePath = Utf8StrFmt ("%ls%c{%RTuuid}.sav",
    9271                                     mUserData->mSnapshotFolderFull.raw(),
    9272                                     RTPATH_DELIMITER, mData->mUuid.raw());
     9326        stateFilePath = Utf8StrFmt("%ls%c{%RTuuid}.sav",
     9327                                   mUserData->mSnapshotFolderFull.raw(),
     9328                                   RTPATH_DELIMITER, mData->mUuid.raw());
    92739329    }
    92749330
     
    92799335
    92809336    /* set the state to Saving (this is expected by Console::SaveState()) */
    9281     setMachineState (MachineState_Saving);
     9337    setMachineState(MachineState_Saving);
    92829338
    92839339    stateFilePath.cloneTo(aStateFilePath);
     
    92899345 *  @note Locks mParent + this object for writing.
    92909346 */
    9291 STDMETHODIMP SessionMachine::EndSavingState (BOOL aSuccess)
     9347STDMETHODIMP SessionMachine::EndSavingState(BOOL aSuccess)
    92929348{
    92939349    LogFlowThisFunc(("\n"));
    92949350
    92959351    AutoCaller autoCaller(this);
    9296     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9352    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    92979353
    92989354    /* endSavingState() need mParent lock */
     
    93129368     */
    93139369    if (aSuccess)
    9314         setMachineState (MachineState_Saved);
     9370        setMachineState(MachineState_Saved);
    93159371    else
    9316         setMachineState (mSnapshotData.mLastState);
    9317 
    9318     return endSavingState (aSuccess);
     9372        setMachineState(mSnapshotData.mLastState);
     9373
     9374    return endSavingState(aSuccess);
    93199375}
    93209376
     
    93229378 *  @note Locks this object for writing.
    93239379 */
    9324 STDMETHODIMP SessionMachine::AdoptSavedState (IN_BSTR aSavedStateFile)
     9380STDMETHODIMP SessionMachine::AdoptSavedState(IN_BSTR aSavedStateFile)
    93259381{
    93269382    LogFlowThisFunc(("\n"));
     
    93299385
    93309386    AutoCaller autoCaller(this);
    9331     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9387    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    93329388
    93339389    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    93519407     * update the settings file */
    93529408
    9353     return setMachineState (MachineState_Saved);
     9409    return setMachineState(MachineState_Saved);
    93549410}
    93559411
     
    93659421
    93669422    AutoCaller autoCaller(this);
    9367     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9423    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    93689424
    93699425    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    93759431
    93769432    size_t cEntries = mHWData->mGuestProperties.size();
    9377     com::SafeArray<BSTR> names (cEntries);
    9378     com::SafeArray<BSTR> values (cEntries);
    9379     com::SafeArray<ULONG64> timestamps (cEntries);
    9380     com::SafeArray<BSTR> flags (cEntries);
     9433    com::SafeArray<BSTR> names(cEntries);
     9434    com::SafeArray<BSTR> values(cEntries);
     9435    com::SafeArray<ULONG64> timestamps(cEntries);
     9436    com::SafeArray<BSTR> flags(cEntries);
    93819437    unsigned i = 0;
    93829438    for (HWData::GuestPropertyList::iterator it = mHWData->mGuestProperties.begin();
     
    96389694#if defined(RT_OS_WINDOWS)
    96399695
    9640         AssertMsg (mIPCSem, ("semaphore must be created"));
     9696        AssertMsg(mIPCSem, ("semaphore must be created"));
    96419697
    96429698        /* release the IPC mutex */
    9643         ::ReleaseMutex (mIPCSem);
     9699        ::ReleaseMutex(mIPCSem);
    96449700
    96459701        terminated = true;
     
    96479703#elif defined(RT_OS_OS2)
    96489704
    9649         AssertMsg (mIPCSem, ("semaphore must be created"));
     9705        AssertMsg(mIPCSem, ("semaphore must be created"));
    96509706
    96519707        /* release the IPC mutex */
    9652         ::DosReleaseMutexSem (mIPCSem);
     9708        ::DosReleaseMutexSem(mIPCSem);
    96539709
    96549710        terminated = true;
     
    96569712#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    96579713
    9658         AssertMsg (mIPCSem >= 0, ("semaphore must be created"));
    9659 
    9660         int val = ::semctl (mIPCSem, 0, GETVAL);
     9714        AssertMsg(mIPCSem >= 0, ("semaphore must be created"));
     9715
     9716        int val = ::semctl(mIPCSem, 0, GETVAL);
    96619717        if (val > 0)
    96629718        {
     
    96729728
    96739729    if (terminated)
    9674         uninit (reason);
     9730        uninit(reason);
    96759731
    96769732    return terminated;
     
    96809736 *  @note Locks this object for reading.
    96819737 */
    9682 HRESULT SessionMachine::onNetworkAdapterChange (INetworkAdapter *networkAdapter, BOOL changeAdapter)
     9738HRESULT SessionMachine::onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter)
    96839739{
    96849740    LogFlowThisFunc(("\n"));
    96859741
    96869742    AutoCaller autoCaller(this);
    9687     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9743    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    96889744
    96899745    ComPtr<IInternalSessionControl> directControl;
     
    96979753        return S_OK;
    96989754
    9699     return directControl->OnNetworkAdapterChange (networkAdapter, changeAdapter);
     9755    return directControl->OnNetworkAdapterChange(networkAdapter, changeAdapter);
    97009756}
    97019757
     
    97039759 *  @note Locks this object for reading.
    97049760 */
    9705 HRESULT SessionMachine::onSerialPortChange (ISerialPort *serialPort)
     9761HRESULT SessionMachine::onSerialPortChange(ISerialPort *serialPort)
    97069762{
    97079763    LogFlowThisFunc(("\n"));
    97089764
    97099765    AutoCaller autoCaller(this);
    9710     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9766    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    97119767
    97129768    ComPtr<IInternalSessionControl> directControl;
     
    97209776        return S_OK;
    97219777
    9722     return directControl->OnSerialPortChange (serialPort);
     9778    return directControl->OnSerialPortChange(serialPort);
    97239779}
    97249780
     
    97269782 *  @note Locks this object for reading.
    97279783 */
    9728 HRESULT SessionMachine::onParallelPortChange (IParallelPort *parallelPort)
     9784HRESULT SessionMachine::onParallelPortChange(IParallelPort *parallelPort)
    97299785{
    97309786    LogFlowThisFunc(("\n"));
     
    97499805 *  @note Locks this object for reading.
    97509806 */
    9751 HRESULT SessionMachine::onStorageControllerChange ()
     9807HRESULT SessionMachine::onStorageControllerChange()
    97529808{
    97539809    LogFlowThisFunc(("\n"));
    97549810
    97559811    AutoCaller autoCaller(this);
    9756     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9812    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    97579813
    97589814    ComPtr<IInternalSessionControl> directControl;
     
    97669822        return S_OK;
    97679823
    9768     return directControl->OnStorageControllerChange ();
     9824    return directControl->OnStorageControllerChange();
    97699825}
    97709826
     
    97779833
    97789834    AutoCaller autoCaller(this);
    9779     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9835    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    97809836
    97819837    ComPtr<IInternalSessionControl> directControl;
     
    98239879
    98249880    AutoCaller autoCaller(this);
    9825     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9881    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    98269882
    98279883    ComPtr<IInternalSessionControl> directControl;
     
    98469902
    98479903    AutoCaller autoCaller(this);
    9848     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     9904    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    98499905
    98509906    ComPtr<IInternalSessionControl> directControl;
     
    98819937        return S_OK;
    98829938
    9883     return directControl->OnSharedFolderChange (FALSE /* aGlobal */);
     9939    return directControl->OnSharedFolderChange(FALSE /* aGlobal */);
    98849940}
    98859941
     
    98909946 *  @note Caller must have requested machine read lock.
    98919947 */
    9892 bool SessionMachine::hasMatchingUSBFilter (const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
     9948bool SessionMachine::hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
    98939949{
    98949950    AutoCaller autoCaller(this);
     
    99109966        /** @todo Live Migration: snapshoting & teleporting. Need to fend things of
    99119967         *        elsewhere... */
    9912             return mUSBController->hasMatchingFilter (aDevice, aMaskedIfs);
     9968            return mUSBController->hasMatchingFilter(aDevice, aMaskedIfs);
    99139969        default: break;
    99149970    }
     
    99239979 *  @note The calls shall hold no locks. Will temporarily lock this object for reading.
    99249980 */
    9925 HRESULT SessionMachine::onUSBDeviceAttach (IUSBDevice *aDevice,
    9926                                            IVirtualBoxErrorInfo *aError,
    9927                                            ULONG aMaskedIfs)
     9981HRESULT SessionMachine::onUSBDeviceAttach(IUSBDevice *aDevice,
     9982                                          IVirtualBoxErrorInfo *aError,
     9983                                          ULONG aMaskedIfs)
    99289984{
    99299985    LogFlowThisFunc(("\n"));
     
    994710003
    994810004    /* No locks should be held at this point. */
    9949     AssertMsg (RTLockValidatorWriteLockGetCount (RTThreadSelf()) == 0, ("%d\n", RTLockValidatorWriteLockGetCount (RTThreadSelf())));
    9950     AssertMsg (RTLockValidatorReadLockGetCount (RTThreadSelf()) == 0, ("%d\n", RTLockValidatorReadLockGetCount (RTThreadSelf())));
    9951 
    9952     return directControl->OnUSBDeviceAttach (aDevice, aError, aMaskedIfs);
     10005    AssertMsg(RTLockValidatorWriteLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorWriteLockGetCount(RTThreadSelf())));
     10006    AssertMsg(RTLockValidatorReadLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorReadLockGetCount(RTThreadSelf())));
     10007
     10008    return directControl->OnUSBDeviceAttach(aDevice, aError, aMaskedIfs);
    995310009}
    995410010
     
    995610012 *  @note The calls shall hold no locks. Will temporarily lock this object for reading.
    995710013 */
    9958 HRESULT SessionMachine::onUSBDeviceDetach (IN_BSTR aId,
    9959                                            IVirtualBoxErrorInfo *aError)
     10014HRESULT SessionMachine::onUSBDeviceDetach(IN_BSTR aId,
     10015                                          IVirtualBoxErrorInfo *aError)
    996010016{
    996110017    LogFlowThisFunc(("\n"));
     
    997910035
    998010036    /* No locks should be held at this point. */
    9981     AssertMsg (RTLockValidatorWriteLockGetCount (RTThreadSelf()) == 0, ("%d\n", RTLockValidatorWriteLockGetCount (RTThreadSelf())));
    9982     AssertMsg (RTLockValidatorReadLockGetCount (RTThreadSelf()) == 0, ("%d\n", RTLockValidatorReadLockGetCount (RTThreadSelf())));
    9983 
    9984     return directControl->OnUSBDeviceDetach (aId, aError);
     10037    AssertMsg(RTLockValidatorWriteLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorWriteLockGetCount(RTThreadSelf())));
     10038    AssertMsg(RTLockValidatorReadLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorReadLockGetCount(RTThreadSelf())));
     10039
     10040    return directControl->OnUSBDeviceDetach(aId, aError);
    998510041}
    998610042
     
    999710053 *  @note Locks mParent + this objects for writing.
    999810054 */
    9999 HRESULT SessionMachine::endSavingState (BOOL aSuccess)
     10055HRESULT SessionMachine::endSavingState(BOOL aSuccess)
    1000010056{
    1000110057    LogFlowThisFuncEnter();
    1000210058
    1000310059    AutoCaller autoCaller(this);
    10004     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     10060    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    1000510061
    1000610062    /* saveSettings() needs mParent lock */
     
    1005710113{
    1005810114    AutoCaller autoCaller(this);
    10059     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     10115    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    1006010116
    1006110117    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    1018010236{
    1018110237    AutoCaller autoCaller(this);
    10182     AssertComRCReturnVoid (autoCaller.rc());
     10238    AssertComRCReturnVoid(autoCaller.rc());
    1018310239
    1018410240    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    1019610252        MediumState_T state;
    1019710253        if (it->second)
    10198             rc = it->first->UnlockWrite (&state);
     10254            rc = it->first->UnlockWrite(&state);
    1019910255        else
    10200             rc = it->first->UnlockRead (&state);
     10256            rc = it->first->UnlockRead(&state);
    1020110257
    1020210258        /* The second can happen if an object was re-locked in
     
    1021410270 * @note Locks this object for writing.
    1021510271 */
    10216 HRESULT SessionMachine::setMachineState (MachineState_T aMachineState)
     10272HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
    1021710273{
    1021810274    LogFlowThisFuncEnter();
     
    1022010276
    1022110277    AutoCaller autoCaller(this);
    10222     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     10278    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    1022310279
    1022410280    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    1035810414
    1035910415    /* redirect to the underlying peer machine */
    10360     mPeer->setMachineState (aMachineState);
     10416    mPeer->setMachineState(aMachineState);
    1036110417
    1036210418    if (   aMachineState == MachineState_PoweredOff
     
    1038110437    }
    1038210438
    10383     rc = saveStateSettings (stsFlags);
     10439    rc = saveStateSettings(stsFlags);
    1038410440
    1038510441    if (   (   oldMachineState != MachineState_PoweredOff
     
    1041010466{
    1041110467    AutoCaller autoCaller(this);
    10412     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     10468    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    1041310469
    1041410470    ComPtr<IInternalSessionControl> directControl;
     
    1043310489    }
    1043410490
    10435     return directControl->UpdateMachineState (mData->mMachineState);
    10436 }
     10491    return directControl->UpdateMachineState(mData->mMachineState);
     10492}
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r26295 r26323  
    26892689        console through it is invalid. It is recommended to use
    26902690        <link to="IProgress::waitForCompletion" /> or similar calls to wait for
    2691         completion.
     2691        completion. Completion is signalled when the VM is powered on. Error
     2692        messages etc. can be queried via the progress object, if available.
    26922693
    26932694        As with all <link to="ISession" /> objects, it is recommended to call
     
    37593760    </method>
    37603761
     3762    <method name="setPowerUpInfo">
     3763      <desc>
     3764        Transfers success (@c null) or error information for this session.
     3765        This method updates the progress object to signal completion of the
     3766        <link to="IVirtualBox::openRemoteSession"/> method if appropriate,
     3767        which means that the progress object returned by
     3768        <link to="IConsole::powerUp"/>.
     3769      </desc>
     3770      <param name="error" type="IVirtualBoxErrorInfo" dir="in"/>
     3771    </method>
     3772
    37613773    <method name="runUSBDeviceFilters">
    37623774      <desc>
  • trunk/src/VBox/Main/include/MachineImpl.h

    r26295 r26323  
    829829    STDMETHOD(UpdateState)(MachineState_T machineState);
    830830    STDMETHOD(GetIPCId)(BSTR *id);
     831    STDMETHOD(SetPowerUpInfo)(IVirtualBoxErrorInfo *aError);
    831832    STDMETHOD(RunUSBDeviceFilters)(IUSBDevice *aUSBDevice, BOOL *aMatched, ULONG *aMaskedIfs);
    832833    STDMETHOD(CaptureUSBDevice)(IN_BSTR aId);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette