tstXPCOMCGlue.c revision 180d75c44949a43d3a0780eea8a4d1ae8a96d87f
/* $Revision$ */
/** @file tstXPCOMCGlue.c
* Demonstrator program to illustrate use of C bindings of Main API.
*
* Linux only at the moment due to shared library magic in the Makefile.
*/
/*
* Copyright (C) 2009-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "VBoxXPCOMCGlue.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/**
* Start a VM.
*
* @param virtualBox ptr to IVirtualBox object
* @param session ptr to ISession object
* @param id identifies the machine to start
*/
{
{
return;
}
env,
);
{
}
else
{
printf("Waiting for the remote session to open...\n");
{
}
if (NS_FAILED(resultCode))
{
char *text;
}
else
{
}
}
/* It's important to always release resources. */
}
/**
* List the registered VMs.
*
* @param virtualBox ptr to IVirtualBox object
* @param session ptr to ISession object
*/
{
PRUint32 machineCnt = 0;
PRUint32 i;
unsigned start_id;
/*
* Get the list of all registered VMs.
*/
{
(unsigned)rc);
return;
}
if (machineCnt == 0)
{
printf("\tNo VMs\n");
return;
}
printf("VM List:\n\n");
/*
* Iterate through the collection.
*/
for (i = 0; i < machineCnt; ++i)
{
printf("\tMachine #%u\n", (unsigned)i);
if (!machine)
{
printf("\t(skipped, NULL)\n");
continue;
}
if (isAccessible)
{
char *machineName;
}
else
{
printf("\tName: <inaccessible>\n");
}
{
}
if (isAccessible)
{
{
}
{
}
{
char *osName;
}
}
}
/*
* Let the user chose a machine to start.
*/
printf("Type Machine# to start (0 - %u) or 'quit' to do nothing: ",
(unsigned)(machineCnt - 1));
{
if (machine)
{
}
}
/*
* Don't forget to release the objects in the array.
*/
for (i = 0; i < machineCnt; ++i)
{
if (machine)
{
}
}
}
/* Main - Start the ball rolling. */
{
printf("Starting Main\n");
/*
* VBoxComInitialize does all the necessary startup action and
* provides us with pointers to vbox and session handles.
* It should be matched by a call to VBoxComUninitialize(vbox)
* when done.
*/
if (VBoxCGlueInit() != 0)
{
argv[0], g_szVBoxErrMsg);
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
/*
* Now ask for revision, version and home folder information of
* this vbox. Were not using fancy macros here so it
* remains easy to see how we access C++'s vtable.
*/
printf("----------------------------------------------------\n");
/* 1. Revision */
if (NS_SUCCEEDED(rc))
{
}
else
{
}
/* 2. Version */
if (NS_SUCCEEDED(rc))
{
}
else
{
}
/* 3. Home Folder */
if (NS_SUCCEEDED(rc))
{
char *homefolder = NULL;
}
else
{
}
printf("----------------------------------------------------\n");
/*
* Do as mom told us: always clean up after yourself.
*/
printf("Finished Main\n");
return 0;
}
/* vim: set ts=4 sw=4 et: */