ConsoleImpl.cpp revision 661b072821c31cc284f9910c4bb8e52fc103c9e7
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * VBox Console COM Class implementation
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * Copyright (C) 2006-2007 innotek GmbH
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * This file is part of VirtualBox Open Source Edition (OSE), as
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc * available from http://www.virtualbox.org. This file is free software;
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * you can redistribute it and/or modify it under the terms of the GNU
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * General Public License as published by the Free Software Foundation,
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
2e545ce2450a9953665f701bb05350f0d3f26275nd * distribution. VirtualBox OSE is distributed in the hope that it will
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * be useful, but WITHOUT ANY WARRANTY of any kind.
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * If you received this file as part of a commercial VirtualBox
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * distribution, then only the terms of your commercial VirtualBox
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * license agreement apply instead of the previous paragraph.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar// generated header
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar// VMTask and friends
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar////////////////////////////////////////////////////////////////////////////////
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * Task structure for asynchronous VM operations.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * Once created, the task structure adds itself as a Console caller.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * This means:
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * 1. The user must check for #rc() before using the created structure
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * (e.g. passing it as a thread function argument). If #rc() returns a
ff5c8b431166d0bd346bbab0bb3e115436bd9e8algentis * failure, the Console object may not be used by the task (see
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar Console::addCaller() for more details).
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * 2. On successful initialization, the structure keeps the Console caller
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * until destruction (to ensure Console remains in the Ready state and won't
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * be accidentially uninitialized). Forgetting to delete the created task
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * will lead to Console::uninit() stuck waiting for releasing all added
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * callers.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * If \a aUsesVMPtr parameter is true, the task structure will also add itself
ff5c8b431166d0bd346bbab0bb3e115436bd9e8algentis * as a Console::mpVM caller with the same meaning as above. See
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar * Console::addVMCaller() for more info.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar : mConsole (aConsole), mCallerAdded (false), mVMCallerAdded (false)
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar /** Releases the Console caller before destruction. Not normally necessary. */
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar /** Releases the VM caller before destruction. Not normally necessary. */
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar VMProgressTask (Console *aConsole, Progress *aProgress, bool aUsesVMPtr)
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar : VMTask (aConsole, aUsesVMPtr), mProgress (aProgress) {}
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar : VMProgressTask (aConsole, aProgress, false /* aUsesVMPtr */)
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar , mSetVMErrorCallback (NULL), mConfigConstructor (NULL) {}
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar std::map <Bstr, ComPtr <ISharedFolder> > mSharedFolders;
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar : VMProgressTask (aConsole, aProgress, true /* aUsesVMPtr */)
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar , mLastMachineState (MachineState_InvalidMachineState) {}
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar// constructor / desctructor
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar/////////////////////////////////////////////////////////////////////////////
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar Assert(ELEMENTS(maTapFD) == ELEMENTS(maTAPDeviceName));
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar Assert(ELEMENTS(maTapFD) >= SchemaDefs::NetworkAdapterCount);
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar// public initializer/uninitializer for internal purposes only
ff5c8b431166d0bd346bbab0bb3e115436bd9e8algentis/////////////////////////////////////////////////////////////////////////////
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarHRESULT Console::init (IMachine *aMachine, IInternalMachineControl *aControl)
ff5c8b431166d0bd346bbab0bb3e115436bd9e8algentis /* Enclose the state transition NotReady->InInit->Ready */
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar LogFlowThisFunc(("aMachine=%p, aControl=%p\n", aMachine, aControl));
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar /* Cache essential properties and objects */
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar rc = mMachine->COMGETTER(VRDPServer) (unconst (mVRDPServer).asOutParam());
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor rc = mMachine->COMGETTER(DVDDrive) (unconst (mDVDDrive).asOutParam());
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor rc = mMachine->COMGETTER(FloppyDrive) (unconst (mFloppyDrive).asOutParam());
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Create associated child COM objects */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Create other child objects */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor unconst (mConsoleVRDPServer) = new ConsoleVRDPServer (this);
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor#endif /* VRDP_MC */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Confirm a successful initialization when it's the case */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * Uninitializes the Console object.
ff5c8b431166d0bd346bbab0bb3e115436bd9e8algentis /* Enclose the state transition Ready->InUninit->NotReady */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogFlowThisFunc (("initFailed()=%d\n", autoUninitSpan.initFailed()));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * Uninit all children that ise addDependentChild()/removeDependentChild()
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * in their init()/uninit() methods.
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* This should be the first, since this may cause detaching remote USB devices. */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* power down the VM if necessary */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Release all callbacks. Do this after uninitializing the components,
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * as some of them are well-behaved and unregister their callbacks.
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * These would trigger error messages complaining about trying to
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * unregister a non-registered callback. */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* dynamically allocated members of mCallbackData are uninitialized
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * at the end of powerDown() */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor Assert (!mCallbackData.mpsc.valid && mCallbackData.mpsc.shape == NULL);
daeb7789daed25bd92ff0b369bf152c487a8642fgryzorDECLCALLBACK(int) Console::vrdp_ClientLogon (void *pvUser,
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor const char *pszUser,
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor const char *pszDomain)
daeb7789daed25bd92ff0b369bf152c487a8642fgryzorDECLCALLBACK(int) Console::vrdp_ClientLogon (void *pvUser, const char *pszUser,
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor const char *pszDomain)
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor#endif /* VRDP_MC */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogFlowFunc (("%d, %s, %s, %s\n", u32ClientId, pszUser, pszPassword, pszDomain));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogFlowFunc (("%s, %s, %s\n", pszUser, pszPassword, pszDomain));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor#endif /* VRDP_MC */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Console has been already uninitialized, deny request */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogRel(("VRDPAUTH: Access denied (Console uninitialized).\n"));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor HRESULT hrc = console->mMachine->COMGETTER (Id) (uuid.asOutParam());
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor hrc = console->mVRDPServer->COMGETTER(AuthType) (&authType);
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor hrc = console->mVRDPServer->COMGETTER(AuthTimeout) (&authTimeout);
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor VRDPAuthGuestJudgement guestJudgement = VRDPAuthGuestNotAsked;
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogRel (("VRDPAUTH: User: [%s]. Domain: [%s]. Authentication type: [%s]\n",
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor "external":
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Multiconnection check. */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor hrc = console->mVRDPServer->COMGETTER(AllowMultiConnection) (&allowMultiConnection);
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogFlowFunc(("allowMultiConnection %d, console->mcVRDPClients = %d\n", allowMultiConnection, console->mcVRDPClients));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Note: the variable is incremented in ClientConnect callback, which is called when the client
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * is successfully connected, that is after the ClientLogon callback. Therefore the mcVRDPClients
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor * value is 0 for first client.
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Reject. */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogRel(("VRDPAUTH: Multiple connections are not enabled. Access denied.\n"));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Call the external library. */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor result = console->mConsoleVRDPServer->Authenticate (uuid, guestJudgement, pszUser, pszPassword, pszDomain, u32ClientId);
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogFlowFunc (("External auth asked for guest judgement\n"));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor } /* pass through */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Issue the request to guest. Assume that the call does not require EMT. It should not. */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Ask the guest to judge these credentials. */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor uint32_t u32GuestFlags = VMMDEV_SETCREDENTIALS_JUDGE;
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor int rc = console->mVMMDev->getVMMDevPort()->pfnSetCredentials (console->mVMMDev->getVMMDevPort(),
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Wait for guest. */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor rc = console->mVMMDev->WaitCredentialsJudgement (authTimeout, &u32GuestFlags);
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor switch (u32GuestFlags & (VMMDEV_CREDENTIALS_JUDGE_OK | VMMDEV_CREDENTIALS_JUDGE_DENY | VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT))
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor case VMMDEV_CREDENTIALS_JUDGE_DENY: guestJudgement = VRDPAuthGuestAccessDenied; break;
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor case VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT: guestJudgement = VRDPAuthGuestNoJudgement; break;
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor case VMMDEV_CREDENTIALS_JUDGE_OK: guestJudgement = VRDPAuthGuestAccessGranted; break;
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogFlowFunc (("Invalid guest flags %08X!!!\n", u32GuestFlags)); break;
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogFlowFunc (("Wait for credentials judgement rc = %Vrc!!!\n", rc));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogFlowFunc (("Guest judgement %d\n", guestJudgement));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogFlowFunc (("Could not set credentials rc = %Vrc!!!\n", rc));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogRel(("VRDPAUTH: Guest judgement %d.\n", guestJudgement));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor LogFlowFunc (("External auth called again with guest judgement = %d\n", guestJudgement));
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor result = console->mConsoleVRDPServer->Authenticate (uuid, guestJudgement, pszUser, pszPassword, pszDomain, u32ClientId);
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor /* Reject. */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzorDECLCALLBACK(void) Console::vrdp_ClientConnect (void *pvUser,
daeb7789daed25bd92ff0b369bf152c487a8642fgryzorDECLCALLBACK(void) Console::vrdp_ClientConnect (void *pvUser,
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor#endif /* VRDP_MC */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor console->mDisplay->VideoAccelVRDP (true, fu32SupportedOrders);
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor#endif /* VRDP_MC */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor#endif /* VBOX_VRDP */
daeb7789daed25bd92ff0b369bf152c487a8642fgryzorDECLCALLBACK(void) Console::vrdp_ClientDisconnect (void *pvUser,
daeb7789daed25bd92ff0b369bf152c487a8642fgryzorDECLCALLBACK(void) Console::vrdp_ClientDisconnect (void *pvUser)
daeb7789daed25bd92ff0b369bf152c487a8642fgryzor#endif /* VRDP_MC */
#ifdef VBOX_VRDP
#ifdef VRDP_MC
u32ClientId = 0;
#ifdef VRDP_MC
#ifdef VBOX_VRDP
#ifdef VRDP_MC
if (port)
if (port)
#ifdef VRDP_MC
#ifdef VRDP_MC
#ifdef VBOX_VRDP
#ifdef VRDP_MC
if (port)
if (port)
#ifdef VRDP_MC
void **ppv)
#ifdef VRDP_MC
#ifdef VRDP_MC
void **ppv)
#ifdef VBOX_VRDP
void **ppv)
return S_OK;
return rc;
mSavedStateDataLoaded = true;
return rc;
DECLCALLBACK(void)
++ it)
DECLCALLBACK(int)
return VERR_VERSION_MISMATCH;
if (u32Version != 0)
return VINF_SUCCESS;
delete[] buf;
delete[] buf;
return rc;
return VINF_SUCCESS;
if (!aMachine)
return E_POINTER;
return S_OK;
if (!aMachineState)
return E_POINTER;
return S_OK;
if (!aGuest)
return E_POINTER;
return S_OK;
if (!aKeyboard)
return E_POINTER;
return S_OK;
if (!aMouse)
return E_POINTER;
return S_OK;
if (!aDisplay)
return E_POINTER;
return S_OK;
if (!aDebugger)
return E_POINTER;
if (!mDebugger)
return S_OK;
if (!aUSBDevices)
return E_POINTER;
return S_OK;
if (!aRemoteUSBDevices)
return E_POINTER;
return S_OK;
if (!aRemoteDisplayInfo)
return E_POINTER;
return S_OK;
if (!aSharedFolders)
return E_POINTER;
return S_OK;
return setError(E_FAIL, tr ("Cannot power up the machine as it is already running. (Machine state: %d)"), mMachineState);
if (!fAccessible)
if (dvdImage)
if (!fAccessible)
if (floppyImage)
if (!fAccessible)
if (!enabled)
switch (netattach)
#ifdef __WIN__
if (!hostif)
if (!accessible)
if (aProgress)
E_FAIL);
return S_OK;
return setError(E_FAIL, tr ("Cannot power off the machine as it is not running or paused. (Machine state: %d)"), mMachineState);
return rc;
return setError(E_FAIL, tr ("Cannot reset the machine as it is not running. (Machine state: %d)"), mMachineState);
return rc;
return setError (E_FAIL, tr ("Cannot pause the machine as it is not running. (Machine state: %d)"), mMachineState);
return rc;
return setError (E_FAIL, tr ("Cannot resume the machine as it is not paused. (Machine state: %d)"), mMachineState);
return rc;
return setError (E_FAIL, tr ("Cannot power off the machine as it is not running. (Machine state: %d)"), mMachineState);
return rc;
if (!aProgress)
return E_POINTER;
bool beganSavingState = false;
bool taskCreationFailed = false;
taskCreationFailed = true;
beganSavingState = true;
if (beganSavingState)
Resume();
return rc;
tr ("Cannot discard the machine state as the machine is not in the saved state. (Machine state: %d"), mMachineState);
return S_OK;
if (!pLed)
return u32;
if (!aDeviceActivity)
return E_INVALIDARG;
switch (aDeviceType)
case DeviceType_FloppyDevice:
case DeviceType_DVDDevice:
case DeviceType_NetworkDevice:
case DeviceType_USBDevice:
case PDMLED_READING:
case PDMLED_WRITING:
return S_OK;
return rc;
if (!aDevice)
return E_POINTER;
++ it;
if (!device)
return rc;
return E_INVALIDARG;
return rc;
if (!accessible)
int cbString;
return S_OK;
if (!aName)
return E_INVALIDARG;
int cbString;
return rc;
if (!aName)
return E_INVALIDARG;
if (!aProgress)
return E_POINTER;
tr ("Cannot take a snapshot of a machine while it is changing state. (Machine state: %d)"), mMachineState);
if (takingSnapshotOnline)
bool beganTakingSnapshot = false;
bool taskCreationFailed = false;
if (takingSnapshotOnline)
taskCreationFailed = true;
beganTakingSnapshot = true;
if (takingSnapshotOnline)
if (combinedProgress)
Resume();
return rc;
return E_INVALIDARG;
if (!aProgress)
return E_POINTER;
return S_OK;
return S_OK;
tr ("Cannot discard the current snapshot and state on a running machine. (Machine state: %d)"), mMachineState);
return S_OK;
if (!aCallback)
return E_INVALIDARG;
return S_OK;
if (!aCallback)
return E_INVALIDARG;
return S_OK;
if (!mpVM)
return S_OK;
return S_OK;
bool fPassthrough = false;
switch (eState)
case DriveState_ImageMounted:
case DriveState_NotMounted:
return rc;
if (!mpVM)
return S_OK;
if (!fEnabled)
return S_OK;
return S_OK;
switch (eState)
case DriveState_ImageMounted:
case DriveState_NotMounted:
return rc;
HRESULT Console::doDriveChange (const char *pszDevice, unsigned uInstance, unsigned uLun, DriveState_T eState,
return S_OK;
if (pszPath)
DECLCALLBACK(int) Console::changeDrive (Console *pThis, const char *pszDevice, unsigned uInstance, unsigned uLun,
* modify the meDVDState/meFloppyState members (pointed to by peState).
bool fResume;
switch (enmVMState)
case VMSTATE_RESETTING:
case VMSTATE_RUNNING:
fResume = true;
case VMSTATE_SUSPENDED:
case VMSTATE_CREATED:
case VMSTATE_OFF:
fResume = false;
switch (*peState)
case DriveState_ImageMounted:
case DriveState_NotMounted:
&& VBOX_SUCCESS (rc = CFGMR3InsertString (pLunL0, "Driver", !strcmp (pszDevice, "i82078") ? "HostFloppy" : "HostDVD"))
&& VBOX_SUCCESS (rc = !strcmp (pszDevice, "i82078") ? VINF_SUCCESS : CFGMR3InsertInteger(pCfg, "Passthrough", fPassthrough)))
switch (eState)
case DriveState_ImageMounted:
case DriveState_NotMounted:
if (!pIMount)
RC_CHECK();
RC_CHECK();
return rc;
if (!pIMount)
AssertFailed();
return rc;
if (fResume)
return rcRet;
if (!mpVM)
return S_OK;
PPDMINETWORKCONFIG pINetCfg = (PPDMINETWORKCONFIG)pBase->pfnQueryInterface(pBase, PDMINTERFACE_NETWORK_CONFIG);
if (pINetCfg)
rcVBox = pINetCfg->pfnSetLinkState(pINetCfg, fCableConnected ? PDMNETWORKLINKSTATE_UP : PDMNETWORKLINKSTATE_DOWN);
return rc;
if (vrdpEnabled)
return rc;
if (!mpVM)
return S_OK;
return S_OK;
return E_FAIL;
return S_OK;
return E_FAIL;
return rc;
++ it;
return E_FAIL;
return S_OK;
return rc;
E_FAIL);
void *pShape)
if (!wasValid)
*aWinId = 0;
if (aCheck)
return rc;
return rc;
if (*aWinId == 0)
return S_OK;
if (mVMDestroying)
++ mVMCallers;
return S_OK;
-- mVMCallers;
if (mVMCallers > 0)
mVMDestroying = true;
mVMCallers));
if (mConsoleVRDPServer)
mVMDestroying = false;
return rc;
if (aUpdateServer)
return rc;
bool found = false;
++ it)
if (found)
return rc;
DECLCALLBACK(void)
void *aUser)
switch (aState)
case VMSTATE_OFF:
case VMSTATE_TERMINATED:
if (aVM)
AssertFailed();
case MachineState_Stopping:
case MachineState_Saving:
case MachineState_Starting:
case MachineState_Restoring:
case VMSTATE_SUSPENDED:
case VMSTATE_RUNNING:
#ifndef VRDP_MC
if (fRemote)
this, aHostDevice,
switch (vrc)
case VERR_VUSB_NO_PORTS:
return hrc;
DECLCALLBACK(int)
#ifdef VRDP_MC
if (aRemote)
aRemoteBackend = that->consoleVRDPServer ()->USBBackendRequestPointer (pRemoteUSBDevice->clientId (), &guid);
return VERR_INVALID_PARAMETER;
return vrc;
return S_OK;
DECLCALLBACK(int)
#ifdef VRDP_MC
if (fRemote)
return vrc;
#if defined(__WIN__)
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)
#ifdef VBOX_WITH_XPCOM
return VERR_INVALID_PARAMETER;
const char *pszBootDevice;
switch (bootDevice)
case DeviceType_NoDevice:
case DeviceType_DVDDevice:
case DeviceType_FloppyDevice:
case DeviceType_NetworkDevice:
return VERR_INVALID_PARAMETER;
int value;
switch (bootMenuMode)
value = 0;
if (fACPI)
if (fFloppyEnabled)
if (floppyImage)
STR_CONV();
STR_FREE();
if (hostFloppyDrive)
STR_CONV();
STR_FREE();
#ifdef DEBUG
if (fIOAPIC)
unsigned cModes = 0;
STR_CONV();
STR_FREE();
cModes++;
&& fMore)
switch (enmCtl)
return VERR_GENERAL_FAILURE;
return VERR_GENERAL_FAILURE;
i = i + lDev;
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();
AssertFailed();
if (dvdDrive)
if (hostDvdDrive)
STR_CONV();
STR_FREE();
if (dvdImage)
STR_CONV();
STR_FREE();
if (!fEnabled)
switch (adapterType)
return VERR_GENERAL_FAILURE;
rc = CFGMR3InsertInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapNetworkLeds[ulInstance]); RC_CHECK();
if (fSniffer)
STR_CONV();
STR_FREE();
switch (networkAttachment)
if (fSniffer)
if (fSniffer)
if (fSniffer)
switch (hrc)
#ifdef __LINUX__
case VERR_ACCESS_DENIED:
STR_CONV();
if (fSniffer)
STR_FREE();
if (audioAdapter)
if (enabled)
switch (audioDriver)
#ifdef __WIN__
#ifdef VBOX_WITH_WINMM
#ifdef __LINUX__
# ifdef VBOX_WITH_ALSA
#ifdef __DARWIN__
if (USBCtlPtr)
if (fEnabled)
switch (mode)
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;
#ifdef __LINUX__
int rc;
szCommand));
if (pfScriptHandle == 0)
if (!isStatic)
return setError(E_FAIL, tr ("The host networking set up command did not supply an interface name"));
return S_OK;
#ifdef DEBUG
#ifdef __WIN__
bool isStatic = false;
isStatic = true;
memcpy(IfReq.ifr_name, str.raw(), sizeof(IfReq.ifr_name) - 1); /** @todo bitch about names which are too long... */
if (rcVBox != 0)
if (!isStatic)
memcpy(IfReq.ifr_name, str.raw(), sizeof(IfReq.ifr_name) - 1); /** @todo bitch about names which are too long... */
if (rcVBox != 0)
LogRel(("Failed to open the host network interface %ls returned by the setup script", tapDeviceName.raw()));
rc = setError(E_FAIL, tr ("Failed to open the host network interface %ls returned by the setup script"), tapDeviceName.raw());
LogRel(("Configuration error: Failed to configure /dev/net/tun non blocking. Error: %s\n", strerror(iErr)));
rc = setError(E_FAIL, tr ("could not set up the host networking device for non blocking access: %s"),
switch (rcVBox)
case VERR_ACCESS_DENIED:
return rc;
#ifdef DEBUG
bool isStatic = true;
isStatic = false;
if (isStatic)
return rc;
if (!enabled)
return rc;
return VINF_SUCCESS;
const char *pszErrorID,
#ifdef VRDP_MC
void Console::processRemoteUSBDevices (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevList, uint32_t cbDevList)
#ifdef VRDP_MC
LogFlowThisFunc (("u32ClientId = %d, pDevList=%p, cbDevList = %d\n", u32ClientId, pDevList, cbDevList));
++ it;
bool fNewDevice = true;
#ifdef VRDP_MC
fNewDevice = false;
++ it;
if (fNewDevice)
#ifdef VRDP_MC
if (fMatched)
++ it;
if (!device)
#if defined(__WIN__)
#ifdef __WIN__
nowUct);
#ifdef VBOX_VRDP
switch (vrc)
case VERR_NET_ADDRESS_IN_USE:
port);
vrc);
&pVM);
#ifdef VBOX_VRDP
if (machineDebugger)
++ it)
int cbString;
* need to go back to the PoweredOff/Saved state. Reuse
console);
#if defined(__WIN__)
return VINF_SUCCESS;
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(); *phrc = hrc; return VERR_GENERAL_FAILURE; } } while (0)
switch (enmCtl)
return VERR_GENERAL_FAILURE;
return VERR_GENERAL_FAILURE;
i = i + lDev;
PCFGMNODE pLunL1 = CFGMR3GetChildF(CFGMR3GetRoot(pVM), "Devices/piix3ide/0/LUN#%d/AttachedDriver/", i);
if (!pLunL1)
#ifdef VBOX_STRICT
char *pszDriver;
STR_CONV();
char *pszPath;
STR_FREE();
return VINF_SUCCESS;
STR_CONV();
STR_FREE();
STR_CONV();
STR_FREE();
if (!curHardDisk)
STR_CONV();
STR_FREE();
return rc;
return VINF_SUCCESS;
return VINF_SUCCESS;
typedef struct DRVMAINSTATUS
DECLCALLBACK(void *) Console::drvStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
switch (enmInterface)
case PDMINTERFACE_BASE:
return NULL;
while (iLed-- > 0)
return VERR_PDM_DRVINS_NO_ATTACH;
return rc;
return rc;
return rc;
AssertMsgFailed(("Configuration error: Invalid unit range %u-%u\n", pData->iFirstLUN, pData->iLastLUN));
return VERR_GENERAL_FAILURE;
pData->pLedPorts = (PPDMILEDPORTS)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_LED_PORTS);
return VERR_PDM_MISSING_INTERFACE_ABOVE;
return VINF_SUCCESS;
sizeof(DRVMAINSTATUS),
NULL,
NULL,
NULL,
NULL,
NULL,