tstAPI.cpp revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
2362N/A * Copyright (C) 2006 InnoTek Systemberatung GmbH 2362N/A * This file is part of VirtualBox Open Source Edition (OSE), as 0N/A * you can redistribute it and/or modify it under the terms of the GNU 0N/A * General Public License as published by the Free Software Foundation, 0N/A * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE 0N/A * distribution. VirtualBox OSE is distributed in the hope that it will 0N/A * be useful, but WITHOUT ANY WARRANTY of any kind. 0N/A * If you received this file as part of a commercial VirtualBox 0N/A * distribution, then only the terms of your commercial VirtualBox 0N/A * license agreement apply instead of the previous paragraph. 0N/A/////////////////////////////////////////////////////////////////////////////// 0N/A printf (
"Are any settings modified now?...\n");
0N/A printf (
"Getting memory size of the counterpart readonly machine...\n");
0N/A printf (
"Are any settings modified after discarding?...\n");
0N/A printf (
"Getting memory size once more...\n");
0N/A printf (
"Are any settings modified after saving?...\n");
0N/A printf (
"Getting memory size of the counterpart readonly machine...\n");
0N/A "Setting extra data key {%ls} to {%ls}...\n",
0N/A/////////////////////////////////////////////////////////////////////////////// 0N/A * Initialize the VBox runtime without loading 0N/A * the support driver. 0N/A // scopes all the stuff till shutdown 0N/A //////////////////////////////////////////////////////////////////////////// 0N/A "VirtualBoxServer"));
0N/A // IUnknown identity test 0N/A //////////////////////////////////////////////////////////////////////////// 0N/A printf (
"Creating one more VirtualBox object...\n");
0N/A "VirtualBoxServer"));
0N/A printf (
"IVirtualBox(virualBox)=%p IVirtualBox(virualBox2)=%p\n",
0N/A printf (
"IUnknown(virualBox)=%p IUnknown(virualBox2)=%p\n",
0N/A printf (
"IVirtualBox(IUnknown(virualBox))=%p IVirtualBox(IUnknown(virualBox2))=%p\n",
0N/A printf (
"Will be now released (press Enter)...");
0N/A // create the event queue 0N/A // (here it is necessary only to process remaining XPCOM/IPC events 0N/A // after the session is closed) 0N/A // some outdated stuff 0N/A //////////////////////////////////////////////////////////////////////////// 0N/A printf(
"Could not get host DVD drive collection\n");
0N/A printf(
"Could not get host floppy drive collection\n");
0N/A // IVirtualBoxErrorInfo test 0N/A //////////////////////////////////////////////////////////////////////////// 0N/A // call a method that will definitely fail 0N/A printf (
"virtualBox->GetHardDisk(null-uuid)=%08X\n",
rc);
0N/A// com::ErrorInfo info (virtualBox); 0N/A// PRINT_ERROR_INFO (info); 0N/A // call a method that will definitely succeed 0N/A // call a method that will definitely fail 0N/A// com::ErrorInfo info (virtualBox); 0N/A// PRINT_ERROR_INFO (info); 0N/A // call a method that will definitely succeed // register the existing hard disk image /////////////////////////////////////////////////////////////////////////// Bstr src = L
"E:\\develop\\innotek\\images\\NewHardDisk.vdi";
printf (
"Registerin the existing hard disk '%ls'...\n",
src.
raw());
// find and unregister the existing hard disk image /////////////////////////////////////////////////////////////////////////// printf (
"Unregistering the hard disk '%ls'...\n",
src.
raw());
// clone the registered hard disk /////////////////////////////////////////////////////////////////////////// RTPrintf (
"Waiting for completion...\n");
// access the machine in read-only mode /////////////////////////////////////////////////////////////////////////// printf (
"Getting a machine object named '%ls'...\n",
name.
raw());
// printf ("Accessing the machine in read-only mode:\n"); // readAndChangeMachineSettings (machine); // printf("Error: a string has to be supplied!\n"); // Bstr secureLabel = argv[1]; // create a new machine (w/o registering it) /////////////////////////////////////////////////////////////////////////// printf (
"Creating a new machine object (base dir '%ls', name '%ls')...\n",
printf (
"Are any settings modified?...\n");
name = L
"Kakaya prekrasnaya virtual'naya mashina!";
printf (
"Setting memory size to 111...\n");
printf (
"Saving new machine settings...\n");
printf (
"Accessing the newly created machine:\n");
// enumerate host DVD drives /////////////////////////////////////////////////////////////////////////// // enumerate hard disks & dvd images /////////////////////////////////////////////////////////////////////////// printf (
"Hard Disk: id={%s}, path={%ls}\n",
// open a (direct) session /////////////////////////////////////////////////////////////////////////// printf (
"Getting a machine object named '%ls'...\n",
name.
raw());
printf (
"Opening a session for this machine...\n");
printf (
"Getting sessioned machine object...\n");
printf (
"Accessing the machine within the session:\n");
printf (
"Getting the console object...\n");
printf (
"Discarding the current machine state...\n");
printf (
"Waiting for completion...\n");
/////////////////////////////////////////////////////////////////////////// printf (
"Getting a machine object named '%ls'...\n",
name.
raw());
printf (
"Opening a remote session for this machine...\n");
printf (
"Waiting for the session to open...\n");
printf (
"Getting sessioned machine object...\n");
printf (
"Getting console object...\n");
printf (
"Press enter to pause the VM execution in the remote session...");
printf (
"Press enter to close this session...");
// open an existing remote session /////////////////////////////////////////////////////////////////////////// printf (
"Getting a machine object named '%ls'...\n",
name.
raw());
printf (
"Opening an existing remote session for this machine...\n");
printf (
"Getting sessioned machine object...\n");
Bstr extraData =
"Das kommt jetzt noch viel krasser vom total konkreten API!";
printf (
"Getting console object...\n");
printf (
"Press enter to pause the VM execution in the remote session...");
printf (
"Press enter to close this session...");
printf (
"Press enter to release Session and VirtualBox instances...");
//////////////////////////////////////////////////////////////////////////// printf(
"Press enter to shutdown COM...");
printf (
"tstAPI FINISHED.\n");