GuestImpl.cpp revision 0229ec87789aab83ed0595b9ad5151351778e2cf
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * VirtualBox COM class implementation
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * Copyright (C) 2006-2010 Oracle Corporation
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * This file is part of VirtualBox Open Source Edition (OSE), as
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * available from http://www.virtualbox.org. This file is free software;
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * you can redistribute it and/or modify it under the terms of the GNU
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * General Public License (GPL) as published by the Free Software
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * Foundation, in version 2 as it comes in the "COPYING" file of the
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift/////////////////////////////////////////////////////////////////////////////
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift// constructor / destructor
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson/////////////////////////////////////////////////////////////////////////////
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson// public methods only for internal purposes
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson/////////////////////////////////////////////////////////////////////////////
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * Initializes the guest object.
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson /* Enclose the state transition NotReady->InInit->Ready */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson /* Confirm a successful initialization when it's the case */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson HRESULT ret = mParent->machine()->COMGETTER(MemoryBalloonSize)(&aMemoryBalloonSize);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift mMemoryBalloonSize = 0; /* Default is no ballooning */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift ret = mParent->machine()->COMGETTER(PageFusionEnabled)(&fPageFusionEnabled);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift mfPageFusionEnabled = false; /* Default is no page fusion*/
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift mStatUpdateInterval = 0; /* Default is not to report guest statistics at all */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift /* Clear statistics. */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift for (unsigned i = 0 ; i < GUESTSTATTYPE_MAX; i++)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift /* Init the context ID counter at 1000. */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift * Uninitializes the instance and sets the ready flag to FALSE.
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * Called either from FinalRelease() or by the parent when it gets destroyed.
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift /* Scope write lock as much as possible. */
94e4fd51556092f22a664c3c8080cb4688f09140sin * Cleanup must be done *before* AutoUninitSpan to cancel all
94e4fd51556092f22a664c3c8080cb4688f09140sin * all outstanding waits in API functions (which hold AutoCaller
94e4fd51556092f22a664c3c8080cb4688f09140sin * ref counts).
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson /* Clean up callback data. */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift for (it = mCallbackMap.begin(); it != mCallbackMap.end(); it++)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift /* Clear process map. */
e595b7115481489471844679dc84222cf121a754boli /* Enclose the state transition Ready->InUninit->NotReady */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift// IGuest properties
e595b7115481489471844679dc84222cf121a754boli/////////////////////////////////////////////////////////////////////////////
e595b7115481489471844679dc84222cf121a754boliSTDMETHODIMP Guest::COMGETTER(OSTypeId) (BSTR *aOSTypeId)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift if (FAILED(autoCaller.rc())) return autoCaller.rc();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift // redirect the call to IMachine if no additions are installed
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift return mParent->machine()->COMGETTER(OSTypeId)(aOSTypeId);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftSTDMETHODIMP Guest::COMGETTER(AdditionsRunLevel) (ULONG *aRunLevel)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift if (FAILED(autoCaller.rc())) return autoCaller.rc();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftSTDMETHODIMP Guest::COMGETTER(AdditionsVersion) (BSTR *aAdditionsVersion)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift CheckComArgOutPointerValid(aAdditionsVersion);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift if (FAILED(autoCaller.rc())) return autoCaller.rc();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson /* Only try alternative way if GA are active! */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift && mData.mAdditionsRunLevel > VBoxGuestAdditionsRunLevel_None)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift * If we got back an empty string from GetAdditionsVersion() we either
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * really don't have the Guest Additions version yet or the guest is running
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift * older Guest Additions (< 3.2.0) which don't provide VMMDevReq_ReportGuestInfo2,
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift * so get the version + revision from the (hopefully) provided guest properties
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift hr = mParent->machine()->GetGuestProperty(Bstr("/VirtualBox/GuestAdd/Version"),
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift addVersion.asOutParam(), &u64Timestamp, flags.asOutParam());
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift hr = mParent->machine()->GetGuestProperty(Bstr("/VirtualBox/GuestAdd/Revision"),
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift addRevision.asOutParam(), &u64Timestamp, flags.asOutParam());
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift /* Some Guest Additions versions had interchanged version + revision values,
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * so check if the version value at least has a dot to identify it and change
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * both values to reflect the right content. */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson /** @todo r=bird: else: Should not return failure! */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson /* If getting the version + revision above fails or they simply aren't there
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift * because of *really* old Guest Additions we only can report the interface
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift * version to at least have something. */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson mData.mInterfaceVersion.cloneTo(aAdditionsVersion);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson /** @todo r=bird: hr is still indicating failure! */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson mData.mAdditionsVersion.cloneTo(aAdditionsVersion);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilsonSTDMETHODIMP Guest::COMGETTER(SupportsSeamless) (BOOL *aSupportsSeamless)
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson CheckComArgOutPointerValid(aSupportsSeamless);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson if (FAILED(autoCaller.rc())) return autoCaller.rc();
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
53247d28ba99538f841a13ea2cde01c3faa3ef36kenneth_suterSTDMETHODIMP Guest::COMGETTER(SupportsGraphics) (BOOL *aSupportsGraphics)
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson CheckComArgOutPointerValid(aSupportsGraphics);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift if (FAILED(autoCaller.rc())) return autoCaller.rc();
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilsonSTDMETHODIMP Guest::COMGETTER(MemoryBalloonSize) (ULONG *aMemoryBalloonSize)
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson CheckComArgOutPointerValid(aMemoryBalloonSize);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson if (FAILED(autoCaller.rc())) return autoCaller.rc();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilsonSTDMETHODIMP Guest::COMSETTER(MemoryBalloonSize) (ULONG aMemoryBalloonSize)
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson if (FAILED(autoCaller.rc())) return autoCaller.rc();
53247d28ba99538f841a13ea2cde01c3faa3ef36kenneth_suter AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson /* We must be 100% sure that IMachine::COMSETTER(MemoryBalloonSize)
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * does not call us back in any way! */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson HRESULT ret = mParent->machine()->COMSETTER(MemoryBalloonSize)(aMemoryBalloonSize);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson /* forward the information to the VMM device */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift pVMMDevPort->pfnSetMemoryBalloon(pVMMDevPort, aMemoryBalloonSize);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftSTDMETHODIMP Guest::COMGETTER(StatisticsUpdateInterval)(ULONG *aUpdateInterval)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift if (FAILED(autoCaller.rc())) return autoCaller.rc();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftSTDMETHODIMP Guest::COMSETTER(StatisticsUpdateInterval)(ULONG aUpdateInterval)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift if (FAILED(autoCaller.rc())) return autoCaller.rc();
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift /* forward the information to the VMM device */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift pVMMDevPort->pfnSetStatisticsInterval(pVMMDevPort, aUpdateInterval);
94e4fd51556092f22a664c3c8080cb4688f09140sinSTDMETHODIMP Guest::InternalGetStatistics(ULONG *aCpuUser, ULONG *aCpuKernel, ULONG *aCpuIdle,
94e4fd51556092f22a664c3c8080cb4688f09140sin ULONG *aMemTotal, ULONG *aMemFree, ULONG *aMemBalloon, ULONG *aMemShared,
94e4fd51556092f22a664c3c8080cb4688f09140sin ULONG *aMemAllocTotal, ULONG *aMemFreeTotal, ULONG *aMemBalloonTotal, ULONG *aMemSharedTotal)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift if (FAILED(autoCaller.rc())) return autoCaller.rc();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aCpuUser = mCurrentGuestStat[GUESTSTATTYPE_CPUUSER];
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aCpuKernel = mCurrentGuestStat[GUESTSTATTYPE_CPUKERNEL];
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aCpuIdle = mCurrentGuestStat[GUESTSTATTYPE_CPUIDLE];
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aMemTotal = mCurrentGuestStat[GUESTSTATTYPE_MEMTOTAL] * (_4K/_1K); /* page (4K) -> 1KB units */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aMemFree = mCurrentGuestStat[GUESTSTATTYPE_MEMFREE] * (_4K/_1K); /* page (4K) -> 1KB units */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aMemBalloon = mCurrentGuestStat[GUESTSTATTYPE_MEMBALLOON] * (_4K/_1K); /* page (4K) -> 1KB units */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aMemCache = mCurrentGuestStat[GUESTSTATTYPE_MEMCACHE] * (_4K/_1K); /* page (4K) -> 1KB units */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aPageTotal = mCurrentGuestStat[GUESTSTATTYPE_PAGETOTAL] * (_4K/_1K); /* page (4K) -> 1KB units */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson uint64_t uFreeTotal, uAllocTotal, uBalloonedTotal, uSharedTotal;
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift int rc = PGMR3QueryVMMMemoryStats(pVM.raw(), &uAllocTotal, &uFreeTotal, &uBalloonedTotal, &uSharedTotal);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aMemAllocTotal = (ULONG)(uAllocTotal / _1K); /* bytes -> KB */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aMemBalloonTotal = (ULONG)(uBalloonedTotal / _1K);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aMemSharedTotal = (ULONG)(uSharedTotal / _1K);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift /* Query the missing per-VM memory statistics. */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson uint64_t uTotalMem, uPrivateMem, uSharedMem, uZeroMem;
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift rc = PGMR3QueryMemoryStats(pVM.raw(), &uTotalMem, &uPrivateMem, &uSharedMem, &uZeroMem);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftHRESULT Guest::setStatistic(ULONG aCpuId, GUESTSTATTYPE enmType, ULONG aVal)
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson if (FAILED(autoCaller.rc())) return autoCaller.rc();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilsonSTDMETHODIMP Guest::GetAdditionsStatus(ULONG aLevel, BOOL *aActive)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift if (FAILED(autoCaller.rc())) return autoCaller.rc();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson case 0: /* System */
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson *aActive = (mData.mAdditionsRunLevel > VBoxGuestAdditionsRunLevel_None);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aActive = (mData.mAdditionsRunLevel >= VBoxGuestAdditionsRunLevel_Userland);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *aActive = (mData.mAdditionsRunLevel >= VBoxGuestAdditionsRunLevel_Desktop);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftSTDMETHODIMP Guest::SetCredentials(IN_BSTR aUserName, IN_BSTR aPassword,
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift if (FAILED(autoCaller.rc())) return autoCaller.rc();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift /* forward the information to the VMM device */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift uint32_t u32Flags = VMMDEV_SETCREDENTIALS_GUESTLOGON;
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift u32Flags = VMMDEV_SETCREDENTIALS_NOLOCALLOGON;
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift tr("VMM device is not available (is the VM running?)"));
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * Appends environment variables to the environment block. Each var=value pair is separated
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * by NULL (\0) sequence. The whole block will be stored in one blob and disassembled on the
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift * guest side later to fit into the HGCM param structure.
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift * @returns VBox status code.
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftint Guest::prepareExecuteEnv(const char *pszEnv, void **ppvList, uint32_t *pcbList, uint32_t *pcEnv)
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift uint32_t cbNewLen = *pcbList + cbLen + 1; /* Include zero termination. */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift char *pvTmp = (char*)RTMemRealloc(*ppvList, cbNewLen);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift pvTmp[cbNewLen - 1] = '\0'; /* Add zero termination. */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift /* Reset counters. */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift *pcbList += cbLen + 1; /* Include zero termination. */
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift * Static callback function for receiving updates on guest control commands
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift * from the guest. Acts as a dispatcher for the actual class instance.
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilson * @returns VBox status code.
0218789478dbe859fd4593d9dd37360750a43893neil_a_wilsonDECLCALLBACK(int) Guest::doGuestCtrlNotification(void *pvExtension,
void *pvParms,
using namespace guestControl;
#ifdef DEBUG_andy
PCALLBACKDATACLIENTDISCONNECTED pCBData = reinterpret_cast<PCALLBACKDATACLIENTDISCONNECTED>(pvParms);
return rc;
/* Function for handling the execution start/termination notification. */
&& !fCanceled)
case PROC_STS_STARTED:
hr = it->second.pProgress->SetNextOperation(BstrFmt(tr("Waiting for process to exit ...")), 1 /* Weight */);
LogRel(("Guest process (PID %u) exited normally\n", pCBData->u32PID)); /** @todo Add process name */
case PROC_STS_TOK:
LogRel(("Guest process (PID %u) timed out and was killed\n", pCBData->u32PID)); /** @todo Add process name */
case PROC_STS_TOA:
LogRel(("Guest process (PID %u) timed out and could not be killed\n", pCBData->u32PID)); /** @todo Add process name */
case PROC_STS_DWN:
LogRel(("Guest process (PID %u) exited because system is shutting down\n", pCBData->u32PID)); /** @todo Add process name */
case PROC_STS_ERROR:
LogFlowFunc(("Unexpected callback (magic=%u, context ID=%u) arrived\n", pData->hdr.u32Magic, pData->hdr.u32ContextID));
return vrc;
LogFlowFunc(("Unexpected callback (magic=%u, context ID=%u) arrived\n", pData->hdr.u32Magic, pData->hdr.u32ContextID));
return rc;
return rc;
if (!fCompleted)
* cancle won't work!). This could happen if the client thread (e.g. VBoxService, thread of a spawned process)
uint32_t Guest::addCtrlCallbackContext(eVBoxGuestCtrlCallbackType enmType, void *pvData, uint32_t cbData, Progress *pProgress)
&& uNewContext > 0)
AssertReleaseMsg(uNewContext, ("No free context ID found! uNewContext=%u, nCallbacks=%u", uNewContext, nCallbacks));
return uNewContext;
#ifndef VBOX_WITH_GUEST_CONTROL
using namespace guestControl;
return E_INVALIDARG;
TRUE,
if (aTimeoutMS == 0)
if (aArguments > 0)
if (uNumArgs > 0)
if (aEnvironment > 0)
PCALLBACKDATAEXECSTATUS pData = (PCALLBACKDATAEXECSTATUS)RTMemAlloc(sizeof(CALLBACKDATAEXECSTATUS));
if (vmmDev)
i, paParms);
if (!fCanceled)
case PROC_STS_STARTED:
case PROC_STS_TOK:
case PROC_STS_TOA:
case PROC_STS_DWN:
case PROC_STS_ERROR:
case PROC_STS_UNDEFINED:
for (unsigned i = 0; i < uNumArgs; i++)
return rc;
STDMETHODIMP Guest::GetProcessOutput(ULONG aPID, ULONG aFlags, ULONG aTimeoutMS, LONG64 aSize, ComSafeArrayOut(BYTE, aData))
#ifndef VBOX_WITH_GUEST_CONTROL
using namespace guestControl;
if (aSize < 0)
TRUE);
if (aTimeoutMS == 0)
if (vmmDev)
i, paParms);
if (!fCanceled)
&& fCompleted)
return rc;
#ifndef VBOX_WITH_GUEST_CONTROL
using namespace guestControl;
return rc;