ConsoleImpl2.cpp revision b7d3dff2ffcfa0d63df58c4b866f0379f013cba9
dc311b529996345ea65d51c87b60b6849642d894vboxsync * VBox Console COM Class implementation
dc311b529996345ea65d51c87b60b6849642d894vboxsync * @remark We've split out the code that the 64-bit VC++ v8 compiler
dc311b529996345ea65d51c87b60b6849642d894vboxsync * finds problematic to optimize so we can disable optimizations
dc311b529996345ea65d51c87b60b6849642d894vboxsync * and later, perhaps, find a real solution for it.
dc311b529996345ea65d51c87b60b6849642d894vboxsync * Copyright (C) 2006-2007 innotek GmbH
dc311b529996345ea65d51c87b60b6849642d894vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
dc311b529996345ea65d51c87b60b6849642d894vboxsync * available from http://www.virtualbox.org. This file is free software;
dc311b529996345ea65d51c87b60b6849642d894vboxsync * you can redistribute it and/or modify it under the terms of the GNU
dc311b529996345ea65d51c87b60b6849642d894vboxsync * General Public License (GPL) as published by the Free Software
dc311b529996345ea65d51c87b60b6849642d894vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
dc311b529996345ea65d51c87b60b6849642d894vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
dc311b529996345ea65d51c87b60b6849642d894vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
dc311b529996345ea65d51c87b60b6849642d894vboxsync/*******************************************************************************
dc311b529996345ea65d51c87b60b6849642d894vboxsync* Header Files *
dc311b529996345ea65d51c87b60b6849642d894vboxsync*******************************************************************************/
e07acfb7f2dbb8bb40804024c79fd3139bdb3f24vboxsync// generated header
dc311b529996345ea65d51c87b60b6849642d894vboxsync * VC++ 8 / amd64 has some serious trouble with this function.
dc311b529996345ea65d51c87b60b6849642d894vboxsync * As a temporary measure, we'll drop global optimizations.
dc311b529996345ea65d51c87b60b6849642d894vboxsync * Construct the VM configuration tree (CFGM).
ac5a71f3624a4c51d2a9323f8c88ead9c4d34582vboxsync * This is a callback for VMR3Create() call. It is called from CFGMR3Init()
ac5a71f3624a4c51d2a9323f8c88ead9c4d34582vboxsync * in the emulation thread (EMT). Any per thread COM/XPCOM initialization
f368a2b92cb798841781883a26ca5be04f5c2cbcvboxsync * is done here.
dc311b529996345ea65d51c87b60b6849642d894vboxsync * @param pVM VM handle.
dc311b529996345ea65d51c87b60b6849642d894vboxsync * @param pvConsole Pointer to the VMPowerUpTask object.
dc311b529996345ea65d51c87b60b6849642d894vboxsync * @return VBox status code.
c2029891dc7fbce0f08a378d0335568cf9cbb4c5vboxsync * @note Locks the Console object for writing.
c2029891dc7fbce0f08a378d0335568cf9cbb4c5vboxsyncDECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole)
c2029891dc7fbce0f08a378d0335568cf9cbb4c5vboxsync /* Note: hardcoded assumption about number of slots; see rom bios */
d19316699d7f91959d88c850fd7e0d64840f39a7vboxsync /* initialize COM */
dc311b529996345ea65d51c87b60b6849642d894vboxsync LogFlow (("Console::configConstructor(): CoInitializeEx()=%08X\n", hrc));
dc311b529996345ea65d51c87b60b6849642d894vboxsync ComObjPtr <Console> pConsole = static_cast <Console *> (pvConsole);
dc311b529996345ea65d51c87b60b6849642d894vboxsync AssertComRCReturn (autoCaller.rc(), VERR_ACCESS_DENIED);
dc311b529996345ea65d51c87b60b6849642d894vboxsync /* lock the console because we widely use internal fields and methods */
int rc;
#define STR_FREE() do { if (str) { SysFreeString(str); str = NULL; } if (psz) { RTStrFree(psz); psz = NULL; } } while (0)
#define RC_CHECK() do { if (VBOX_FAILURE(rc)) { AssertMsgFailed(("rc=%Vrc\n", rc)); STR_FREE(); return rc; } } while (0)
#define H() do { if (FAILED(hrc)) { AssertMsgFailed(("hrc=%#x\n", hrc)); STR_FREE(); return VERR_GENERAL_FAILURE; } } while (0)
STR_CONV();
STR_FREE();
if (fHWVirtExEnabled)
switch (controllerType)
case IDEControllerType_PIIX3:
case IDEControllerType_PIIX4:
return VERR_INVALID_PARAMETER;
#ifdef VBOX_WITH_XPCOM
return VERR_INVALID_PARAMETER;
const char *pszBootDevice;
switch (bootDevice)
case DeviceType_Null:
case DeviceType_HardDisk:
case DeviceType_DVD:
case DeviceType_Floppy:
case DeviceType_Network:
return VERR_INVALID_PARAMETER;
if (fACPI)
if (fFloppyEnabled)
if (floppyImage)
STR_CONV();
STR_FREE();
if (hostFloppyDrive)
STR_CONV();
STR_FREE();
#ifdef DEBUG
if (fIOAPIC)
int value;
switch (bootMenuMode)
value = 0;
unsigned cModes = 0;
STR_CONV();
STR_FREE();
cModes++;
if (pFramebuffer)
ulHeightReduction = 0;
if (sataController)
if (enabled)
{ "SataPrimaryMasterLUN", "SataPrimarySlaveLUN", "SataSecondaryMasterLUN", "SataSecondarySlaveLUN" };
&& fMore)
int iLUN;
switch (enmBus)
case StorageBus_IDE:
return VERR_GENERAL_FAILURE;
return VERR_GENERAL_FAILURE;
case StorageBus_SATA:
return VERR_GENERAL_FAILURE;
/* Can be NULL if SATA controller is not enabled and current hard disk is attached to SATA controller. */
if (pHardDiskCtl)
STR_CONV();
STR_FREE();
if (!curHardDisk)
STR_CONV();
STR_FREE();
STR_CONV();
STR_FREE();
STR_CONV();
if (port != 0)
char *pszTN;
STR_FREE();
if (str)
STR_CONV();
STR_FREE();
if (str)
STR_CONV();
STR_FREE();
STR_CONV();
STR_FREE();
STR_CONV();
STR_FREE();
STR_CONV();
STR_FREE();
STR_CONV();
STR_FREE();
AssertFailed();
if (dvdDrive)
if (hostDvdDrive)
STR_CONV();
STR_FREE();
if (dvdImage)
STR_CONV();
STR_FREE();
#ifdef VBOX_WITH_E1000
if (!fEnabled)
switch (adapterType)
#ifdef VBOX_WITH_E1000
return VERR_GENERAL_FAILURE;
switch (adapterType)
rc = CFGMR3InsertInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapNetworkLeds[ulInstance]); RC_CHECK();
if (fSniffer)
STR_CONV();
STR_FREE();
switch (networkAttachment)
if (fSniffer)
STR_CONV();
STR_FREE();
STR_CONV();
STR_FREE();
if (fSniffer)
# if defined(RT_OS_SOLARIS)
/* TAP setup application/script */
/* TAP terminate application/script */
/* "FileHandle" must NOT be inserted here, it is done in DrvTAP.cpp */
# ifdef VBOX_WITH_CROSSBOW
if (fSniffer)
switch (hrc)
#ifdef RT_OS_LINUX
case VERR_ACCESS_DENIED:
STR_CONV();
if (fSniffer)
STR_FREE();
if (serialPort)
if (!fEnabled)
if (parallelPort)
if (!fEnabled)
if (audioAdapter)
if (enabled)
switch (audioController)
case AudioControllerType_AC97:
case AudioControllerType_SB16:
switch (audioDriver)
case AudioDriverType_Null:
#ifdef RT_OS_WINDOWS
#ifdef VBOX_WITH_WINMM
case AudioDriverType_WinMM:
#ifdef RT_OS_SOLARIS
case AudioDriverType_SolAudio:
#ifdef RT_OS_LINUX
case AudioDriverType_OSS:
# ifdef VBOX_WITH_ALSA
case AudioDriverType_ALSA:
# ifdef VBOX_WITH_PULSE
case AudioDriverType_Pulse:
#ifdef RT_OS_DARWIN
STR_CONV();
STR_FREE();
if (USBCtlPtr)
if (fEnabled)
#ifdef VBOX_WITH_EHCI
if (fEnabled)
// VBoxManage setextradata "myvm" "VBoxInternal/USB/USBProxy/GlobalConfig/Force11PacketSize" 1
switch (mode)
case ClipboardMode_Disabled:
pConsole->mVMMDev->hgcmHostCall ("VBoxSharedClipboard", VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE, 1, &parm);
bool fGlobalExtraData = true;
if (fGlobalExtraData)
if (fGlobalExtraData)
fGlobalExtraData = false;
if (pszCFGMValueName)
if (pNode)
#undef H
return rc;