VirtualBox

Changeset 20928 in vbox for trunk/src/VBox/Main/testcase


Ignore:
Timestamp:
Jun 25, 2009 11:53:37 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
49096
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/testcase/tstAPI.cpp

    r19239 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
     
    2828#include <VBox/com/Guid.h>
    2929#include <VBox/com/ErrorInfo.h>
    30 #include <VBox/com/errorprint_legacy.h>
     30#include <VBox/com/errorprint.h>
    3131#include <VBox/com/EventQueue.h>
    3232
     
    4545#include <iprt/stream.h>
    4646#include <iprt/thread.h>
    47 
    48 #define printf RTPrintf
    4947
    5048
     
    6866
    6967    Bstr name;
    70     printf ("Getting machine name...\n");
    71     CHECK_RC_RET (machine->COMGETTER(Name) (name.asOutParam()));
    72     printf ("Name: {%ls}\n", name.raw());
    73 
    74     printf("Getting machine GUID...\n");
    75     Bstr guid;   
    76     CHECK_RC (machine->COMGETTER(Id) (guid.asOutParam()));
     68    RTPrintf ("Getting machine name...\n");
     69    CHECK_ERROR_RET (machine, COMGETTER(Name) (name.asOutParam()), rc);
     70    RTPrintf ("Name: {%ls}\n", name.raw());
     71
     72    RTPrintf("Getting machine GUID...\n");
     73    Bstr guid;
     74    CHECK_ERROR (machine, COMGETTER(Id) (guid.asOutParam()));
    7775    if (SUCCEEDED (rc) && !guid.isEmpty()) {
    78         printf ("Guid::toString(): {%s}\n", Utf8Str(guid).c_str());
     76        RTPrintf ("Guid::toString(): {%s}\n", Utf8Str(guid).c_str());
    7977    } else {
    80         printf ("WARNING: there's no GUID!");
     78        RTPrintf ("WARNING: there's no GUID!");
    8179    }
    8280
    8381    ULONG memorySize;
    84     printf ("Getting memory size...\n");
    85     CHECK_RC_RET (machine->COMGETTER(MemorySize) (&memorySize));
    86     printf ("Memory size: %d\n", memorySize);
     82    RTPrintf ("Getting memory size...\n");
     83    CHECK_ERROR_RET (machine, COMGETTER(MemorySize) (&memorySize), rc);
     84    RTPrintf ("Memory size: %d\n", memorySize);
    8785
    8886    MachineState_T machineState;
    89     printf ("Getting machine state...\n");
    90     CHECK_RC_RET (machine->COMGETTER(State) (&machineState));
    91     printf ("Machine state: %d\n", machineState);
     87    RTPrintf ("Getting machine state...\n");
     88    CHECK_ERROR_RET (machine, COMGETTER(State) (&machineState), rc);
     89    RTPrintf ("Machine state: %d\n", machineState);
    9290
    9391    BOOL modified;
    94     printf ("Are any settings modified?...\n");
    95     CHECK_RC (machine->COMGETTER(SettingsModified) (&modified));
     92    RTPrintf ("Are any settings modified?...\n");
     93    CHECK_ERROR (machine, COMGETTER(SettingsModified) (&modified));
    9694    if (SUCCEEDED (rc))
    97         printf ("%s\n", modified ? "yes" : "no");
     95        RTPrintf ("%s\n", modified ? "yes" : "no");
    9896
    9997    ULONG memorySizeBig = memorySize * 10;
    100     printf("Changing memory size to %d...\n", memorySizeBig);
    101     CHECK_RC (machine->COMSETTER(MemorySize) (memorySizeBig));
     98    RTPrintf("Changing memory size to %d...\n", memorySizeBig);
     99    CHECK_ERROR (machine, COMSETTER(MemorySize) (memorySizeBig));
    102100
    103101    if (SUCCEEDED (rc))
    104102    {
    105         printf ("Are any settings modified now?...\n");
    106         CHECK_RC_RET (machine->COMGETTER(SettingsModified) (&modified));
    107         printf ("%s\n", modified ? "yes" : "no");
     103        RTPrintf ("Are any settings modified now?...\n");
     104        CHECK_ERROR_RET (machine, COMGETTER(SettingsModified) (&modified), rc);
     105        RTPrintf ("%s\n", modified ? "yes" : "no");
    108106        ASSERT_RET (modified, 0);
    109107
    110108        ULONG memorySizeGot;
    111         printf ("Getting memory size again...\n");
    112         CHECK_RC_RET (machine->COMGETTER(MemorySize) (&memorySizeGot));
    113         printf ("Memory size: %d\n", memorySizeGot);
     109        RTPrintf ("Getting memory size again...\n");
     110        CHECK_ERROR_RET (machine, COMGETTER(MemorySize) (&memorySizeGot), rc);
     111        RTPrintf ("Memory size: %d\n", memorySizeGot);
    114112        ASSERT_RET (memorySizeGot == memorySizeBig, 0);
    115113
    116114        if (readonlyMachine)
    117115        {
    118             printf ("Getting memory size of the counterpart readonly machine...\n");
     116            RTPrintf ("Getting memory size of the counterpart readonly machine...\n");
    119117            ULONG memorySizeRO;
    120118            readonlyMachine->COMGETTER(MemorySize) (&memorySizeRO);
    121             printf ("Memory size: %d\n", memorySizeRO);
     119            RTPrintf ("Memory size: %d\n", memorySizeRO);
    122120            ASSERT_RET (memorySizeRO != memorySizeGot, 0);
    123121        }
    124122
    125         printf ("Discarding recent changes...\n");
    126         CHECK_RC_RET (machine->DiscardSettings());
    127         printf ("Are any settings modified after discarding?...\n");
    128         CHECK_RC_RET (machine->COMGETTER(SettingsModified) (&modified));
    129         printf ("%s\n", modified ? "yes" : "no");
     123        RTPrintf ("Discarding recent changes...\n");
     124        CHECK_ERROR_RET (machine, DiscardSettings(), rc);
     125        RTPrintf ("Are any settings modified after discarding?...\n");
     126        CHECK_ERROR_RET (machine, COMGETTER(SettingsModified) (&modified), rc);
     127        RTPrintf ("%s\n", modified ? "yes" : "no");
    130128        ASSERT_RET (!modified, 0);
    131129
    132         printf ("Getting memory size once more...\n");
    133         CHECK_RC_RET (machine->COMGETTER(MemorySize) (&memorySizeGot));
    134         printf ("Memory size: %d\n", memorySizeGot);
     130        RTPrintf ("Getting memory size once more...\n");
     131        CHECK_ERROR_RET (machine, COMGETTER(MemorySize) (&memorySizeGot), rc);
     132        RTPrintf ("Memory size: %d\n", memorySizeGot);
    135133        ASSERT_RET (memorySizeGot == memorySize, 0);
    136134
    137135        memorySize = memorySize > 128 ? memorySize / 2 : memorySize * 2;
    138         printf("Changing memory size to %d...\n", memorySize);
    139         CHECK_RC_RET (machine->COMSETTER(MemorySize) (memorySize));
     136        RTPrintf("Changing memory size to %d...\n", memorySize);
     137        CHECK_ERROR_RET (machine, COMSETTER(MemorySize) (memorySize), rc);
    140138    }
    141139
    142140    Bstr desc;
    143     printf ("Getting description...\n");
     141    RTPrintf ("Getting description...\n");
    144142    CHECK_ERROR_RET (machine, COMGETTER(Description) (desc.asOutParam()), rc);
    145     printf ("Description is: \"%ls\"\n", desc.raw());
     143    RTPrintf ("Description is: \"%ls\"\n", desc.raw());
    146144
    147145    desc = L"This is an exemplary description (changed).";
    148     printf ("Setting description to \"%ls\"...\n", desc.raw());
     146    RTPrintf ("Setting description to \"%ls\"...\n", desc.raw());
    149147    CHECK_ERROR_RET (machine, COMSETTER(Description) (desc), rc);
    150148
    151     printf ("Saving machine settings...\n");
    152     CHECK_RC (machine->SaveSettings());
     149    RTPrintf ("Saving machine settings...\n");
     150    CHECK_ERROR (machine, SaveSettings());
    153151    if (SUCCEEDED (rc))
    154152    {
    155         printf ("Are any settings modified after saving?...\n");
    156         CHECK_RC_RET (machine->COMGETTER(SettingsModified) (&modified));
    157         printf ("%s\n", modified ? "yes" : "no");
     153        RTPrintf ("Are any settings modified after saving?...\n");
     154        CHECK_ERROR_RET (machine, COMGETTER(SettingsModified) (&modified), rc);
     155        RTPrintf ("%s\n", modified ? "yes" : "no");
    158156        ASSERT_RET (!modified, 0);
    159157
    160158        if (readonlyMachine) {
    161             printf ("Getting memory size of the counterpart readonly machine...\n");
     159            RTPrintf ("Getting memory size of the counterpart readonly machine...\n");
    162160            ULONG memorySizeRO;
    163161            readonlyMachine->COMGETTER(MemorySize) (&memorySizeRO);
    164             printf ("Memory size: %d\n", memorySizeRO);
     162            RTPrintf ("Memory size: %d\n", memorySizeRO);
    165163            ASSERT_RET (memorySizeRO == memorySize, 0);
    166164        }
     
    169167    Bstr extraDataKey = L"Blafasel";
    170168    Bstr extraData;
    171     printf ("Getting extra data key {%ls}...\n", extraDataKey.raw());
    172     CHECK_RC_RET (machine->GetExtraData (extraDataKey, extraData.asOutParam()));
     169    RTPrintf ("Getting extra data key {%ls}...\n", extraDataKey.raw());
     170    CHECK_ERROR_RET (machine, GetExtraData (extraDataKey, extraData.asOutParam()), rc);
    173171    if (!extraData.isEmpty()) {
    174         printf ("Extra data value: {%ls}\n", extraData.raw());
     172        RTPrintf ("Extra data value: {%ls}\n", extraData.raw());
    175173    } else {
    176174        if (extraData.isNull())
    177             printf ("No extra data exists\n");
     175            RTPrintf ("No extra data exists\n");
    178176        else
    179             printf ("Extra data is empty\n");
     177            RTPrintf ("Extra data is empty\n");
    180178    }
    181179
     
    184182    else
    185183        extraData.setNull();
    186     printf (
     184    RTPrintf (
    187185        "Setting extra data key {%ls} to {%ls}...\n",
    188186        extraDataKey.raw(), extraData.raw()
    189187    );
    190     CHECK_RC (machine->SetExtraData (extraDataKey, extraData));
     188    CHECK_ERROR (machine, SetExtraData (extraDataKey, extraData));
    191189
    192190    if (SUCCEEDED (rc)) {
    193         printf ("Getting extra data key {%ls} again...\n", extraDataKey.raw());
    194         CHECK_RC_RET (machine->GetExtraData (extraDataKey, extraData.asOutParam()));
     191        RTPrintf ("Getting extra data key {%ls} again...\n", extraDataKey.raw());
     192        CHECK_ERROR_RET (machine, GetExtraData (extraDataKey, extraData.asOutParam()), rc);
    195193        if (!extraData.isEmpty()) {
    196             printf ("Extra data value: {%ls}\n", extraData.raw());
     194            RTPrintf ("Extra data value: {%ls}\n", extraData.raw());
    197195        } else {
    198196            if (extraData.isNull())
    199                 printf ("No extra data exists\n");
     197                RTPrintf ("No extra data exists\n");
    200198            else
    201                 printf ("Extra data is empty\n");
     199                RTPrintf ("Extra data is empty\n");
    202200        }
    203201    }
     
    222220        char homeDir [RTPATH_MAX];
    223221        GetVBoxUserHomeDirectory (homeDir, sizeof (homeDir));
    224         printf ("VirtualBox Home Directory = '%s'\n", homeDir);
    225     }
    226 
    227     printf ("Initializing COM...\n");
    228 
    229     CHECK_RC_RET (com::Initialize());
     222        RTPrintf ("VirtualBox Home Directory = '%s'\n", homeDir);
     223    }
     224
     225    RTPrintf ("Initializing COM...\n");
     226
     227    rc = com::Initialize();
     228    if (FAILED(rc))
     229    {
     230        RTPrintf("ERROR: failed to initialize COM!\n");
     231        return rc;
     232    }
    230233
    231234    do
     
    242245
    243246    Utf8Str nullUtf8Str;
    244     printf ("nullUtf8Str='%s'\n", nullUtf8Str.raw());
     247    RTPrintf ("nullUtf8Str='%s'\n", nullUtf8Str.raw());
    245248
    246249    Utf8Str simpleUtf8Str = "simpleUtf8Str";
    247     printf ("simpleUtf8Str='%s'\n", simpleUtf8Str.raw());
     250    RTPrintf ("simpleUtf8Str='%s'\n", simpleUtf8Str.raw());
    248251
    249252    Utf8Str utf8StrFmt = Utf8StrFmt ("[0=%d]%s[1=%d]",
    250253                                     0, "utf8StrFmt", 1);
    251     printf ("utf8StrFmt='%s'\n", utf8StrFmt.raw());
    252 
    253 #endif
    254 
    255     printf ("Creating VirtualBox object...\n");
    256     CHECK_RC (virtualBox.createLocalObject (CLSID_VirtualBox));
     254    RTPrintf ("utf8StrFmt='%s'\n", utf8StrFmt.raw());
     255
     256#endif
     257
     258    RTPrintf ("Creating VirtualBox object...\n");
     259    rc = virtualBox.createLocalObject (CLSID_VirtualBox);
     260    if (FAILED(rc))
     261        RTPrintf("ERROR: failed to create the VirtualBox object!\n");
     262    else
     263    {
     264        rc = session.createInprocObject(CLSID_Session);
     265        if (FAILED(rc))
     266            RTPrintf("ERROR: failed to create a session object!\n");
     267    }
     268
    257269    if (FAILED (rc))
    258270    {
    259         CHECK_ERROR_NOCALL();
    260         break;
    261     }
    262 
    263     printf ("Creating Session object...\n");
    264     CHECK_RC (session.createInprocObject (CLSID_Session));
    265     if (FAILED (rc))
    266     {
    267         CHECK_ERROR_NOCALL();
     271        com::ErrorInfo info;
     272        if (!info.isFullAvailable() && !info.isBasicAvailable())
     273        {
     274            com::GluePrintRCMessage(rc);
     275            RTPrintf("Most likely, the VirtualBox COM server is not running or failed to start.\n");
     276        }
     277        else
     278            com::GluePrintErrorInfo(info);
    268279        break;
    269280    }
     
    276287    ////////////////////////////////////////////////////////////////////////////
    277288    {
    278         printf ("Testing VirtualBox::COMGETTER(ProgressOperations)...\n");
     289        RTPrintf ("Testing VirtualBox::COMGETTER(ProgressOperations)...\n");
    279290
    280291        for (;;) {
     
    284295                COMGETTER(ProgressOperations)(ComSafeArrayAsOutParam(operations)));
    285296
    286             printf ("operations: %d\n", operations.size());
     297            RTPrintf ("operations: %d\n", operations.size());
    287298            if (operations.size() == 0)
    288299                break; // No more operations left.
     
    292303
    293304                operations[i]->COMGETTER(Percent)(&percent);
    294                 printf ("operations[%u]: %ld\n", (unsigned)i, (long)percent);
     305                RTPrintf ("operations[%u]: %ld\n", (unsigned)i, (long)percent);
    295306            }
    296307            RTThreadSleep (2000); // msec
     
    306317            ComPtr <IVirtualBox> virtualBox2;
    307318
    308             printf ("Creating one more VirtualBox object...\n");
     319            RTPrintf ("Creating one more VirtualBox object...\n");
    309320            CHECK_RC (virtualBox2.createLocalObject (CLSID_VirtualBox));
    310321            if (FAILED (rc))
     
    314325            }
    315326
    316             printf ("IVirtualBox(virtualBox)=%p IVirtualBox(virtualBox2)=%p\n",
     327            RTPrintf ("IVirtualBox(virtualBox)=%p IVirtualBox(virtualBox2)=%p\n",
    317328                    (IVirtualBox *) virtualBox, (IVirtualBox *) virtualBox2);
    318329            Assert ((IVirtualBox *) virtualBox == (IVirtualBox *) virtualBox2);
     
    322333            unk2 = virtualBox2;
    323334
    324             printf ("IUnknown(virtualBox)=%p IUnknown(virtualBox2)=%p\n",
     335            RTPrintf ("IUnknown(virtualBox)=%p IUnknown(virtualBox2)=%p\n",
    325336                    (IUnknown *) unk, (IUnknown *) unk2);
    326337            Assert ((IUnknown *) unk == (IUnknown *) unk2);
     
    329340            ComPtr <IVirtualBox> vb2 = unk;
    330341
    331             printf ("IVirtualBox(IUnknown(virtualBox))=%p IVirtualBox(IUnknown(virtualBox2))=%p\n",
     342            RTPrintf ("IVirtualBox(IUnknown(virtualBox))=%p IVirtualBox(IUnknown(virtualBox2))=%p\n",
    332343                    (IVirtualBox *) vb, (IVirtualBox *) vb2);
    333344            Assert ((IVirtualBox *) vb == (IVirtualBox *) vb2);
     
    337348            ComPtr <IHost> host;
    338349            CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host)(host.asOutParam()));
    339             printf (" IHost(host)=%p\n", (IHost *) host);
     350            RTPrintf (" IHost(host)=%p\n", (IHost *) host);
    340351            ComPtr <IUnknown> unk = host;
    341             printf (" IUnknown(host)=%p\n", (IUnknown *) unk);
     352            RTPrintf (" IUnknown(host)=%p\n", (IUnknown *) unk);
    342353            ComPtr <IHost> host_copy = unk;
    343             printf (" IHost(host_copy)=%p\n", (IHost *) host_copy);
     354            RTPrintf (" IHost(host_copy)=%p\n", (IHost *) host_copy);
    344355            ComPtr <IUnknown> unk_copy = host_copy;
    345             printf (" IUnknown(host_copy)=%p\n", (IUnknown *) unk_copy);
     356            RTPrintf (" IUnknown(host_copy)=%p\n", (IUnknown *) unk_copy);
    346357            Assert ((IUnknown *) unk == (IUnknown *) unk_copy);
    347358
     
    349360            ComPtr <IUnknown> unk_copy_copy;
    350361            unk_copy.queryInterfaceTo (unk_copy_copy.asOutParam());
    351             printf (" IUnknown(unk_copy)=%p\n", (IUnknown *) unk_copy_copy);
     362            RTPrintf (" IUnknown(unk_copy)=%p\n", (IUnknown *) unk_copy_copy);
    352363            Assert ((IUnknown *) unk_copy == (IUnknown *) unk_copy_copy);
    353364            /* query IUnknown on IUnknown in the opposite direction */
    354365            unk_copy_copy.queryInterfaceTo (unk_copy.asOutParam());
    355             printf (" IUnknown(unk_copy_copy)=%p\n", (IUnknown *) unk_copy);
     366            RTPrintf (" IUnknown(unk_copy_copy)=%p\n", (IUnknown *) unk_copy);
    356367            Assert ((IUnknown *) unk_copy == (IUnknown *) unk_copy_copy);
    357368
     
    363374            unk_copy_copy.setNull();
    364375            unk = host;
    365             printf (" IUnknown(host)=%p\n", (IUnknown *) unk);
     376            RTPrintf (" IUnknown(host)=%p\n", (IUnknown *) unk);
    366377            Assert (oldUnk == (IUnknown *) unk);
    367378        }
    368379
    369 //        printf ("Will be now released (press Enter)...");
     380//        RTPrintf ("Will be now released (press Enter)...");
    370381//        getchar();
    371382    }
     
    383394        Bstr version;
    384395        CHECK_ERROR_BREAK (virtualBox, COMGETTER(Version) (version.asOutParam()));
    385         printf ("VirtualBox version = %ls\n", version.raw());
     396        RTPrintf ("VirtualBox version = %ls\n", version.raw());
    386397    }
    387398#endif
     
    391402    ////////////////////////////////////////////////////////////////////////////
    392403    {
    393         printf ("Calling IVirtualBox::Machines...\n");
     404        RTPrintf ("Calling IVirtualBox::Machines...\n");
    394405
    395406        com::SafeIfaceArray <IMachine> machines;
     
    397408                           COMGETTER(Machines) (ComSafeArrayAsOutParam (machines)));
    398409
    399         printf ("%u machines registered (machines.isNull()=%d).\n",
     410        RTPrintf ("%u machines registered (machines.isNull()=%d).\n",
    400411                machines.size(), machines.isNull());
    401412
     
    404415            Bstr name;
    405416            CHECK_ERROR_BREAK (machines [i], COMGETTER(Name) (name.asOutParam()));
    406             printf ("machines[%u]='%s'\n", i, Utf8Str (name).raw());
    407         }
    408 
    409 #if 0
    410         {
    411             printf ("Testing [out] arrays...\n");
     417            RTPrintf ("machines[%u]='%s'\n", i, Utf8Str (name).raw());
     418        }
     419
     420#if 0
     421        {
     422            RTPrintf ("Testing [out] arrays...\n");
    412423            com::SafeGUIDArray uuids;
    413424            CHECK_ERROR_BREAK (virtualBox,
     
    415426
    416427            for (size_t i = 0; i < uuids.size(); ++ i)
    417                 printf ("uuids[%u]=%Vuuid\n", i, &uuids [i]);
    418         }
    419 
    420         {
    421             printf ("Testing [in] arrays...\n");
     428                RTPrintf ("uuids[%u]=%Vuuid\n", i, &uuids [i]);
     429        }
     430
     431        {
     432            RTPrintf ("Testing [in] arrays...\n");
    422433            com::SafeGUIDArray uuids (5);
    423434            for (size_t i = 0; i < uuids.size(); ++ i)
     
    426437                id.create();
    427438                uuids [i] = id;
    428                 printf ("uuids[%u]=%Vuuid\n", i, &uuids [i]);
     439                RTPrintf ("uuids[%u]=%Vuuid\n", i, &uuids [i]);
    429440            }
    430441
     
    441452    ////////////////////////////////////////////////////////////////////////////
    442453
    443     printf("Getting IHost interface...\n");
     454    RTPrintf("Getting IHost interface...\n");
    444455    IHost *host;
    445456    rc = virtualBox->GetHost(&host);
     
    458469                dvdDrive->GetDriveName(&driveName);
    459470                RTUtf16ToUtf8((PCRTUTF16)driveName, &driveNameUtf8);
    460                 printf("Host DVD drive name: %s\n", driveNameUtf8);
     471                RTPrintf("Host DVD drive name: %s\n", driveNameUtf8);
    461472                RTStrFree(driveNameUtf8);
    462473                SysFreeString(driveName);
     
    468479        } else
    469480        {
    470             printf("Could not get host DVD drive collection\n");
     481            RTPrintf("Could not get host DVD drive collection\n");
    471482        }
    472483
     
    483494                floppyDrive->GetDriveName(&driveName);
    484495                RTUtf16ToUtf8((PCRTUTF16)driveName, &driveNameUtf8);
    485                 printf("Host floppy drive name: %s\n", driveNameUtf8);
     496                RTPrintf("Host floppy drive name: %s\n", driveNameUtf8);
    486497                RTStrFree(driveNameUtf8);
    487498                SysFreeString(driveName);
     
    493504        } else
    494505        {
    495             printf("Could not get host floppy drive collection\n");
     506            RTPrintf("Could not get host floppy drive collection\n");
    496507        }
    497508        host->Release();
    498509    } else
    499510    {
    500         printf("Call failed\n");
    501     }
    502     printf ("\n");
     511        RTPrintf("Call failed\n");
     512    }
     513    RTPrintf ("\n");
    503514#endif
    504515
     
    513524        ComPtr <IHardDisk> hardDisk;
    514525        rc = virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
    515         printf ("virtualBox->GetHardDisk(null-uuid)=%08X\n", rc);
     526        RTPrintf ("virtualBox->GetHardDisk(null-uuid)=%08X\n", rc);
    516527
    517528//        {
     
    523534        Bstr version;
    524535        rc = virtualBox->COMGETTER(Version) (version.asOutParam());
    525         printf ("virtualBox->COMGETTER(Version)=%08X\n", rc);
     536        RTPrintf ("virtualBox->COMGETTER(Version)=%08X\n", rc);
    526537
    527538        {
     
    535546        ComPtr <IMachine> machine;
    536547        rc = session->COMGETTER(Machine)(machine.asOutParam());
    537         printf ("session->COMGETTER(Machine)=%08X\n", rc);
     548        RTPrintf ("session->COMGETTER(Machine)=%08X\n", rc);
    538549
    539550//        {
     
    545556        SessionState_T state;
    546557        rc = session->COMGETTER(State) (&state);
    547         printf ("session->COMGETTER(State)=%08X\n", rc);
     558        RTPrintf ("session->COMGETTER(State)=%08X\n", rc);
    548559
    549560        {
     
    561572        ComPtr <IHardDisk> hd;
    562573        Bstr src = L"E:\\develop\\innotek\\images\\NewHardDisk.vdi";
    563         printf ("Opening the existing hard disk '%ls'...\n", src.raw());
     574        RTPrintf ("Opening the existing hard disk '%ls'...\n", src.raw());
    564575        CHECK_ERROR_BREAK (virtualBox, OpenHardDisk (src, AccessMode_ReadWrite, hd.asOutParam()));
    565         printf ("Enter to continue...\n");
     576        RTPrintf ("Enter to continue...\n");
    566577        getchar();
    567         printf ("Registering the existing hard disk '%ls'...\n", src.raw());
     578        RTPrintf ("Registering the existing hard disk '%ls'...\n", src.raw());
    568579        CHECK_ERROR_BREAK (virtualBox, RegisterHardDisk (hd));
    569         printf ("Enter to continue...\n");
     580        RTPrintf ("Enter to continue...\n");
    570581        getchar();
    571582    }
    572583    while (FALSE);
    573     printf ("\n");
     584    RTPrintf ("\n");
    574585#endif
    575586
     
    581592        ComPtr <IVirtualDiskImage> vdi;
    582593        Bstr src = L"CreatorTest.vdi";
    583         printf ("Unregistering the hard disk '%ls'...\n", src.raw());
     594        RTPrintf ("Unregistering the hard disk '%ls'...\n", src.raw());
    584595        CHECK_ERROR_BREAK (virtualBox, FindVirtualDiskImage (src, vdi.asOutParam()));
    585596        ComPtr <IHardDisk> hd = vdi;
     
    589600    }
    590601    while (FALSE);
    591     printf ("\n");
     602    RTPrintf ("\n");
    592603#endif
    593604
     
    623634    }
    624635    while (FALSE);
    625     printf ("\n");
     636    RTPrintf ("\n");
    626637#endif
    627638
     
    645656        };
    646657
    647         printf ("\n");
     658        RTPrintf ("\n");
    648659
    649660        for (size_t i = 0; i < RT_ELEMENTS (Names); ++ i)
    650661        {
    651662            Bstr src = Names [i];
    652             printf ("Searching for hard disk '%ls'...\n", src.raw());
     663            RTPrintf ("Searching for hard disk '%ls'...\n", src.raw());
    653664            rc = virtualBox->FindHardDisk (src, hd.asOutParam());
    654665            if (SUCCEEDED (rc))
     
    658669                CHECK_ERROR_BREAK (hd, COMGETTER(Id) (id.asOutParam()));
    659670                CHECK_ERROR_BREAK (hd, COMGETTER(Location) (location.asOutParam()));
    660                 printf ("Found, UUID={%Vuuid}, location='%ls'.\n",
     671                RTPrintf ("Found, UUID={%Vuuid}, location='%ls'.\n",
    661672                        id.raw(), location.raw());
    662673
     
    668679                                                      ComSafeArrayAsOutParam (values)));
    669680
    670                 printf ("Properties:\n");
     681                RTPrintf ("Properties:\n");
    671682                for (size_t i = 0; i < names.size(); ++ i)
    672                     printf (" %ls = %ls\n", names [i], values [i]);
     683                    RTPrintf (" %ls = %ls\n", names [i], values [i]);
    673684
    674685                if (names.size() == 0)
    675                     printf (" <none>\n");
     686                    RTPrintf (" <none>\n");
    676687
    677688#if 0
     
    679690                Bstr value = Utf8StrFmt ("lalala (%llu)", RTTimeMilliTS());
    680691
    681                 printf ("Settings property %ls to %ls...\n", name.raw(), value.raw());
     692                RTPrintf ("Settings property %ls to %ls...\n", name.raw(), value.raw());
    682693                CHECK_ERROR (hd, SetProperty (name, value));
    683694#endif
     
    688699                PRINT_ERROR_INFO (info);
    689700            }
    690             printf ("\n");
     701            RTPrintf ("\n");
    691702        }
    692703    }
    693704    while (FALSE);
    694     printf ("\n");
     705    RTPrintf ("\n");
    695706#endif
    696707
     
    702713        ComPtr <IMachine> machine;
    703714        Bstr name = argc > 1 ? argv [1] : "dos";
    704         printf ("Getting a machine object named '%ls'...\n", name.raw());
     715        RTPrintf ("Getting a machine object named '%ls'...\n", name.raw());
    705716        CHECK_ERROR_BREAK (virtualBox, FindMachine (name, machine.asOutParam()));
    706         printf ("Accessing the machine in read-only mode:\n");
     717        RTPrintf ("Accessing the machine in read-only mode:\n");
    707718        readAndChangeMachineSettings (machine);
    708719#if 0
    709720        if (argc != 2)
    710721        {
    711             printf ("Error: a string has to be supplied!\n");
     722            RTPrintf ("Error: a string has to be supplied!\n");
    712723        }
    713724        else
     
    719730    }
    720731    while (0);
    721     printf ("\n");
     732    RTPrintf ("\n");
    722733#endif
    723734
     
    735746        Bstr name = L"machina";
    736747
    737         printf ("Creating a new machine object (base dir '%ls', name '%ls')...\n",
     748        RTPrintf ("Creating a new machine object (base dir '%ls', name '%ls')...\n",
    738749                baseDir.raw(), name.raw());
    739750        CHECK_ERROR_BREAK (virtualBox, CreateMachine (baseDir, name,
    740751                                                      machine.asOutParam()));
    741752
    742         printf ("Getting name...\n");
     753        RTPrintf ("Getting name...\n");
    743754        CHECK_ERROR_BREAK (machine, COMGETTER(Name) (name.asOutParam()));
    744         printf ("Name: {%ls}\n", name.raw());
     755        RTPrintf ("Name: {%ls}\n", name.raw());
    745756
    746757        BOOL modified = FALSE;
    747         printf ("Are any settings modified?...\n");
     758        RTPrintf ("Are any settings modified?...\n");
    748759        CHECK_ERROR_BREAK (machine, COMGETTER(SettingsModified) (&modified));
    749         printf ("%s\n", modified ? "yes" : "no");
     760        RTPrintf ("%s\n", modified ? "yes" : "no");
    750761
    751762        ASSERT_BREAK (modified == TRUE);
    752763
    753764        name = L"Kakaya prekrasnaya virtual'naya mashina!";
    754         printf ("Setting new name ({%ls})...\n", name.raw());
     765        RTPrintf ("Setting new name ({%ls})...\n", name.raw());
    755766        CHECK_ERROR_BREAK (machine, COMSETTER(Name) (name));
    756767
    757         printf ("Setting memory size to 111...\n");
     768        RTPrintf ("Setting memory size to 111...\n");
    758769        CHECK_ERROR_BREAK (machine, COMSETTER(MemorySize) (111));
    759770
    760771        Bstr desc = L"This is an exemplary description.";
    761         printf ("Setting description to \"%ls\"...\n", desc.raw());
     772        RTPrintf ("Setting description to \"%ls\"...\n", desc.raw());
    762773        CHECK_ERROR_BREAK (machine, COMSETTER(Description) (desc));
    763774
     
    766777        CHECK_ERROR_BREAK (virtualBox, GetGuestOSType (type, guestOSType.asOutParam()));
    767778
    768         printf ("Saving new machine settings...\n");
     779        RTPrintf ("Saving new machine settings...\n");
    769780        CHECK_ERROR_BREAK (machine, SaveSettings());
    770781
    771         printf ("Accessing the newly created machine:\n");
     782        RTPrintf ("Accessing the newly created machine:\n");
    772783        readAndChangeMachineSettings (machine);
    773784    }
    774785    while (FALSE);
    775     printf ("\n");
     786    RTPrintf ("\n");
    776787#endif
    777788
     
    796807                Bstr name;
    797808                CHECK_RC_BREAK (drive->COMGETTER(Name) (name.asOutParam()));
    798                 printf ("Host DVD drive: name={%ls}\n", name.raw());
     809                RTPrintf ("Host DVD drive: name={%ls}\n", name.raw());
    799810            }
    800811            CHECK_RC_BREAK (rc);
     
    808819                Bstr name;
    809820                CHECK_RC_BREAK (drive->COMGETTER(Name) (name.asOutParam()));
    810                 printf ("Found by name: name={%ls}\n", name.raw());
     821                RTPrintf ("Found by name: name={%ls}\n", name.raw());
    811822            }
    812823        }
    813824    }
    814825    while (FALSE);
    815     printf ("\n");
     826    RTPrintf ("\n");
    816827#endif
    817828
     
    905916                               COMGETTER(HardDisks)(ComSafeArrayAsOutParam (disks)));
    906917
    907             printf ("%u base hard disks registered (disks.isNull()=%d).\n",
     918            RTPrintf ("%u base hard disks registered (disks.isNull()=%d).\n",
    908919                    disks.size(), disks.isNull());
    909920
     
    919930                CHECK_ERROR_BREAK (disks [i], COMGETTER(Format) (format.asOutParam()));
    920931
    921                 printf (" disks[%u]: '%ls'\n"
     932                RTPrintf (" disks[%u]: '%ls'\n"
    922933                        "  UUID:         {%Vuuid}\n"
    923934                        "  State:        %s\n"
     
    937948                    CHECK_ERROR_BREAK (disks [i],
    938949                                       COMGETTER(LastAccessError)(error.asOutParam()));
    939                     printf ("  Access Error: %ls\n", error.raw());
     950                    RTPrintf ("  Access Error: %ls\n", error.raw());
    940951                }
    941952
    942953                /* get usage */
    943954
    944                 printf ("  Used by VMs:\n");
     955                RTPrintf ("  Used by VMs:\n");
    945956
    946957                com::SafeGUIDArray ids;
     
    949960                if (ids.size() == 0)
    950961                {
    951                     printf ("   <not used>\n");
     962                    RTPrintf ("   <not used>\n");
    952963                }
    953964                else
     
    955966                    for (size_t j = 0; j < ids.size(); ++ j)
    956967                    {
    957                         printf ("   {%Vuuid}\n", &ids [j]);
     968                        RTPrintf ("   {%Vuuid}\n", &ids [j]);
    958969                    }
    959970                }
     
    965976                               COMGETTER(DVDImages) (ComSafeArrayAsOutParam (images)));
    966977
    967             printf ("%u DVD images registered (images.isNull()=%d).\n",
     978            RTPrintf ("%u DVD images registered (images.isNull()=%d).\n",
    968979                    images.size(), images.isNull());
    969980
     
    977988                CHECK_ERROR_BREAK (images [i], COMGETTER(State) (&state));
    978989
    979                 printf (" images[%u]: '%ls'\n"
     990                RTPrintf (" images[%u]: '%ls'\n"
    980991                        "  UUID:         {%Vuuid}\n"
    981992                        "  State:        %s\n",
     
    9931004                    CHECK_ERROR_BREAK (images [i],
    9941005                                       COMGETTER(LastAccessError)(error.asOutParam()));
    995                     printf ("  Access Error: %ls\n", error.raw());
     1006                    RTPrintf ("  Access Error: %ls\n", error.raw());
    9961007                }
    9971008
    9981009                /* get usage */
    9991010
    1000                 printf ("  Used by VMs:\n");
     1011                RTPrintf ("  Used by VMs:\n");
    10011012
    10021013                com::SafeGUIDArray ids;
     
    10051016                if (ids.size() == 0)
    10061017                {
    1007                     printf ("   <not used>\n");
     1018                    RTPrintf ("   <not used>\n");
    10081019                }
    10091020                else
     
    10111022                    for (size_t j = 0; j < ids.size(); ++ j)
    10121023                    {
    1013                         printf ("   {%Vuuid}\n", &ids [j]);
     1024                        RTPrintf ("   {%Vuuid}\n", &ids [j]);
    10141025                    }
    10151026                }
     
    10181029    }
    10191030    while (FALSE);
    1020     printf ("\n");
     1031    RTPrintf ("\n");
    10211032#endif
    10221033
     
    10281039        ComPtr <IMachine> machine;
    10291040        Bstr name = argc > 1 ? argv [1] : "dos";
    1030         printf ("Getting a machine object named '%ls'...\n", name.raw());
     1041        RTPrintf ("Getting a machine object named '%ls'...\n", name.raw());
    10311042        CHECK_ERROR_BREAK (virtualBox, FindMachine (name, machine.asOutParam()));
    10321043        Guid guid;
    10331044        CHECK_RC_BREAK (machine->COMGETTER(Id) (guid.asOutParam()));
    1034         printf ("Opening a session for this machine...\n");
     1045        RTPrintf ("Opening a session for this machine...\n");
    10351046        CHECK_RC_BREAK (virtualBox->OpenSession (session, guid));
    10361047#if 1
    10371048        ComPtr <IMachine> sessionMachine;
    1038         printf ("Getting sessioned machine object...\n");
     1049        RTPrintf ("Getting sessioned machine object...\n");
    10391050        CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam()));
    1040         printf ("Accessing the machine within the session:\n");
     1051        RTPrintf ("Accessing the machine within the session:\n");
    10411052        readAndChangeMachineSettings (sessionMachine, machine);
    10421053#if 0
    1043         printf ("\n");
    1044         printf ("Enabling the VRDP server (must succeed even if the VM is saved):\n");
     1054        RTPrintf ("\n");
     1055        RTPrintf ("Enabling the VRDP server (must succeed even if the VM is saved):\n");
    10451056        ComPtr <IVRDPServer> vrdp;
    10461057        CHECK_ERROR_BREAK (sessionMachine, COMGETTER(VRDPServer) (vrdp.asOutParam()));
     
    10531064            BOOL enabled = FALSE;
    10541065            CHECK_ERROR_BREAK (vrdp, COMGETTER(Enabled) (&enabled));
    1055             printf ("VRDP server is %s\n", enabled ? "enabled" : "disabled");
     1066            RTPrintf ("VRDP server is %s\n", enabled ? "enabled" : "disabled");
    10561067        }
    10571068#endif
     
    10591070#if 0
    10601071        ComPtr <IConsole> console;
    1061         printf ("Getting the console object...\n");
     1072        RTPrintf ("Getting the console object...\n");
    10621073        CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam()));
    1063         printf ("Discarding the current machine state...\n");
     1074        RTPrintf ("Discarding the current machine state...\n");
    10641075        ComPtr <IProgress> progress;
    10651076        CHECK_ERROR_BREAK (console, DiscardCurrentState (progress.asOutParam()));
    1066         printf ("Waiting for completion...\n");
     1077        RTPrintf ("Waiting for completion...\n");
    10671078        CHECK_ERROR_BREAK (progress, WaitForCompletion (-1));
    10681079        ProgressErrorInfo ei (progress);
     
    10741085            CHECK_ERROR_BREAK (progress, COMGETTER(Initiator) (initiator.asOutParam()));
    10751086
    1076             printf ("initiator(unk) = %p\n", (IUnknown *) initiator);
    1077             printf ("console(unk) = %p\n", (IUnknown *) ComPtr <IUnknown> ((IConsole *) console));
    1078             printf ("console = %p\n", (IConsole *) console);
    1079         }
    1080 #endif
    1081         printf("Press enter to close session...");
     1087            RTPrintf ("initiator(unk) = %p\n", (IUnknown *) initiator);
     1088            RTPrintf ("console(unk) = %p\n", (IUnknown *) ComPtr <IUnknown> ((IConsole *) console));
     1089            RTPrintf ("console = %p\n", (IConsole *) console);
     1090        }
     1091#endif
     1092        RTPrintf("Press enter to close session...");
    10821093        getchar();
    10831094        session->Close();
    10841095    }
    10851096    while (FALSE);
    1086     printf ("\n");
     1097    RTPrintf ("\n");
    10871098#endif
    10881099
     
    10941105        ComPtr <IMachine> machine;
    10951106        Bstr name = L"dos";
    1096         printf ("Getting a machine object named '%ls'...\n", name.raw());
     1107        RTPrintf ("Getting a machine object named '%ls'...\n", name.raw());
    10971108        CHECK_RC_BREAK (virtualBox->FindMachine (name, machine.asOutParam()));
    10981109        Guid guid;
    10991110        CHECK_RC_BREAK (machine->COMGETTER(Id) (guid.asOutParam()));
    1100         printf ("Opening a remote session for this machine...\n");
     1111        RTPrintf ("Opening a remote session for this machine...\n");
    11011112        ComPtr <IProgress> progress;
    11021113        CHECK_RC_BREAK (virtualBox->OpenRemoteSession (session, guid, Bstr("gui"),
    11031114                                                       NULL, progress.asOutParam()));
    1104         printf ("Waiting for the session to open...\n");
     1115        RTPrintf ("Waiting for the session to open...\n");
    11051116        CHECK_RC_BREAK (progress->WaitForCompletion (-1));
    11061117        ComPtr <IMachine> sessionMachine;
    1107         printf ("Getting sessioned machine object...\n");
     1118        RTPrintf ("Getting sessioned machine object...\n");
    11081119        CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam()));
    11091120        ComPtr <IConsole> console;
    1110         printf ("Getting console object...\n");
     1121        RTPrintf ("Getting console object...\n");
    11111122        CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam()));
    1112         printf ("Press enter to pause the VM execution in the remote session...");
     1123        RTPrintf ("Press enter to pause the VM execution in the remote session...");
    11131124        getchar();
    11141125        CHECK_RC (console->Pause());
    1115         printf ("Press enter to close this session...");
     1126        RTPrintf ("Press enter to close this session...");
    11161127        getchar();
    11171128        session->Close();
    11181129    }
    11191130    while (FALSE);
    1120     printf ("\n");
     1131    RTPrintf ("\n");
    11211132#endif
    11221133
     
    11281139        ComPtr <IMachine> machine;
    11291140        Bstr name = "dos";
    1130         printf ("Getting a machine object named '%ls'...\n", name.raw());
     1141        RTPrintf ("Getting a machine object named '%ls'...\n", name.raw());
    11311142        CHECK_RC_BREAK (virtualBox->FindMachine (name, machine.asOutParam()));
    11321143        Guid guid;
    11331144        CHECK_RC_BREAK (machine->COMGETTER(Id) (guid.asOutParam()));
    1134         printf ("Opening an existing remote session for this machine...\n");
     1145        RTPrintf ("Opening an existing remote session for this machine...\n");
    11351146        CHECK_RC_BREAK (virtualBox->OpenExistingSession (session, guid));
    11361147        ComPtr <IMachine> sessionMachine;
    1137         printf ("Getting sessioned machine object...\n");
     1148        RTPrintf ("Getting sessioned machine object...\n");
    11381149        CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam()));
    11391150
     
    11451156#if 0
    11461157        ComPtr <IConsole> console;
    1147         printf ("Getting console object...\n");
     1158        RTPrintf ("Getting console object...\n");
    11481159        CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam()));
    1149         printf ("Press enter to pause the VM execution in the remote session...");
     1160        RTPrintf ("Press enter to pause the VM execution in the remote session...");
    11501161        getchar();
    11511162        CHECK_RC (console->Pause());
    1152         printf ("Press enter to close this session...");
     1163        RTPrintf ("Press enter to close this session...");
    11531164        getchar();
    11541165#endif
     
    11561167    }
    11571168    while (FALSE);
    1158     printf ("\n");
     1169    RTPrintf ("\n");
    11591170#endif
    11601171
     
    11671178        ULONG uMemSize, uMemAvail;
    11681179        CHECK_ERROR_BREAK (host, COMGETTER(MemorySize) (&uMemSize));
    1169         printf("Total memory (MB): %u\n", uMemSize);
     1180        RTPrintf("Total memory (MB): %u\n", uMemSize);
    11701181        CHECK_ERROR_BREAK (host, COMGETTER(MemoryAvailable) (&uMemAvail));
    1171         printf("Free memory (MB): %u\n", uMemAvail);
     1182        RTPrintf("Free memory (MB): %u\n", uMemAvail);
    11721183    } while (0);
    11731184#endif
     
    11871198            Bstr interfaceName;
    11881199            networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
    1189             printf("Found %d network interfaces, testing with %lS...\n", hostNetworkInterfaces.size(), interfaceName.raw());
     1200            RTPrintf("Found %d network interfaces, testing with %lS...\n", hostNetworkInterfaces.size(), interfaceName.raw());
    11901201            Guid interfaceGuid;
    11911202            networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
     
    11971208            networkInterface->COMGETTER(Id)(interfaceGuid2.asOutParam());
    11981209            if (interfaceGuid2 != interfaceGuid)
    1199                 printf("Failed to retrieve an interface by name %lS.\n", interfaceName.raw());
     1210                RTPrintf("Failed to retrieve an interface by name %lS.\n", interfaceName.raw());
    12001211            // Find the interface by its guid
    12011212            networkInterface.setNull();
     
    12051216            networkInterface->COMGETTER(Name)(interfaceName2.asOutParam());
    12061217            if (interfaceName != interfaceName2)
    1207                 printf("Failed to retrieve an interface by GUID %lS.\n", Bstr(interfaceGuid.toString()).raw());
     1218                RTPrintf("Failed to retrieve an interface by GUID %lS.\n", Bstr(interfaceGuid.toString()).raw());
    12081219        }
    12091220        else
    12101221        {
    1211             printf("No network interfaces found!\n");
     1222            RTPrintf("No network interfaces found!\n");
    12121223        }
    12131224    } while (0);
     
    12351246        Bstr name = argc > 1 ? argv [1] : "dsl";
    12361247        Bstr sessionType = argc > 2 ? argv [2] : "vrdp";
    1237         printf ("Getting a machine object named '%ls'...\n", name.raw());
     1248        RTPrintf ("Getting a machine object named '%ls'...\n", name.raw());
    12381249        CHECK_RC_BREAK (virtualBox->FindMachine (name, machine.asOutParam()));
    12391250
     
    12411252        Guid guid;
    12421253        CHECK_RC_BREAK (machine->COMGETTER(Id) (guid.asOutParam()));
    1243         printf ("Opening a remote session for this machine...\n");
     1254        RTPrintf ("Opening a remote session for this machine...\n");
    12441255        ComPtr <IProgress> progress;
    12451256        CHECK_RC_BREAK (virtualBox->OpenRemoteSession (session, guid, sessionType,
    12461257                                                       NULL, progress.asOutParam()));
    1247         printf ("Waiting for the session to open...\n");
     1258        RTPrintf ("Waiting for the session to open...\n");
    12481259        CHECK_RC_BREAK (progress->WaitForCompletion (-1));
    12491260        ComPtr <IMachine> sessionMachine;
    1250         printf ("Getting sessioned machine object...\n");
     1261        RTPrintf ("Getting sessioned machine object...\n");
    12511262        CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam()));
    12521263
     
    12661277        // Get console
    12671278        ComPtr <IConsole> console;
    1268         printf ("Getting console object...\n");
     1279        RTPrintf ("Getting console object...\n");
    12691280        CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam()));
    12701281
    12711282        RTThreadSleep(5000); // Sleep for 5 seconds
    12721283
    1273         printf("\nMetrics collected with VM running: --------------------\n");
     1284        RTPrintf("\nMetrics collected with VM running: --------------------\n");
    12741285        queryMetrics(virtualBox, collector, ComSafeArrayAsInParam(objects));
    12751286
    12761287        // Pause
    1277         //printf ("Press enter to pause the VM execution in the remote session...");
     1288        //RTPrintf ("Press enter to pause the VM execution in the remote session...");
    12781289        //getchar();
    12791290        CHECK_RC (console->Pause());
     
    12811292        RTThreadSleep(5000); // Sleep for 5 seconds
    12821293
    1283         printf("\nMetrics collected with VM paused: ---------------------\n");
     1294        RTPrintf("\nMetrics collected with VM paused: ---------------------\n");
    12841295        queryMetrics(virtualBox, collector, ComSafeArrayAsInParam(objects));
    12851296
    1286         printf("\nDrop collected metrics: ----------------------------------------\n");
     1297        RTPrintf("\nDrop collected metrics: ----------------------------------------\n");
    12871298        CHECK_ERROR_BREAK (collector,
    12881299            SetupMetrics(ComSafeArrayAsInParam(baseMetrics),
     
    12971308        machine.queryInterfaceTo(&vmObject[0]);
    12981309
    1299         printf("\nDisable collection of VM metrics: ------------------------------\n");
     1310        RTPrintf("\nDisable collection of VM metrics: ------------------------------\n");
    13001311        CHECK_ERROR_BREAK (collector,
    13011312            DisableMetrics(ComSafeArrayAsInParam(baseMetrics),
     
    13081319        queryMetrics(virtualBox, collector, ComSafeArrayAsInParam(objects));
    13091320
    1310         printf("\nRe-enable collection of all metrics: ---------------------------\n");
     1321        RTPrintf("\nRe-enable collection of all metrics: ---------------------------\n");
    13111322        CHECK_ERROR_BREAK (collector,
    13121323            EnableMetrics(ComSafeArrayAsInParam(baseMetrics),
     
    13201331
    13211332        // Power off
    1322         printf ("Press enter to power off VM...");
     1333        RTPrintf ("Press enter to power off VM...");
    13231334        getchar();
    13241335        CHECK_RC (console->PowerDown());
    1325         printf ("Press enter to close this session...");
     1336        RTPrintf ("Press enter to close this session...");
    13261337        getchar();
    13271338        session->Close();
     
    13561367            RTPrintf ("Disks:");
    13571368            for (unsigned i = 0; i < retDisks.size(); i++)
    1358                 printf (" %ls", Bstr (retDisks [i]).raw());
     1369                RTPrintf (" %ls", Bstr (retDisks [i]).raw());
    13591370            RTPrintf ("\n");
    13601371        }
     
    13821393                for (unsigned a = 0; a < retTypes.size(); ++a)
    13831394                {
    1384                     printf (" %d %ls %ls %ls\n",
     1395                    RTPrintf (" %d %ls %ls %ls\n",
    13851396                            retTypes [a],
    13861397                            Bstr (retOrigValues [a]).raw(),
     
    14241435    }
    14251436    while (FALSE);
    1426     printf ("\n");
    1427 #endif
    1428 
    1429     printf ("Press enter to release Session and VirtualBox instances...");
     1437    RTPrintf ("\n");
     1438#endif
     1439
     1440    RTPrintf ("Press enter to release Session and VirtualBox instances...");
    14301441    getchar();
    14311442
     
    14351446    while (0);
    14361447
    1437     printf("Press enter to shutdown COM...");
     1448    RTPrintf("Press enter to shutdown COM...");
    14381449    getchar();
    14391450
    14401451    com::Shutdown();
    14411452
    1442     printf ("tstAPI FINISHED.\n");
     1453    RTPrintf ("tstAPI FINISHED.\n");
    14431454
    14441455    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