GuestSessionImplTasks.cpp revision f75c6db919d277952ca03b7acf643e5e3ac96caf
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * VirtualBox Main - XXX.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Copyright (C) 2012 Oracle Corporation
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * available from http://www.virtualbox.org. This file is free software;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * General Public License (GPL) as published by the Free Software
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/*******************************************************************************
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync* Header Files *
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync*******************************************************************************/
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync/*******************************************************************************
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync*******************************************************************************/
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync * Update file flags.
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync/** Copy over the file from host to the
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * guest. */
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync/** Execute file on the guest after it has
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync * been successfully transfered. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync/** File is optional, does not have to be
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * existent on the .ISO. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync// session task classes
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/////////////////////////////////////////////////////////////////////////////
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncGuestSessionTask::GuestSessionTask(GuestSession *pSession)
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsyncint GuestSessionTask::getGuestProperty(const ComObjPtr<Guest> &pGuest,
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync ComObjPtr<Console> pConsole = pGuest->getConsole();
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync const ComPtr<IMachine> pMachine = pConsole->machine();
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync HRESULT hr = pMachine->GetGuestProperty(Bstr(strPath).raw(),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (mProgress.isNull()) /* Progress is optional. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ( SUCCEEDED(mProgress->COMGETTER(Canceled(&fCanceled)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ( SUCCEEDED(mProgress->COMGETTER(Completed(&fCompleted)))
ffb50166c9adb4ae583b914d405197035cf890advboxsync AssertMsgFailed(("Setting value of an already completed progress\n"));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync HRESULT hr = mProgress->SetCurrentOperationProgress(uPercent);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (mProgress.isNull()) /* Progress is optional. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ( SUCCEEDED(mProgress->COMGETTER(Canceled(&fCanceled)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync && SUCCEEDED(mProgress->COMGETTER(Completed(&fCompleted)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync return VERR_COM_UNEXPECTED; /** @todo Find a better rc. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncHRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (mProgress.isNull()) /* Progress is optional. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ( SUCCEEDED(mProgress->COMGETTER(Canceled(&fCanceled)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync && SUCCEEDED(mProgress->COMGETTER(Completed(&fCompleted)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncSessionTaskCopyTo::SessionTaskCopyTo(GuestSession *pSession,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/** @todo Merge this and the above call and let the above call do the open/close file handling so that the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * inner code only has to deal with file handles. No time now ... */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncSessionTaskCopyTo::SessionTaskCopyTo(GuestSession *pSession,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync PRTFILE pSourceFile, size_t cbSourceOffset, uint64_t cbSourceSize,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Copy flags (%#x) not implemented yet"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Does our source file exist? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Source file \"%s\" does not exist or is not a file"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Could not open source file \"%s\" for reading: %Rrc"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Could not query file size of \"%s\": %Rrc"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Size + offset are optional. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync procInfo.mName = Utf8StrFmt(GuestSession::tr("Copying file \"%s\" to the guest to \"%s\" (%RU64 bytes)"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Set arguments.*/
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync procInfo.mArguments.push_back(Utf8StrFmt("--output=%s", mDest.c_str())); /** @todo Do we need path conversion? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Startup process. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = pSession->processCreateExInteral(procInfo, pProcess);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Unable to start guest process: %Rrc"), rc));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync && waitRes.mResult != ProcessWaitResult_WaitFlagNotSupported))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* If the guest does not support waiting for stdin, we now yield in
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * order to reduce the CPU load due to busy waiting. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (waitRes.mResult == ProcessWaitResult_WaitFlagNotSupported)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (mSourceSize) /* If we have nothing to write, take a shortcut. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /** @todo Not very efficient, but works for now. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = RTFileSeek(*pFile, mSourceOffset + cbWrittenTotal,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Some other error occured? There might be a chance that RTFileRead
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * could not resolve/map the native error code to an IPRT code, so just
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * print a generic error.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Could not read from file \"%s\" (%Rrc)"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Seeking file \"%s\" offset %RU64 failed: %Rrc"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Did we reach the end of the content we want to transfer (last chunk)? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Did we reach the last block which is exactly _64K? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* ... or does the user want to cancel? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync || ( SUCCEEDED(mProgress->COMGETTER(Canceled(&fCanceled)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Writing to file \"%s\" (offset %RU64) failed: %Rrc"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync LogFlowThisFunc(("cbWritten=%RU32, cbToRead=%RU64, cbWrittenTotal=%RU64, cbFileSize=%RU64\n",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync cbWritten, cbToRead - cbWritten, cbWrittenTotal + cbWritten, mSourceSize));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Only subtract bytes reported written by the guest. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Update total bytes written to the guest. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Did the user cancel the operation above? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Update the progress.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Watch out for division by zero. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync ? rc = setProgress((ULONG)(cbWrittenTotal * 100 / mSourceSize))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* End of file reached? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync } /* for */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Even if we succeeded until here make sure to check whether we really transfered
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * everything.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* If nothing was transfered but the file size was > 0 then "vbox_cat" wasn't able to write
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * to the destination -> access denied. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Access denied when copying file \"%s\" to \"%s\""),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* If we did not copy all let the user know. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Copying file \"%s\" failed (%RU64/%RU64 bytes transfered)"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = pProcess->waitFor(ProcessWaitForFlag_Terminate,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Waiting on termination for copying file \"%s\" failed: %Rrc"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Waiting on termination for copying file \"%s\" failed with wait result %ld"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ( ( SUCCEEDED(pProcess->COMGETTER(Status(&procStatus)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync || ( SUCCEEDED(pProcess->COMGETTER(ExitCode(&exitCode)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Copying file \"%s\" failed with status %ld, exit code %ld"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync mSource.c_str(), procStatus, exitCode)); /**@todo Add stringify methods! */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync } /* processCreateExInteral */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (!mSourceFile) /* Only close locally opened files. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncint SessionTaskCopyTo::RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync LogFlowThisFunc(("strDesc=%s, strSource=%s, strDest=%s, mCopyFileFlags=%x\n",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync strDesc.c_str(), mSource.c_str(), mDest.c_str(), mCopyFileFlags));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync int rc = RTThreadCreate(NULL, SessionTaskCopyTo::taskThread, this,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "gctlCpyTo");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* static */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncint SessionTaskCopyTo::taskThread(RTTHREAD Thread, void *pvUser)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync std::auto_ptr<SessionTaskCopyTo> task(static_cast<SessionTaskCopyTo*>(pvUser));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncSessionTaskCopyFrom::SessionTaskCopyFrom(GuestSession *pSession,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Note: There will be races between querying file size + reading the guest file's
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * content because we currently *do not* lock down the guest file when doing the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * actual operations.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync ** @todo Implement guest file locking!
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync int rc = pSession->fileQueryInfoInternal(Utf8Str(mSource), objData);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Querying guest file information for \"%s\" failed: %Rrc"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync else if (objData.mType != FsObjType_File) /* Only single files are supported at the moment. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Object \"%s\" on the guest is not a file"), mSource.c_str()));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync RTFILE_O_WRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_DENY_WRITE); /** @todo Use the correct open modes! */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Error opening destination file \"%s\": %Rrc"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync procInfo.mName = Utf8StrFmt(GuestSession::tr("Copying file \"%s\" from guest to the host to \"%s\" (%RI64 bytes)"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync mSource.c_str(), mDest.c_str(), objData.mObjectSize);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync procInfo.mFlags = ProcessCreateFlag_Hidden | ProcessCreateFlag_WaitForStdOut;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Set arguments.*/
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync procInfo.mArguments.push_back(mSource); /* Which file to output? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Startup process. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = pSession->processCreateExInteral(procInfo, pProcess);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Unable to start guest process for copying data from guest to host: %Rrc"), rc));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync || waitRes.mResult == ProcessWaitResult_WaitFlagNotSupported)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* If the guest does not support waiting for stdin, we now yield in
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * order to reduce the CPU load due to busy waiting. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (waitRes.mResult == ProcessWaitResult_WaitFlagNotSupported)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = pProcess->readData(OUTPUT_HANDLE_ID_STDOUT, sizeof(byBuf),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Reading from file \"%s\" (offset %RU64) failed: %Rrc"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = RTFileWrite(fileDest, byBuf, cbRead, NULL /* No partial writes */);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Error writing to file \"%s\" (%RU64 bytes left): %Rrc"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Only subtract bytes reported written by the guest. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Update total bytes written to the guest. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Assert(cbWrittenTotal <= (uint64_t)objData.mObjectSize);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Did the user cancel the operation above? */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ( SUCCEEDED(mProgress->COMGETTER(Canceled(&fCanceled)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = setProgress((ULONG)(cbWrittenTotal / ((uint64_t)objData.mObjectSize / 100.0)));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync } /* for */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync LogFlowThisFunc(("rc=%Rrc, cbWrittenTotal=%RU64, cbSize=%RI64, cbToRead=%RU64\n",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc, cbWrittenTotal, objData.mObjectSize, cbToRead));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Even if we succeeded until here make sure to check whether we really transfered
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * everything.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* If nothing was transfered but the file size was > 0 then "vbox_cat" wasn't able to write
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * to the destination -> access denied. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Access denied when copying file \"%s\" to \"%s\""),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync else if (cbWrittenTotal < (uint64_t)objData.mObjectSize)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* If we did not copy all let the user know. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Copying file \"%s\" failed (%RU64/%RI64 bytes transfered)"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync mSource.c_str(), cbWrittenTotal, objData.mObjectSize));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ( ( SUCCEEDED(pProcess->COMGETTER(Status(&procStatus)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync || ( SUCCEEDED(pProcess->COMGETTER(ExitCode(&exitCode)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Copying file \"%s\" failed with status %ld, exit code %d"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync mSource.c_str(), procStatus, exitCode)); /**@todo Add stringify methods! */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync else /* Yay, success! */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncint SessionTaskCopyFrom::RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync LogFlowThisFunc(("strDesc=%s, strSource=%s, strDest=%s, uFlags=%x\n",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync strDesc.c_str(), mSource.c_str(), mDest.c_str(), mFlags));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync int rc = RTThreadCreate(NULL, SessionTaskCopyFrom::taskThread, this,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "gctlCpyFrom");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* static */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncint SessionTaskCopyFrom::taskThread(RTTHREAD Thread, void *pvUser)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync std::auto_ptr<SessionTaskCopyFrom> task(static_cast<SessionTaskCopyFrom*>(pvUser));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncSessionTaskUpdateAdditions::SessionTaskUpdateAdditions(GuestSession *pSession,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncSessionTaskUpdateAdditions::~SessionTaskUpdateAdditions(void)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncint SessionTaskUpdateAdditions::copyFileToGuest(GuestSession *pSession, PRTISOFSFILE pISO,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8Str const &strFileSource, const Utf8Str &strFileDest,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* pcbSize is optional. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync int rc = RTIsoFsGetFileInfo(pISO, strFileSource.c_str(), &cbOffset, &cbSize);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = RTFileSeek(pISO->file, cbOffset, RTFILE_SEEK_BEGIN, NULL);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Copy over the Guest Additions file to the guest. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync LogFlowThisFunc(("Copying Guest Additions installer file \"%s\" to \"%s\" on guest ...\n",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync SessionTaskCopyTo *pTask = new SessionTaskCopyTo(pSession /* GuestSession */,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = pSession->startTaskAsync(Utf8StrFmt(GuestSession::tr("Copying Guest Additions installer file \"%s\" to \"%s\" on guest"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync HRESULT hr = pProgressCopyTo->WaitForCompletion(-1);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ( SUCCEEDED(pProgressCopyTo->COMGETTER(Canceled)(&fCanceled))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /** @todo Note: Since there is no file locking involved at the moment, there can be modifications
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * between finished copying, the verification and the actual execution. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* Determine where the installer image ended up and if it has the correct size. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync LogFlowThisFunc(("Verifying Guest Additions installer file \"%s\" ...\n",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = pSession->fileQuerySizeInternal(strFileDest, &cbSizeOnGuest);
ffb50166c9adb4ae583b914d405197035cf890advboxsync LogFlowThisFunc(("Guest Additions installer file \"%s\" successfully verified\n",
ffb50166c9adb4ae583b914d405197035cf890advboxsync LogFlowThisFunc(("Size of Guest Additions installer file \"%s\" does not match: %RI64bytes copied, %RU64bytes expected\n",
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync rc = VERR_BROKEN_PIPE; /** @todo Find a better error. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync LogFlowThisFunc(("Error copying Guest Additions installer file \"%s\": %Rrc\n",
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsyncint SessionTaskUpdateAdditions::runFileOnGuest(GuestSession *pSession, GuestProcessStartupInfo &procInfo)
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync int rc = pSession->processCreateExInteral(procInfo, pProcess);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync LogRel(("Running %s ...\n", procInfo.mName.c_str()));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = pProcess->waitFor(ProcessWaitForFlag_Terminate,
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync LogFlowThisFunc(("waitFor rc=%Rrc, waitRes=%ld\n", rc, waitRes));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (waitRes.mResult == ProcessWaitResult_Terminate)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if ( ( SUCCEEDED(pProcess->COMGETTER(Status(&procStatus)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync || ( SUCCEEDED(pProcess->COMGETTER(ExitCode(&exitCode)))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Running %s failed with status %ld, exit code %ld"),
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync else /* Yay, success! */
ffb50166c9adb4ae583b914d405197035cf890advboxsync LogFlowThisFunc(("%s successfully completed\n", procInfo.mName.c_str()));
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync /** @todo Unify error handling. */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Error while waiting running %s: %Rrc"),
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync Utf8StrFmt(GuestSession::tr("Running %s returned unexpectedly with status %ld"),
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync setProgressErrorMsg(VBOX_E_IPRT_ERROR, pProcess->errorMsg());
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync LogRel(("Automatic update of Guest Additions started, using \"%s\"\n", mSource.c_str()));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * Wait for the guest being ready within 30 seconds.
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync while ( SUCCEEDED(hr = pGuest->COMGETTER(AdditionsRunLevel)(&addsRunLevel))
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync && ( addsRunLevel != AdditionsRunLevelType_Userland
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync Utf8StrFmt(GuestSession::tr("Guest Additions were not ready within time, giving up")));
0dd3967035b8a02985920baa57f948dc542b9388vboxsync * For use with the GUI we don't want to wait, just return so that the manual .ISO mounting
0dd3967035b8a02985920baa57f948dc542b9388vboxsync * can continue.
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync if ( FAILED(hr = pGuest->COMGETTER(AdditionsRunLevel)(&addsRunLevel))
0dd3967035b8a02985920baa57f948dc542b9388vboxsync || ( addsRunLevel != AdditionsRunLevelType_Userland
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync Utf8StrFmt(GuestSession::tr("Guest Additions are installed but not fully loaded yet, aborting automatic update")));
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync Utf8StrFmt(GuestSession::tr("Guest Additions not installed or ready, aborting automatic update")));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * Determine if we are able to update automatically. This only works
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * if there are recent Guest Additions installed already.
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync rc = getGuestProperty(pGuest, "/VirtualBox/GuestAdd/Version", strAddsVer);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync && RTStrVersionCompare(strAddsVer.c_str(), "4.1") < 0)
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync Utf8StrFmt(GuestSession::tr("Guest has too old Guest Additions (%s) installed for automatic updating, please update manually"),
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * Determine guest OS type and the required installer image.
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync rc = getGuestProperty(pGuest, "/VirtualBox/GuestInfo/OS/Product", strOSType);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync if ( strOSType.contains("Microsoft", Utf8Str::CaseInsensitive)
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync || strOSType.contains("Windows", Utf8Str::CaseInsensitive))
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync * Determine guest OS version.
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync rc = getGuestProperty(pGuest, "/VirtualBox/GuestInfo/OS/Release", strOSVer);
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync Utf8StrFmt(GuestSession::tr("Unable to detected guest OS version, please update manually")));
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync /* Because Windows 2000 + XP and is bitching with WHQL popups even if we have signed drivers we
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync * can't do automated updates here. */
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync && ( strOSVer.contains("5.0") /* Exclude the build number. */
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync || strOSVer.contains("5.1")) /* Exclude the build number. */
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync Utf8StrFmt(GuestSession::tr("Windows 2000 and XP are not supported for automatic updating due to WHQL popups, please update manually")));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync else if (strOSType.contains("Solaris", Utf8Str::CaseInsensitive))
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync else /* Everything else hopefully means Linux :-). */
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync#if 1 /* Only Windows is supported (and tested) at the moment. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync Utf8StrFmt(GuestSession::tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"),
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync * Try to open the .ISO file to extract all needed files.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync Utf8StrFmt(GuestSession::tr("Unable to open Guest Additions .ISO file \"%s\": %Rrc"),
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync /* Set default installation directories. */
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync /* Try looking up the Guest Additions installation directory. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Try getting the installed Guest Additions version to know whether we
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * can install our temporary Guest Addition data into the original installation
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * directory.
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * Because versions prior to 4.2 had bugs wrt spaces in paths we have to choose
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * a different location then.
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync rc = getGuestProperty(pGuest, "/VirtualBox/GuestAdd/Version", strAddsVer);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync && RTStrVersionCompare(strAddsVer.c_str(), "4.2") >= 0)
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync rc = getGuestProperty(pGuest, "/VirtualBox/GuestAdd/InstallDir", strUpdateDir);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync LogRel(("Guest Additions update directory is: %s\n",
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* Create the installation directory. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync rc = pSession->directoryCreateInternal(strUpdateDir,
ffb50166c9adb4ae583b914d405197035cf890advboxsync Utf8StrFmt(GuestSession::tr("Error creating installation directory \"%s\" on the guest: %Rrc"),
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* Prepare the file(s) we want to copy over to the guest and
ffb50166c9adb4ae583b914d405197035cf890advboxsync * (maybe) want to run. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Do we need to install our certificates? We do this for W2K and up. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync bool fInstallCert = false;
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync /* Only Windows 2000 and up need certificates to be installed. */
f75c6db919d277952ca03b7acf643e5e3ac96cafvboxsync if (RTStrVersionCompare(strOSVer.c_str(), "5.0") >= 0)
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync LogRel(("Certificates for auto updating WHQL drivers will be installed\n"));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync LogRel(("Skipping installation of certificates for WHQL drivers\n"));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Our certificate. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync mFiles.push_back(InstallerFile("CERT/ORACLE_VBOX.CER",
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync UPDATEFILE_FLAG_COPY_FROM_ISO | UPDATEFILE_FLAG_OPTIONAL));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Our certificate installation utility. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* First pass: Copy over the file + execute it to remove any existing
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * VBox certificates. */
0dd3967035b8a02985920baa57f948dc542b9388vboxsync siCertUtilRem.mName = "VirtualBox Certificate Utility, removing old VirtualBox certificates";
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync siCertUtilRem.mArguments.push_back(Utf8Str("remove-trusted-publisher"));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync siCertUtilRem.mArguments.push_back(Utf8Str("--root")); /* Add root certificate as well. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync siCertUtilRem.mArguments.push_back(Utf8Str(strUpdateDir + "oracle-vbox.cer"));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync siCertUtilRem.mArguments.push_back(Utf8Str(strUpdateDir + "oracle-vbox.cer"));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync mFiles.push_back(InstallerFile("CERT/VBOXCERTUTIL.EXE",
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync UPDATEFILE_FLAG_COPY_FROM_ISO | UPDATEFILE_FLAG_EXECUTE | UPDATEFILE_FLAG_OPTIONAL,
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Second pass: Only execute (but don't copy) again, this time installng the
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * recent certificates just copied over. */
0dd3967035b8a02985920baa57f948dc542b9388vboxsync siCertUtilAdd.mName = "VirtualBox Certificate Utility, installing VirtualBox certificates";
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync siCertUtilAdd.mArguments.push_back(Utf8Str("add-trusted-publisher"));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync siCertUtilAdd.mArguments.push_back(Utf8Str("--root")); /* Add root certificate as well. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync siCertUtilAdd.mArguments.push_back(Utf8Str(strUpdateDir + "oracle-vbox.cer"));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync siCertUtilAdd.mArguments.push_back(Utf8Str(strUpdateDir + "oracle-vbox.cer"));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync mFiles.push_back(InstallerFile("CERT/VBOXCERTUTIL.EXE",
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync UPDATEFILE_FLAG_EXECUTE | UPDATEFILE_FLAG_OPTIONAL,
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* The installers in different flavors, as we don't know (and can't assume)
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync * the guest's bitness. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync mFiles.push_back(InstallerFile("VBOXWINDOWSADDITIONS_X86.EXE",
ffb50166c9adb4ae583b914d405197035cf890advboxsync mFiles.push_back(InstallerFile("VBOXWINDOWSADDITIONS_AMD64.EXE",
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* The stub loader which decides which flavor to run. */
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync siInstaller.mName = "VirtualBox Windows Guest Additions Installer";
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync /* Set a running timeout of 5 minutes -- the Windows Guest Additions
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync * setup can take quite a while, so be on the safe side. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync siInstaller.mArguments.push_back(Utf8Str("/S")); /* We want to install in silent mode. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync siInstaller.mArguments.push_back(Utf8Str("/l")); /* ... and logging enabled. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* Don't quit VBoxService during upgrade because it still is used for this
ffb50166c9adb4ae583b914d405197035cf890advboxsync * piece of code we're in right now (that is, here!) ... */
ffb50166c9adb4ae583b914d405197035cf890advboxsync siInstaller.mArguments.push_back(Utf8Str("/no_vboxservice_exit"));
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* Tell the installer to report its current installation status
ffb50166c9adb4ae583b914d405197035cf890advboxsync * using a running VBoxTray instance via balloon messages in the
ffb50166c9adb4ae583b914d405197035cf890advboxsync * Windows taskbar. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync siInstaller.mArguments.push_back(Utf8Str("/post_installstatus"));
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* If the caller does not want to wait for out guest update process to end,
ffb50166c9adb4ae583b914d405197035cf890advboxsync * complete the progress object now so that the caller can do other work. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync if (mFlags & AdditionsUpdateFlag_WaitForUpdateStartOnly)
ffb50166c9adb4ae583b914d405197035cf890advboxsync siInstaller.mFlags |= ProcessCreateFlag_WaitForProcessStartOnly;
ffb50166c9adb4ae583b914d405197035cf890advboxsync mFiles.push_back(InstallerFile("VBOXWINDOWSADDITIONS.EXE",
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync UPDATEFILE_FLAG_COPY_FROM_ISO | UPDATEFILE_FLAG_EXECUTE, siInstaller));
ffb50166c9adb4ae583b914d405197035cf890advboxsync /** @todo Add Linux support. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync /** @todo Add Solaris support. */
3c6306a66deef467e3c13483dd6529e1e1c6b822vboxsync AssertReleaseMsgFailed(("Unsupported guest type: %d\n", osType));
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* We want to spend 40% total for all copying operations. So roughly
ffb50166c9adb4ae583b914d405197035cf890advboxsync * calculate the specific percentage step of each copied file. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync LogRel(("Copying over Guest Additions update files to the guest ...\n"));
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync std::vector<InstallerFile>::const_iterator itFiles = mFiles.begin();
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync if (itFiles->fFlags & UPDATEFILE_FLAG_COPY_FROM_ISO)
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync bool fOptional = false;
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync rc = copyFileToGuest(pSession, &iso, itFiles->strSource, itFiles->strDest,
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync Utf8StrFmt(GuestSession::tr("Error while copying file \"%s\" to \"%s\" on the guest: %Rrc"),
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync itFiles->strSource.c_str(), itFiles->strDest.c_str(), rc));
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync /* Done copying, close .ISO file. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync /* We want to spend 35% total for all copying operations. So roughly
ffb50166c9adb4ae583b914d405197035cf890advboxsync * calculate the specific percentage step of each copied file. */
ffb50166c9adb4ae583b914d405197035cf890advboxsync LogRel(("Executing Guest Additions update files ...\n"));
750df3fe104e01cadbc3d5bd20243055d283d4e5vboxsync std::vector<InstallerFile>::iterator itFiles = mFiles.begin();
ffb50166c9adb4ae583b914d405197035cf890advboxsync LogRel(("Automatic update of Guest Additions succeeded\n"));
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync LogRel(("Automatic update of Guest Additions was canceled\n"));
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync Utf8StrFmt(GuestSession::tr("Installation was canceled")));
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync Utf8Str strError = Utf8StrFmt("No further error information available (%Rrc)", rc);
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync if (!mProgress.isNull()) /* Progress object is optional. */
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync hr = mProgress->COMGETTER(ErrorInfo)(pError.asOutParam());
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync LogRel(("Automatic update of Guest Additions failed: %s\n", strError.c_str()));
6475559a7e0e52892efbab4fbdedc879f6866109vboxsync LogRel(("Please install Guest Additions manually\n"));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncint SessionTaskUpdateAdditions::RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync LogFlowThisFunc(("strDesc=%s, strSource=%s, uFlags=%x\n",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync int rc = RTThreadCreate(NULL, SessionTaskUpdateAdditions::taskThread, this,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "gctlUpGA");
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync/* static */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsyncint SessionTaskUpdateAdditions::taskThread(RTTHREAD Thread, void *pvUser)