ExtPackManagerImpl.cpp revision c7a378ed2fbad681c0b674351d698ef20a368935
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * VirtualBox Main - interface for Extension Packs, VBoxSVC & VBoxC.
1633838b8255282d10af15c5c84cee5a51466712Bob Halley * Copyright (C) 2010 Oracle Corporation
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * This file is part of VirtualBox Open Source Edition (OSE), as
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * available from http://www.virtualbox.org. This file is free software;
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * you can redistribute it and/or modify it under the terms of the GNU
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * General Public License (GPL) as published by the Free Software
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * Foundation, in version 2 as it comes in the "COPYING" file of the
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*******************************************************************************
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein* Header Files *
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence*******************************************************************************/
df0f58959ed82a2a43ca8d816ce9592541df9f2fMark Andrews/*******************************************************************************
df0f58959ed82a2a43ca8d816ce9592541df9f2fMark Andrews* Defined Constants And Macros *
df0f58959ed82a2a43ca8d816ce9592541df9f2fMark Andrews*******************************************************************************/
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/** @name VBOX_EXTPACK_HELPER_NAME
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley * The name of the utility application we employ to install and uninstall the
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley * extension packs. This is a set-uid-to-root binary on unixy platforms, which
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley * is why it has to be a separate application.
27809a2ee5db141b684e53bf1d94da26e9f92d3aMark Andrews#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
afdb3abb9b06ed4070ac9021f1f4427b4cb3a286Bob Halley# define VBOX_EXTPACK_HELPER_NAME "VBoxExtPackHelperApp.exe"
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews# define VBOX_EXTPACK_HELPER_NAME "VBoxExtPackHelperApp"
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews/*******************************************************************************
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews* Structures and Typedefs *
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews*******************************************************************************/
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews /** The extension pack descriptor (loaded from the XML, mostly). */
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews /** The file system object info of the XML file.
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews * This is for detecting changes and save time in refresh(). */
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews /** Whether it's usable or not. */
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews /** Why it is unusable. */
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews * Private extension pack data.
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrewsstruct ExtPackFile::Data : public ExtPackBaseData
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence /** The path to the tarball. */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** The file handle of the extension pack file. */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** Our manifest for the tarball. */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** Pointer to the extension pack manager. */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** Pointer to the VirtualBox object so we can create a progress object. */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley * Private extension pack data.
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** Where the extension pack is located. */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** The file system object info of the extension pack directory.
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley * This is for detecting changes and save time in refresh(). */
27809a2ee5db141b684e53bf1d94da26e9f92d3aMark Andrews /** The full path to the main module. */
afdb3abb9b06ed4070ac9021f1f4427b4cb3a286Bob Halley /** The file system object info of the main module.
585529aaeb95a71cd3d95df2602a4688fc7c3292David Lawrence * This is used to determin whether to bother try reload it. */
585529aaeb95a71cd3d95df2602a4688fc7c3292David Lawrence /** The module handle of the main extension pack module. */
585529aaeb95a71cd3d95df2602a4688fc7c3292David Lawrence /** The helper callbacks for the extension pack. */
585529aaeb95a71cd3d95df2602a4688fc7c3292David Lawrence /** Pointer back to the extension pack object (for Hlp methods). */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** The extension pack registration structure. */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** The current context. */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** Set if we've made the pfnVirtualBoxReady or pfnConsoleReady call. */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley/** List of extension packs. */
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrencetypedef std::list< ComObjPtr<ExtPack> > ExtPackList;
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley * Private extension pack manager data.
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** The directory where the extension packs are installed. */
4d6964d70a114b53a11a3bd778d9b8f5179a7934Bob Halley /** The directory where the certificates this installation recognizes are
afdb3abb9b06ed4070ac9021f1f4427b4cb3a286Bob Halley * stored. */
4b87939256ede703385e9cab92d3c58d03c31098Mark Andrews /** The list of installed extension packs. */
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley /** Pointer to the VirtualBox object, our parent. */
94e25967cda41b886e33ec254b917d21df21a187Bob Halley /** The current context. */
4b87939256ede703385e9cab92d3c58d03c31098Mark Andrews#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_DARWIN)
94e25967cda41b886e33ec254b917d21df21a187Bob Halley /** File handle for the VBoxVMM libary which we slurp because ExtPacks depend on it. */
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * Extension pack installation job.
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews /** Smart pointer to the extension pack file. */
df0f58959ed82a2a43ca8d816ce9592541df9f2fMark Andrews /** The replace argument. */
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence /** The display info argument. */
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence /** Smart pointer to the extension manager. */
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence /** Smart pointer to the progress object for this job. */
5eb91bd90e3ad3426e5e3213031556a737cf3809Mark Andrews/** Pointer to an extension pack installation job. */
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrencetypedef EXTPACKINSTALLJOB *PEXTPACKINSTALLJOB;
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * Extension pack uninstallation job.
94e25967cda41b886e33ec254b917d21df21a187Bob Halley /** Smart pointer to the extension manager. */
26f327f1f53afdb8256affa1c197ed138bf3cb2fAndreas Gustafsson /** The name of the extension pack. */
4b87939256ede703385e9cab92d3c58d03c31098Mark Andrews /** The replace argument. */
afdb3abb9b06ed4070ac9021f1f4427b4cb3a286Bob Halley /** The display info argument. */
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence /** Smart pointer to the progress object for this job. */
4b87939256ede703385e9cab92d3c58d03c31098Mark Andrews/** Pointer to an extension pack uninstallation job. */
4b87939256ede703385e9cab92d3c58d03c31098Mark Andrewstypedef EXTPACKUNINSTALLJOB *PEXTPACKUNINSTALLJOB;
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * Called by ComObjPtr::createObject when creating the object.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * Just initialize the basic object state, do the rest in initWithDir().
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * @returns S_OK.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * Initializes the extension pack by reading its file.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * @returns COM status code.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * @param a_pszFile The path to the extension pack file.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * @param a_pExtPackMgr Pointer to the extension pack manager.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * @param a_pVirtualBox Pointer to the VirtualBox object.
6fa1cb5754695d550a58c6e8978fda65f5146af7David LawrenceHRESULT ExtPackFile::initWithFile(const char *a_pszFile, ExtPackManager *a_pExtPackMgr, VirtualBox *a_pVirtualBox)
9e8947d9e606b967d0792d0ab1ee7afac5e5f39dMark Andrews * Allocate + initialize our private data.
bf6d2e39124ab3d51c253f7acad9a4abef059be6Bob Halley iprt::MiniString *pstrTarName = VBoxExtPackExtractNameFromTarballPath(a_pszFile);
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * Try open the extension pack and check that it is a regular file.
26f327f1f53afdb8256affa1c197ed138bf3cb2fAndreas Gustafsson int vrc = RTFileOpen(&m->hExtPackFile, a_pszFile,
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN);
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence if (vrc == VERR_FILE_NOT_FOUND || vrc == VERR_PATH_NOT_FOUND)
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence return initFailed(tr("'%s' file not found"), a_pszFile);
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence return initFailed(tr("RTFileOpen('%s',,) failed with %Rrc"), a_pszFile, vrc);
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence vrc = RTFileQueryInfo(m->hExtPackFile, &ObjInfo, RTFSOBJATTRADD_UNIX);
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence return initFailed(tr("RTFileQueryInfo failed with %Rrc on '%s'"), vrc, a_pszFile);
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley return initFailed(tr("Not a regular file: %s"), a_pszFile);
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley * Validate the tarball and extract the XML file.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence vrc = VBoxExtPackValidateTarball(m->hExtPackFile, NULL /*pszExtPackName*/, a_pszFile,
94e25967cda41b886e33ec254b917d21df21a187Bob Halley szError, sizeof(szError), &m->hOurManifest, &hXmlFile);
26f327f1f53afdb8256affa1c197ed138bf3cb2fAndreas Gustafsson * Parse the XML.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence iprt::MiniString strSavedName(m->Desc.strName);
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence iprt::MiniString *pStrLoadErr = VBoxExtPackLoadDescFromVfsFile(hXmlFile, &m->Desc, &m->ObjInfoDesc);
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence m->strWhyUnusable.printf(tr("Failed to the xml file: %s"), pStrLoadErr->c_str());
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley * Match the tarball name with the name from the XML.
94e25967cda41b886e33ec254b917d21df21a187Bob Halley /** @todo drop this restriction after the old install interface is
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * dropped. */
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence if (!strSavedName.equalsIgnoreCase(m->Desc.strName))
94e25967cda41b886e33ec254b917d21df21a187Bob Halley return initFailed(tr("Extension pack name mismatch between the downloaded file and the XML inside it (xml='%s' file='%s')"),
4ad9b25e6ddf948ffb3b8198c5540d251f26c52eDavid Lawrence m->Desc.strName.c_str(), strSavedName.c_str());
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * Protected helper that formats the strWhyUnusable value.
4ad9b25e6ddf948ffb3b8198c5540d251f26c52eDavid Lawrence * @returns S_OK
4ad9b25e6ddf948ffb3b8198c5540d251f26c52eDavid Lawrence * @param a_pszWhyFmt Why it failed, format string.
4ad9b25e6ddf948ffb3b8198c5540d251f26c52eDavid Lawrence * @param ... The format arguments.
4ad9b25e6ddf948ffb3b8198c5540d251f26c52eDavid LawrenceHRESULT ExtPackFile::initFailed(const char *a_pszWhyFmt, ...)
26f327f1f53afdb8256affa1c197ed138bf3cb2fAndreas Gustafsson * Do the actual cleanup.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence /* Enclose the state transition Ready->InUninit->NotReady */
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence if (!autoUninitSpan.uninitDone() && m != NULL)
6fa1cb5754695d550a58c6e8978fda65f5146af7David LawrenceSTDMETHODIMP ExtPackFile::COMGETTER(Name)(BSTR *a_pbstrName)
6fa1cb5754695d550a58c6e8978fda65f5146af7David LawrenceSTDMETHODIMP ExtPackFile::COMGETTER(Description)(BSTR *a_pbstrDescription)
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence CheckComArgOutPointerValid(a_pbstrDescription);
c8563aaf86c04f0e2284bcc8e444a0651c157ea0Andreas GustafssonSTDMETHODIMP ExtPackFile::COMGETTER(Version)(BSTR *a_pbstrVersion)
c8563aaf86c04f0e2284bcc8e444a0651c157ea0Andreas Gustafsson CheckComArgOutPointerValid(a_pbstrVersion);
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark AndrewsSTDMETHODIMP ExtPackFile::COMGETTER(Revision)(ULONG *a_puRevision)
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark AndrewsSTDMETHODIMP ExtPackFile::COMGETTER(VRDEModule)(BSTR *a_pbstrVrdeModule)
903247531a10d699ef239a7351554ba0a1e3cd22Evan HuntSTDMETHODIMP ExtPackFile::COMGETTER(PlugIns)(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns))
903247531a10d699ef239a7351554ba0a1e3cd22Evan Hunt /** @todo implement plug-ins. */
903247531a10d699ef239a7351554ba0a1e3cd22Evan HuntSTDMETHODIMP ExtPackFile::COMGETTER(Usable)(BOOL *a_pfUsable)
903247531a10d699ef239a7351554ba0a1e3cd22Evan HuntSTDMETHODIMP ExtPackFile::COMGETTER(WhyUnusable)(BSTR *a_pbstrWhy)
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark AndrewsSTDMETHODIMP ExtPackFile::COMGETTER(ShowLicense)(BOOL *a_pfShowIt)
STDMETHODIMP ExtPackFile::QueryLicense(IN_BSTR a_bstrPreferredLocale, IN_BSTR a_bstrPreferredLanguage, IN_BSTR a_bstrFormat,
return setError(E_FAIL, tr("The license format can only have the values 'html', 'rtf' and 'txt'."));
RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-%s.%s", strPreferredLocale.c_str(), strFormat.c_str());
RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-_%s.%s", strPreferredLocale.c_str(), strFormat.c_str());
if (!m->fUsable)
char *pszName;
if (pvFile)
szName);
return hrc;
return hrc;
STDMETHODIMP ExtPackFile::Install(BOOL a_fReplace, IN_BSTR a_bstrDisplayInfo, IProgress **a_ppProgress)
if (a_ppProgress)
if (m->fUsable)
#ifndef VBOX_COM_INPROC
m->pVirtualBox,
static_cast<IExtPackFile *>(this),
if (pJob)
delete pJob;
return hrc;
m = NULL;
return S_OK;
HRESULT ExtPack::initWithDir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName, const char *a_pszDir)
m = new Data;
m->fUsable = false;
m->pThis = this;
m->fMadeReadyCall = false;
probeAndLoad();
return S_OK;
uninit();
m = NULL;
bool ExtPack::callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock, PRTERRINFO pErrInfo)
if ( m != NULL
if ( m != NULL
if (!a_fForcedRemoval)
return hrc;
if ( m != NULL
&& m->fUsable
&& !m->fMadeReadyCall)
m->fMadeReadyCall = true;
if ( m != NULL
&& m->fUsable
&& !m->fMadeReadyCall)
m->fMadeReadyCall = true;
bool ExtPack::callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine, AutoWriteLock *a_pLock)
if ( m != NULL
&& m->fUsable)
bool ExtPack::callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc)
if ( m != NULL
&& m->fUsable)
bool ExtPack::callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc)
if ( m != NULL
&& m->fUsable)
if ( m != NULL
&& m->fUsable)
if ( m != NULL
&& m->fUsable)
hrc = setError(E_FAIL, tr("The extension pack '%s' does not include a VRDE module"), m->Desc.strName.c_str());
return hrc;
return hrc;
return m->fUsable
if (a_pfCanDelete)
*a_pfCanDelete = false;
int vrc = RTPathQueryInfoEx(m->strExtPackPath.c_str(), &ObjInfoExtPack, RTFSOBJATTRADD_UNIX, RTPATH_F_ON_LINK);
if (a_pfCanDelete)
*a_pfCanDelete = true;
return S_OK;
vrc = RTPathJoin(szDescFilePath, sizeof(szDescFilePath), m->strExtPackPath.c_str(), VBOX_EXTPACK_DESCRIPTION_NAME);
vrc = RTPathQueryInfoEx(m->strMainModPath.c_str(), &ObjInfoMainMod, RTFSOBJATTRADD_UNIX, RTPATH_F_ON_LINK);
if (m->fUsable)
probeAndLoad();
probeAndLoad();
return S_OK;
m->fUsable = false;
m->fMadeReadyCall = false;
int vrc = RTPathQueryInfoEx(m->strExtPackPath.c_str(), &m->ObjInfoExtPack, RTFSOBJATTRADD_UNIX, RTPATH_F_ON_LINK);
m->strWhyUnusable.printf(tr("RTPathQueryInfoEx on '%s' failed: %Rrc"), m->strExtPackPath.c_str(), vrc);
m->strWhyUnusable.printf(tr("'%s' is a symbolic link, this is not allowed"), m->strExtPackPath.c_str(), vrc);
m->strWhyUnusable.printf(tr("'%s' is a symbolic file, not a directory"), m->strExtPackPath.c_str(), vrc);
m->strWhyUnusable.printf(tr("'%s' is not a directory (fMode=%#x)"), m->strExtPackPath.c_str(), m->ObjInfoExtPack.Attr.fMode);
vrc = SUPR3HardenedVerifyDir(m->strExtPackPath.c_str(), true /*fRecursive*/, true /*fCheckFiles*/, &ErrInfo.Core);
iprt::MiniString *pStrLoadErr = VBoxExtPackLoadDesc(m->strExtPackPath.c_str(), &m->Desc, &m->ObjInfoDesc);
delete pStrLoadErr;
m->strWhyUnusable.printf(tr("The description name ('%s') and directory name ('%s') does not match"),
bool fIsNative;
m->strWhyUnusable.printf(tr("Failed to locate the main module ('%s')"), m->Desc.strMainModule.c_str());
if (fIsNative)
m->fUsable = true;
if (!a_pszExt)
const char *pszDefExt;
switch (a_enmKind)
AssertFailedReturn(false);
if (!a_pObjInfo)
if (a_pfNative)
*a_pfNative = true;
/* gcc.x86/module.rel */
if (!a_pszExt)
if (a_pfNative)
*a_pfNative = false;
/* x86/module.rel */
if (!a_pszExt)
if (a_pfNative)
*a_pfNative = false;
case RTFSOBJATTRADD_UNIX:
ExtPack::hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt, VBOXEXTPACKMODKIND enmKind,
AssertReturn(enmKind > VBOXEXTPACKMODKIND_INVALID && enmKind < VBOXEXTPACKMODKIND_END, VERR_INVALID_PARAMETER);
return VERR_FILE_NOT_FOUND;
ExtPack::hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath)
return vrc;
return VERR_NOT_IMPLEMENTED;
return hrc;
return hrc;
return hrc;
return hrc;
return hrc;
#ifdef VBOX_WITH_XPCOM
return hrc;
return hrc;
return hrc;
STDMETHODIMP ExtPack::QueryLicense(IN_BSTR a_bstrPreferredLocale, IN_BSTR a_bstrPreferredLanguage, IN_BSTR a_bstrFormat,
return setError(E_FAIL, tr("The license format can only have the values 'html', 'rtf' and 'txt'."));
RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-%s.%s", strPreferredLocale.c_str(), strFormat.c_str());
RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-_%s.%s", strPreferredLocale.c_str(), strFormat.c_str());
if (!m->fUsable)
void *pvFile;
hrc = setError(VBOX_E_IPRT_ERROR, tr("The license file '%s' is empty or contains invalid UTF-8 encoding"),
szPath);
hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("The license file '%s' was not found in extension pack '%s'"),
return hrc;
if ( m->pReg
if (pvUnknown)
return hrc;
m = NULL;
return S_OK;
m = new Data;
if (pstrName)
delete pstrName;
return hrc;
uninit();
m = NULL;
STDMETHODIMP ExtPackManager::COMGETTER(InstalledExtPacks)(ComSafeArrayOut(IExtPack *, a_paExtPacks))
return hrc;
return hrc;
return hrc;
STDMETHODIMP ExtPackManager::Uninstall(IN_BSTR a_bstrName, BOOL a_fForcedRemoval, IN_BSTR a_bstrDisplayInfo,
if (a_ppProgress)
#ifndef VBOX_COM_INPROC
m->pVirtualBox,
static_cast<IExtPackManager *>(this),
if (pJob)
delete pJob;
return hrc;
(const char *)NULL);
return hrc;
STDMETHODIMP ExtPackManager::QueryAllPlugInsForFrontend(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules))
return hrc;
return S_OK;
return NULL;
return NULL;
return pszInd;
HRESULT ExtPackManager::runSetUidToRootHelper(Utf8Str const *a_pstrDisplayInfo, const char *a_pszCommand, ...)
unsigned cArgs = 0;
if ( a_pstrDisplayInfo
const char *pszLastArg;
if (!pszLastArg)
&hProcess);
if (pvNew)
&ProcStatus);
if (offStdErrBuf > 0)
if (pszSuccessInd)
hrc = setError(VBOX_E_IPRT_ERROR, tr("Failed to launch the helper application '%s' (%Rrc)"), szExecName, vrc);
return hrc;
it++)
if ( pExtPackData
return (*it);
return NULL;
it++)
if ( pExtPackData
HRESULT ExtPackManager::refreshExtPack(const char *a_pszName, bool a_fUnusableIsError, ExtPack **a_ppExtPack)
if (pExtPack)
bool fCanDelete;
if (fCanDelete)
if (!fExists)
vrc = RTPathJoin(szDir, sizeof(szDir), m->strBaseDir.c_str(), Entry.szName); /* not really necessary */
fExists = true;
if (fExists)
&& pExtPack
if (a_ppExtPack)
return hrc;
HRESULT hrc = pJob->ptrExtPackMgr->doInstall(pJob->ptrExtPackFile, pJob->fReplace, &pJob->strDisplayInfo);
delete pJob;
return VINF_SUCCESS;
HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo)
else if (pExtPack)
(const char *)NULL);
(const char *)NULL);
return hrc;
HRESULT hrc = pJob->ptrExtPackMgr->doUninstall(&pJob->strName, pJob->fForcedRemoval, &pJob->strDisplayInfo);
delete pJob;
return VINF_SUCCESS;
HRESULT ExtPackManager::doUninstall(Utf8Str const *a_pstrName, bool a_fForcedRemoval, Utf8Str const *a_pstrDisplayInfo)
if (!pExtPack)
LogRel(("ExtPackManager: Extension pack '%s' is not installed, so nothing to uninstall.\n", a_pstrName->c_str()));
(const char *)NULL);
if (!pExtPack)
return hrc;
it++;
it++;
int vrc;
return vrc;
return VINF_SUCCESS;
int vrc;
return vrc;
return VINF_SUCCESS;
if (pExtPack)
hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("No extension pack by the name '%s' was found"), a_pstrExtPack->c_str());
return hrc;
int ExtPackManager::getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary)
if (pExtPack)
hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("No extension pack by the name '%s' was found"), a_pstrExtPack->c_str());
return hrc;
it++)
return hrc;