VirtualBox

Changeset 13680 in vbox


Ignore:
Timestamp:
Oct 30, 2008 4:14:13 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
38643
Message:

Power notification updates

File:
1 edited

Legend:

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

    r13679 r13680  
    7474    if (state == MachineState_Running)
    7575    {
    76 #if 0
    77         ComPtr<ISession> session;
     76        ComPtr <ISession> session;
     77
     78        rc = session.createInprocObject (CLSID_Session);
     79        if (FAILED (rc))
     80            return rc;
    7881
    7982        /* get the IInternalSessionControl interface */
    8083        ComPtr <IInternalSessionControl> control = session;
    81         ComAssertMsgRet (!!control, ("No IInternalSessionControl interface"),
    82                         E_INVALIDARG);
     84        if (!control)
     85        {
     86            rc = E_INVALIDARG;
     87            goto fail;
     88        }
    8389
    8490        rc = machine->openExistingSession (control);
    85         if (FAILED (rc))
    86             return rc;
    87 
    88         /* get the associated console */
    89         ComPtr<IConsole> console;
    90         rc = session->COMGETTER(Console)(console.asOutParam());
    9191        if (SUCCEEDED (rc))
    9292        {
    93             switch (event)
     93            /* get the associated console */
     94            ComPtr<IConsole> console;
     95            rc = session->COMGETTER(Console)(console.asOutParam());
     96            if (SUCCEEDED (rc))
    9497            {
    95             case HostPowerEvent_Suspend:
    96                 rc = console->Pause();
    97                 break;
    98             case HostPowerEvent_Resume:
    99             case HostPowerEvent_BatteryLow:
    100                 break;
     98                switch (event)
     99                {
     100                case HostPowerEvent_Suspend:
     101                    rc = console->Pause();
     102                    break;
     103                case HostPowerEvent_Resume:
     104                case HostPowerEvent_BatteryLow:
     105                    break;
     106                }
    101107            }
    102108        }
     109fail:
    103110        session->Close();
    104 #endif
     111
    105112    }
    106113    return rc;
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