VirtualBox

Ignore:
Timestamp:
Jun 25, 2009 11:53:37 AM (15 years ago)
Author:
vboxsync
Message:

API/others: Renamed IConsole::discardSavedState to IConsole::forgetSavedState, added parameter. Deleted old IConsole::powerDown, renamed IConsole::powerDownAsync to IConsole::powerDown (as promised for 2.1). Implemented perl sample code for registering a hard disk. Cleaned up constant formatting in the API docs. Updated SDK changelog. Renamed com/errorprint2.h to com/errorprint.h, added a few assertion variants. Eliminated com/errorprint_legacy.h. Adjusted all files using the affected headers and APIs. Renamed tstHeadless2 to tstHeadless.

Location:
trunk/src/VBox/Frontends/VBoxHeadless
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r20225 r20928  
    66
    77/*
    8  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2525#include <VBox/com/Guid.h>
    2626#include <VBox/com/ErrorInfo.h>
    27 #include <VBox/com/errorprint2.h>
     27#include <VBox/com/errorprint.h>
    2828#include <VBox/com/EventQueue.h>
    2929
  • trunk/src/VBox/Frontends/VBoxHeadless/testcase/Makefile.kmk

    r12258 r20928  
    55
    66#
    7 # Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7# Copyright (C) 2006-2009 Sun Microsystems, Inc.
    88#
    99# This file is part of VirtualBox Open Source Edition (OSE), as
     
    2424
    2525ifdef VBOX_WITH_TESTCASES
    26  PROGRAMS += tstHeadless2
    27  tstHeadless2_TEMPLATE = VBOXMAINCLIENTEXE
    28  tstHeadless2_SOURCES  = tstHeadless.cpp
     26 PROGRAMS += tstHeadless
     27 tstHeadless_TEMPLATE = VBOXMAINCLIENTEXE
     28 tstHeadless_SOURCES  = tstHeadless.cpp
    2929endif
    3030
  • trunk/src/VBox/Frontends/VBoxHeadless/testcase/tstHeadless.cpp

    r20225 r20928  
    66
    77/*
    8  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2525#include <VBox/com/Guid.h>
    2626#include <VBox/com/ErrorInfo.h>
    27 #include <VBox/com/errorprint_legacy.h>
     27#include <VBox/com/errorprint.h>
    2828#include <VBox/com/EventQueue.h>
    2929
     
    7575    HRESULT rc;
    7676
    77     CHECK_RC_RET (com::Initialize());
     77    rc = com::Initialize();
     78    if (FAILED(rc))
     79    {
     80        RTPrintf("ERROR: failed to initialize COM!\n");
     81        return rc;
     82    }
    7883
    7984    do
     
    8388
    8489        RTPrintf ("Creating VirtualBox object...\n");
    85         CHECK_ERROR_NI_BREAK (virtualBox.createLocalObject (CLSID_VirtualBox));
    86 
    87         RTPrintf ("Creating Session object...\n");
    88         CHECK_ERROR_NI_BREAK (session.createInprocObject (CLSID_Session));
     90        rc = virtualBox.createLocalObject (CLSID_VirtualBox);
     91        if (FAILED(rc))
     92            RTPrintf("ERROR: failed to create the VirtualBox object!\n");
     93        else
     94        {
     95            rc = session.createInprocObject(CLSID_Session);
     96            if (FAILED(rc))
     97                RTPrintf("ERROR: failed to create a session object!\n");
     98        }
     99
     100        if (FAILED (rc))
     101        {
     102            com::ErrorInfo info;
     103            if (!info.isFullAvailable() && !info.isBasicAvailable())
     104            {
     105                com::GluePrintRCMessage(rc);
     106                RTPrintf("Most likely, the VirtualBox COM server is not running or failed to start.\n");
     107            }
     108            else
     109                com::GluePrintErrorInfo(info);
     110            break;
     111        }
    89112
    90113        // create the event queue
     
    124147                                   COMGETTER(ErrorInfo) (errorInfo.asOutParam()));
    125148                ErrorInfo info (errorInfo);
    126                 PRINT_ERROR_INFO (info);
     149                com::GluePrintErrorInfo(info);
    127150            }
    128151            else
     
    141164            if (!strcmp (operation, "off"))
    142165            {
     166                ComPtr <IProgress> progress;
    143167                RTPrintf ("Powering the VM off...\n");
    144                 CHECK_ERROR_BREAK (console, PowerDown());
     168                CHECK_ERROR_BREAK (console, PowerDown(progress.asOutParam()));
     169
     170                RTPrintf ("Waiting for the VM to power down...\n");
     171                CHECK_ERROR_BREAK (progress, WaitForCompletion (-1));
     172
     173                BOOL completed;
     174                CHECK_ERROR_BREAK (progress, COMGETTER(Completed) (&completed));
     175                ASSERT (completed);
     176
     177                LONG resultCode;
     178                CHECK_ERROR_BREAK (progress, COMGETTER(ResultCode) (&resultCode));
     179                if (FAILED (resultCode))
     180                {
     181                    ComPtr <IVirtualBoxErrorInfo> errorInfo;
     182                    CHECK_ERROR_BREAK (progress,
     183                                       COMGETTER(ErrorInfo) (errorInfo.asOutParam()));
     184                    ErrorInfo info (errorInfo);
     185                    com::GluePrintErrorInfo(info);
     186                }
     187                else
     188                {
     189                    RTPrintf ("VM is powered down.\n");
     190                }
    145191            }
    146192            else
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