VBoxBFE.cpp revision 2291faee92ebb5cc9722cd3f22e499900a5a411f
0N/A * available from http://www.virtualbox.org. This file is free software;
0N/A#ifndef VBOXBFE_WITHOUT_COM
0N/A#ifdef VBOXBFE_WITH_USB
0N/A#ifdef VBOX_WITH_HGCM
0N/A#include "ConsoleImpl.h"
0N/A#include "DisplayImpl.h"
0N/A#include "MouseImpl.h"
0N/A#include "KeyboardImpl.h"
0N/A#include "StatusImpl.h"
0N/A#include "Framebuffer.h"
0N/A#include "MachineDebuggerImpl.h"
0N/A#ifdef VBOXBFE_WITH_USB
0N/A# include "HostUSBImpl.h"
0N/A#include "SDLConsole.h"
0N/A#include "SDLFramebuffer.h"
0N/A#include "L4Console.h"
0N/A#include "L4Framebuffer.h"
0N/A#include "L4IDLInterface.h"
0N/A#define VBOXSDL_ADVANCED_OPTIONS
0N/Astatic DECLCALLBACK(void) vmstateChangeCallback(PVM pVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
0N/A#ifdef VBOXBFE_WITH_USB
0N/Abool gfAllowFullscreenToggle = true;
0N/A#ifdef VBOXBFE_WITH_USB
0N/A#ifdef VBOXSDL_ADVANCED_OPTIONS
0N/Astatic bool g_fRestoreState = false;
0N/Astatic unsigned g_uNumShares;
0N/Astatic bool g_fPreAllocRam = false;
0N/A const char *g_pszProgressString;
0N/A unsigned g_uProgressPercent = ~0U;
0N/Atypedef struct BFENetworkDevice
0N/A NOT_CONFIGURED = 0,
0N/A const char *pszName; /**< The device name of a HIF device. The name of the internal network. */
0N/Abool fActivateHGCM()
0N/A return !!(g_uNumShares > 0);
0N/A return VINF_SUCCESS;
0N/A g_uProgressPercent = 0;
0N/A return VINF_SUCCESS;
0N/Avoid endProgressInfo(void)
0N/A g_uProgressPercent = ~0U;
0N/Astatic void show_usage()
0N/A#ifdef RT_OS_LINUX
0N/A#ifdef VBOX_WITH_VRDP
0N/A#ifdef VBOX_SECURELABEL
0N/A#ifdef VBOXSDL_ADVANCED_OPTIONS
0N/A bool fFullscreen = false;
0N/A#ifdef VBOX_WITH_VRDP
0N/A#ifdef VBOX_SECURELABEL
0N/A bool fSecureLabel = false;
0N/A show_usage();
0N/A g_fRestoreState = true;
0N/A g_uNumShares++;
0N/A fFullscreen = true;
0N/A gfAllowFullscreenToggle = false;
0N/A gHostKeySym = 0;
0N/A#ifdef VBOXBFE_WITH_USB
0N/A if (!g_pszHdaFile)
0N/A return SyntaxError("The path to the specified harddisk, '%s', could not be resolved.\n", argv[curArg]);
0N/A if (!g_pszHdbFile)
0N/A return SyntaxError("The path to the specified harddisk, '%s', could not be resolved.\n", argv[curArg]);
0N/A if (!g_pszFdaFile)
0N/A return SyntaxError("The path to the specified floppy disk, '%s', could not be resolved.\n", argv[curArg]);
0N/A if (!g_pszCdromFile)
0N/A return SyntaxError("The path to the specified cdrom, '%s', could not be resolved.\n", argv[curArg]);
0N/A return SyntaxError("failed to generate a hardware address for network device %d (error %Rrc)\n",
0N/A return SyntaxError("The network MAC address has an invalid length: %s (%s)\n", pszMac, pszArg);
0N/A return SyntaxError("%d is not a hif device! Make sure you put the -hifdev argument first.\n", i);
0N/A return SyntaxError("bad interface name '%s' specified with '%s'. Expected 'lan0', 'lan1' and similar.\n",
0N/A#ifdef RT_OS_LINUX
0N/A#ifdef VBOX_WITH_VRDP
0N/A#ifdef VBOX_SECURELABEL
0N/A fSecureLabel = true;
0N/A g_fReleaseLog = true;
0N/A g_fReleaseLog = false;
0N/A g_fPreAllocRam = true;
0N/A#ifdef VBOXSDL_ADVANCED_OPTIONS
0N/A show_usage();
#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 (gpVM)
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;
#ifdef VBOXBFE_WITH_USB
if (g_fUSB)
if ( g_fRestoreState
&& *g_pszStateFile
goto failure;
if (gpVM)
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)
if (g_fHdaSpf)
if (g_pszHdbFile)
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 VBOX_WITH_SOLARIS_OSS
#ifdef VBOXBFE_WITH_USB
if (g_fUSB)
return rc;