VirtualBox

Ignore:
Timestamp:
Feb 7, 2008 5:45:47 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27978
Message:

FE/SDL: use feedback from the guest to decide if we need to switch off the VM hardly or not

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r6658 r6852  
    15541554        setError (E_FAIL,
    15551555            tr ("Controlled power off failed (%Vrc)"), vrc);
     1556
     1557    LogFlowThisFunc (("rc=%08X\n", rc));
     1558    LogFlowThisFuncLeave();
     1559    return rc;
     1560}
     1561
     1562STDMETHODIMP Console::GetPowerButtonHandled(PRBool *aHandled)
     1563{
     1564    LogFlowThisFuncEnter();
     1565
     1566    AutoCaller autoCaller (this);
     1567
     1568    AutoLock lock (this);
     1569
     1570    if (mMachineState != MachineState_Running)
     1571        return E_FAIL;
     1572
     1573    /* protect mpVM */
     1574    AutoVMCaller autoVMCaller (this);
     1575    CheckComRCReturnRC (autoVMCaller.rc());
     1576
     1577    PPDMIBASE pBase;
     1578    int vrc = PDMR3QueryDeviceLun (mpVM, "acpi", 0, 0, &pBase);
     1579    bool handled = false;
     1580    if (VBOX_SUCCESS (vrc))
     1581    {
     1582        Assert (pBase);
     1583        PPDMIACPIPORT pPort =
     1584            (PPDMIACPIPORT) pBase->pfnQueryInterface(pBase, PDMINTERFACE_ACPI_PORT);
     1585        vrc = pPort ? pPort->pfnGetPowerButtonHandled(pPort, &handled) : VERR_INVALID_POINTER;
     1586    }
     1587
     1588    HRESULT rc = VBOX_SUCCESS (vrc) ? S_OK :
     1589        setError (E_FAIL,
     1590            tr ("Checking if poweroff was handled failed (%Vrc)"), vrc);
     1591
     1592    *aHandled = handled;
    15561593
    15571594    LogFlowThisFunc (("rc=%08X\n", rc));
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