VirtualBox

Changeset 49324 in vbox for trunk


Ignore:
Timestamp:
Oct 29, 2013 10:05:21 PM (11 years ago)
Author:
vboxsync
Message:

Make the TurnResetIntoPowerOff setting configurable during runtime

Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r49120 r49324  
    221221    HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
    222222    HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
     223    HRESULT onExtraDataChange(IN_BSTR aMachineId, IN_BSTR aKey, IN_BSTR aVal);
    223224
    224225    HRESULT getGuestProperty(IN_BSTR aKey, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r49120 r49324  
    347347            }
    348348
     349            case VBoxEventType_OnExtraDataChanged:
     350            {
     351                ComPtr<IExtraDataChangedEvent> pEDCEv = aEvent;
     352                Bstr strMachineId;
     353                Bstr strKey;
     354                Bstr strVal;
     355                HRESULT hrc = S_OK;
     356
     357                hrc = pEDCEv->COMGETTER(MachineId)(strMachineId.asOutParam());
     358                if (FAILED(hrc)) break;
     359
     360                hrc = pEDCEv->COMGETTER(Key)(strKey.asOutParam());
     361                if (FAILED(hrc)) break;
     362
     363                hrc = pEDCEv->COMGETTER(Value)(strVal.asOutParam());
     364                if (FAILED(hrc)) break;
     365
     366                mConsole->onExtraDataChange(strMachineId.raw(), strKey.raw(), strVal.raw());
     367                break;
     368            }
     369
    349370            default:
    350371              AssertFailed();
     
    574595            eventTypes.push_back(VBoxEventType_OnNATRedirect);
    575596            eventTypes.push_back(VBoxEventType_OnHostPCIDevicePlug);
     597            eventTypes.push_back(VBoxEventType_OnExtraDataChanged);
    576598            rc = pES->RegisterListener(aVmListener, ComSafeArrayAsInParam(eventTypes), true);
    577599            AssertComRC(rc);
     
    53545376    LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    53555377    return rc;
     5378}
     5379
     5380HRESULT Console::onExtraDataChange(IN_BSTR aMachineId, IN_BSTR aKey, IN_BSTR aVal)
     5381{
     5382    LogFlowThisFunc(("\n"));
     5383
     5384    AutoCaller autoCaller(this);
     5385    AssertComRCReturnRC(autoCaller.rc());
     5386
     5387    if (!aMachineId)
     5388        return S_OK;
     5389
     5390    HRESULT hrc = S_OK;
     5391    Bstr idMachine(aMachineId);
     5392    Bstr idSelf;
     5393    hrc = mMachine->COMGETTER(Id)(idSelf.asOutParam());
     5394    if (   FAILED(hrc)
     5395        || idMachine != idSelf)
     5396        return hrc;
     5397
     5398    /* don't do anything if the VM isn't running */
     5399    SafeVMPtrQuiet ptrVM(this);
     5400    if (ptrVM.isOk())
     5401    {
     5402        Bstr strKey(aKey);
     5403        Bstr strVal(aVal);
     5404
     5405        if (strKey == "VBoxInternal2/TurnResetIntoPowerOff")
     5406        {
     5407            int vrc = VMR3SetPowerOffInsteadOfReset(ptrVM.rawUVM(), strVal == "1");
     5408            AssertRC(vrc);
     5409        }
     5410
     5411        ptrVM.release();
     5412    }
     5413
     5414    /* notify console callbacks on success */
     5415    if (SUCCEEDED(hrc))
     5416        fireExtraDataChangedEvent(mEventSource, aMachineId, aKey, aVal);
     5417
     5418    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     5419    return hrc;
    53565420}
    53575421
  • trunk/src/VBox/VMM/VMMR3/VMMR3.def

    r48982 r49324  
    358358    VMR3SetCpuExecutionCap
    359359    VMR3SetError
     360    VMR3SetPowerOffInsteadOfReset
    360361    VMR3Suspend
    361362    VMR3Teleport
Note: See TracChangeset for help on using the changeset viewer.

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