VBoxBFE.cpp revision 3918ed075bc7939d7397b643c46b460a4f3b67fc
7198N/A * available from http://www.virtualbox.org. This file is free software;
7198N/A * Clara, CA 95054 USA or visit http://www.sun.com if you need
7198N/A#ifndef VBOXBFE_WITHOUT_COM
7198N/A#ifdef VBOXBFE_WITH_USB
7198N/A#ifdef VBOX_WITH_HGCM
7198N/A#include "ConsoleImpl.h"
7198N/A#include "DisplayImpl.h"
7198N/A#include "MouseImpl.h"
7198N/A#include "KeyboardImpl.h"
7198N/A#include "VMMDevInterface.h"
7198N/A#include "StatusImpl.h"
7198N/A#include "Framebuffer.h"
7198N/A#include "MachineDebuggerImpl.h"
7198N/A#ifdef VBOXBFE_WITH_USB
7198N/A# include "HostUSBImpl.h"
7198N/A#include "SDLConsole.h"
7198N/A#include "SDLFramebuffer.h"
7198N/A#include "L4Console.h"
7198N/A#include "L4Framebuffer.h"
7198N/A#include "L4IDLInterface.h"
7198N/A#define VBOXSDL_ADVANCED_OPTIONS
7198N/Astatic DECLCALLBACK(void) vmstateChangeCallback(PVM pVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
7198N/A#ifdef VBOXBFE_WITH_USB
7198N/Abool gfAllowFullscreenToggle = true;
7198N/A#ifdef VBOXBFE_WITH_USB
7198N/Astatic bool g_fRestoreState = false;
7198N/Astatic unsigned g_uNumShares;
7198N/Astatic bool g_fPreAllocRam = false;
7198N/A const char *g_pszProgressString;
7198N/A unsigned g_uProgressPercent = ~0U;
7198N/Atypedef struct BFENetworkDevice
7198N/A NOT_CONFIGURED = 0,
7198N/A const char *pszName; /**< The device name of a HIF device. The name of the internal network. */
7198N/Abool fActivateHGCM()
7198N/A return !!(g_uNumShares > 0);
7198N/A return VINF_SUCCESS;
7198N/Avoid endProgressInfo(void)
7198N/A g_uProgressPercent = ~0U;
7198N/Astatic void show_usage()
7198N/A#ifdef RT_OS_LINUX
#ifdef VBOX_WITH_VRDP
#ifdef VBOX_SECURELABEL
#ifdef VBOXSDL_ADVANCED_OPTIONS
#ifdef RT_OS_L4
bool fFullscreen = false;
#ifdef VBOX_WITH_VRDP
#ifdef VBOX_SECURELABEL
bool fSecureLabel = false;
#ifdef RT_OS_L4
show_usage();
g_fRestoreState = true;
curArg++;
g_uNumShares++;
fFullscreen = true;
gfAllowFullscreenToggle = false;
gHostKey = 0;
gHostKeySym = 0;
g_fACPI = true;
g_fACPI = false;
g_fIOAPIC = true;
g_fIOAPIC = false;
g_fAudio = true;
#ifdef VBOXBFE_WITH_USB
g_fUSB = true;
if (!g_pszHdaFile)
return SyntaxError("The path to the specified harddisk, '%s', could not be resolved.\n", argv[curArg]);
g_fHdaSpf = true;
if (!g_pszHdbFile)
return SyntaxError("The path to the specified harddisk, '%s', could not be resolved.\n", argv[curArg]);
g_fHdbSpf = true;
if (!g_pszFdaFile)
return SyntaxError("The path to the specified floppy disk, '%s', could not be resolved.\n", argv[curArg]);
if (!g_pszCdromFile)
return SyntaxError("The path to the specified cdrom, '%s', could not be resolved.\n", argv[curArg]);
#ifdef RT_OS_L4
, pszArg);
const char *pszMac;
i, rc);
#ifdef RT_OS_OS2
return SyntaxError("bad interface name '%s' specified with '%s'. Expected 'lan0', 'lan1' and similar.\n",
#ifdef RT_OS_LINUX
#ifdef VBOX_WITH_VRDP
#ifdef VBOX_SECURELABEL
fSecureLabel = true;
g_fReleaseLog = true;
g_fReleaseLog = false;
g_fPreAllocRam = true;
#ifdef VBOXSDL_ADVANCED_OPTIONS
g_fRawR0 = true;
g_fRawR0 = false;
g_fRawR3 = true;
g_fRawR3 = false;
g_fPATM = true;
g_fPATM = false;
g_fCSAM = true;
g_fCSAM = false;
#ifdef RT_OS_L4
++curArg;
show_usage();
#if defined(USE_SDL)
goto leave;
#ifdef RT_OS_L4
L4CtrlInit();
switch (event)
case CONEVENT_USR_QUIT:
goto leave;
goto leave;
RTPrintf("Error: failed to power up VM! No error text available (rc = 0x%x state = %d)\n", rc, machineState);
goto leave;
#ifdef RT_OS_L4
switch (event)
case CONEVENT_NONE:
case CONEVENT_QUIT:
case CONEVENT_USR_QUIT:
goto leave;
case CONEVENT_SCREENUPDATE:
#ifdef VBOX_SECURELABEL
if (pVM)
delete gFramebuffer;
delete gConsole;
delete gDisplay;
delete gKeyboard;
delete gMouse;
delete gStatus;
delete gMachineDebugger;
#ifndef VBOX_WITH_HARDENING
# ifdef RT_OS_L4
# ifndef L4API_l4v2onv4
for (int i = 0; i < argc; i++)
if (++i >= argc)
static DECLCALLBACK(void) vmstateChangeCallback(PVM pVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser)
switch (enmState)
case VMSTATE_OFF:
case VMSTATE_TERMINATED:
const char *pszErrorId,
int rc2;
if (g_fReleaseLog)
szNowUct);
goto failure;
goto failure;
#ifdef VBOX_WITH_HGCM
for (unsigned i=0; i<g_uNumShares; i++)
int cbString;
int rc;
#ifdef VBOXBFE_WITH_USB
if (g_fUSB)
#ifdef RT_OS_L4
if ( g_fRestoreState
&& *g_pszStateFile
goto failure;
if (pVM)
int rc;
AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
return rc;
return rc;
return rc;
return rc;
return rc;
return VINF_SUCCESS;
int rc;
if (g_fPreAllocRam)
#ifdef VBOXSDL_ADVANCED_OPTIONS
if (g_fACPI)
if (g_pszFdaFile)
#ifdef DEBUG
if (g_fIOAPIC)
#ifdef RT_OS_L4
if (g_pszHdaFile)
const char *szDriver;
if (g_fHdaSpf)
if (g_pszHdbFile)
const char *szDriver;
if (g_fHdbSpf)
if (g_pszCdromFile)
UPDATE_RC();
UPDATE_RC();
#if defined(RT_OS_LINUX)
return rc;
return VERR_BUFFER_OVERFLOW;
if (rc)
return rc2;
if (rc)
return rc2;
# ifdef VBOX_WITH_CROSSBOW
rc = CFGMR3InsertBytes(pCfg, "MAC", &g_aNetDevs[ulInstance].Mac, sizeof(g_aNetDevs[ulInstance].Mac));
UPDATE_RC();
UPDATE_RC();
return VERR_NOT_IMPLEMENTED;
if (g_fAudio)
#ifdef RT_OS_WINDOWS
#ifdef VBOXBFE_WITH_USB
if (g_fUSB)
return rc;