ExtPackManagerImpl.cpp revision 94e055188526aeeb119b5d60fe22bf7a302522dc
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync * VirtualBox Main - interface for Extension Packs, VBoxSVC & VBoxC.
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync * Copyright (C) 2010 Oracle Corporation
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync * available from http://www.virtualbox.org. This file is free software;
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync * you can redistribute it and/or modify it under the terms of the GNU
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync * General Public License (GPL) as published by the Free Software
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync/*******************************************************************************
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync* Header Files *
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync*******************************************************************************/
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync/*******************************************************************************
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync* Defined Constants And Macros *
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync*******************************************************************************/
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync/** @name VBOX_EXTPACK_HELPER_NAME
abb8db470ca7995be6e7acfab968a7d595263cfavboxsync * The name of the utility application we employ to install and uninstall the
struct ExtPackBaseData
bool fUsable;
bool fMadeReadyCall;
m = NULL;
return S_OK;
m->fUsable = false;
return S_OK;
uninit();
m = NULL;
return hrc;
return hrc;
return hrc;
return hrc;
return hrc;
#ifdef VBOX_WITH_XPCOM
return hrc;
return hrc;
return hrc;
return E_NOTIMPL;
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;
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();
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*/, szErr, sizeof(szErr));
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;
if ( m->pReg
if (pvUnknown)
return hrc;
m = NULL;
return S_OK;
HRESULT ExtPackManager::init(VirtualBox *a_pVirtualBox, const char *a_pszDropZoneDir, bool a_fCheckDropZone,
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 E_NOTIMPL;
if (pStrName)
NULL);
delete pStrName;
return hrc;
if (!pExtPack)
LogRel(("ExtPackManager: Extension pack '%s' is not installed, so nothing to uninstall.\n", strName.c_str()));
NULL);
if (!pExtPack)
return hrc;
NULL);
return hrc;
STDMETHODIMP ExtPackManager::QueryAllPlugInsForFrontend(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules))
return hrc;
unsigned cArgs = 0;
const char *pszLastArg;
&hProcess);
if (pvNew)
&ProcStatus);
if (offStdErrBuf > 0)
if ( offStdErrBuf > 0
offStdErrBuf = 0;
&& offStdErrBuf == 0)
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_fUnsuableIsError, 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;
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;