Index: /trunk/include/VBox/ExtPack/ExtPack.h
===================================================================
--- /trunk/include/VBox/ExtPack/ExtPack.h	(revision 52595)
+++ /trunk/include/VBox/ExtPack/ExtPack.h	(revision 52596)
@@ -4,5 +4,5 @@
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -150,6 +150,44 @@
     DECLR3CALLBACKMEMBER(VBOXEXTPACKCTX, pfnGetContext,(PCVBOXEXTPACKHLP pHlp));
 
+    /**
+     * Loads a HGCM service provided by an extension pack.
+     *
+     * @returns VBox status code.
+     * @param   pHlp            Pointer to this helper structure.
+     * @param   pConsole        Pointer to the VM's console object.
+     * @param   pszServiceLibrary Name of the library file containing the
+     *                          service implementation, without extension.
+     * @param   pszServiceName  Name of HGCM service.
+     */
     DECLR3CALLBACKMEMBER(int, pfnLoadHGCMService,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole,
                                                   const char *pszServiceLibrary, const char *pszServiceName));
+
+    /**
+     * Loads a VD plugin provided by an extension pack.
+     *
+     * This makes sense only in the context of the per-user service (VBoxSVC).
+     *
+     * @returns VBox status code.
+     * @param   pHlp            Pointer to this helper structure.
+     * @param   pVirtualBox     Pointer to the VirtualBox object.
+     * @param   pszPluginLibrary Name of the library file containing the plugin
+     *                          implementation, without extension.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnLoadVDPlugin,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox,
+                                               const char *pszPluginLibrary));
+
+    /**
+     * Unloads a VD plugin provided by an extension pack.
+     *
+     * This makes sense only in the context of the per-user service (VBoxSVC).
+     *
+     * @returns VBox status code.
+     * @param   pHlp            Pointer to this helper structure.
+     * @param   pVirtualBox     Pointer to the VirtualBox object.
+     * @param   pszPluginLibrary Name of the library file containing the plugin
+     *                          implementation, without extension.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnUnloadVDPlugin,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox,
+                                                 const char *pszPluginLibrary));
 
     DECLR3CALLBACKMEMBER(int, pfnReserved1,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
@@ -159,6 +197,4 @@
     DECLR3CALLBACKMEMBER(int, pfnReserved5,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
     DECLR3CALLBACKMEMBER(int, pfnReserved6,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
-    DECLR3CALLBACKMEMBER(int, pfnReserved7,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
-    DECLR3CALLBACKMEMBER(int, pfnReserved8,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
 
     /** End of structure marker (VBOXEXTPACKHLP_VERSION). */
@@ -166,5 +202,5 @@
 } VBOXEXTPACKHLP;
 /** Current version of the VBOXEXTPACKHLP structure.  */
-#define VBOXEXTPACKHLP_VERSION          RT_MAKE_U32(1, 1)
+#define VBOXEXTPACKHLP_VERSION          RT_MAKE_U32(2, 1)
 
 
Index: /trunk/src/VBox/Main/include/ExtPackManagerImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/ExtPackManagerImpl.h	(revision 52595)
+++ /trunk/src/VBox/Main/include/ExtPackManagerImpl.h	(revision 52596)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -135,4 +135,6 @@
     static DECLCALLBACK(VBOXEXTPACKCTX) i_hlpGetContext(PCVBOXEXTPACKHLP pHlp);
     static DECLCALLBACK(int)    i_hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole, const char *pszServiceLibrary, const char *pszServiceName);
+    static DECLCALLBACK(int)    i_hlpLoadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary);
+    static DECLCALLBACK(int)    i_hlpUnloadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary);
     static DECLCALLBACK(int)    i_hlpReservedN(PCVBOXEXTPACKHLP pHlp);
     /** @}  */
Index: /trunk/src/VBox/Main/include/SystemPropertiesImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/SystemPropertiesImpl.h	(revision 52595)
+++ /trunk/src/VBox/Main/include/SystemPropertiesImpl.h	(revision 52596)
@@ -53,6 +53,6 @@
     ComObjPtr<MediumFormat> i_mediumFormatFromExtension(const Utf8Str &aExt);
 
-    void i_extPackInstallNotify(const char *pszExtPackName);
-    void i_extPackUninstallNotify(const char *pszExtPackName);
+    int i_loadVDPlugin(const char *pszPluginLibrary);
+    int i_unloadVDPlugin(const char *pszPluginLibrary);
 
 private:
@@ -129,7 +129,4 @@
                                                ULONG *aMaxInstances);
 
-    HRESULT i_loadExtPackVDPluginCrypt();
-    HRESULT i_unloadExtPackVDPluginCrypt();
-
     HRESULT i_getUserHomeDirectory(Utf8Str &strPath);
     HRESULT i_setDefaultMachineFolder(const Utf8Str &strPath);
Index: /trunk/src/VBox/Main/include/VirtualBoxImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 52595)
+++ /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 52596)
@@ -128,6 +128,6 @@
     void i_updateClientWatcher();
 
-    void i_extPackInstallNotify(const char *pszExtPackName);
-    void i_extPackUninstallNotify(const char *pszExtPackName);
+    int i_loadVDPlugin(const char *pszPluginLibrary);
+    int i_unloadVDPlugin(const char *pszPluginLibrary);
 
     void i_onMachineStateChange(const Guid &aId, MachineState_T aState);
Index: /trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp	(revision 52595)
+++ /trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp	(revision 52596)
@@ -684,4 +684,6 @@
         /* pfnGetContext        = */ ExtPack::i_hlpGetContext,
         /* pfnLoadHGCMService   = */ ExtPack::i_hlpLoadHGCMService,
+        /* pfnLoadVDPlugin      = */ ExtPack::i_hlpLoadVDPlugin,
+        /* pfnUnloadVDPlugin    = */ ExtPack::i_hlpUnloadVDPlugin,
         /* pfnReserved1         = */ ExtPack::i_hlpReservedN,
         /* pfnReserved2         = */ ExtPack::i_hlpReservedN,
@@ -690,6 +692,4 @@
         /* pfnReserved5         = */ ExtPack::i_hlpReservedN,
         /* pfnReserved6         = */ ExtPack::i_hlpReservedN,
-        /* pfnReserved7         = */ ExtPack::i_hlpReservedN,
-        /* pfnReserved8         = */ ExtPack::i_hlpReservedN,
         /* u32EndMarker         = */ VBOXEXTPACKHLP_VERSION
     };
@@ -1560,4 +1560,54 @@
 #else
     NOREF(pHlp); NOREF(pConsole); NOREF(pszServiceLibrary); NOREF(pszServiceName);
+#endif
+    return VERR_INVALID_STATE;
+}
+
+/*static*/ DECLCALLBACK(int)
+ExtPack::i_hlpLoadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary)
+{
+#ifndef VBOX_COM_INPROC
+    /*
+     * Validate the input and get our bearings.
+     */
+    AssertPtrReturn(pszPluginLibrary, VERR_INVALID_POINTER);
+
+    AssertPtrReturn(pHlp, VERR_INVALID_POINTER);
+    AssertReturn(pHlp->u32Version == VBOXEXTPACKHLP_VERSION, VERR_INVALID_POINTER);
+    ExtPack::Data *m = RT_FROM_CPP_MEMBER(pHlp, Data, Hlp);
+    AssertPtrReturn(m, VERR_INVALID_POINTER);
+    ExtPack *pThis = m->pThis;
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pVirtualBox, VERR_INVALID_POINTER);
+
+    VirtualBox *pVBox = (VirtualBox *)pVirtualBox;
+    return pVBox->i_loadVDPlugin(pszPluginLibrary);
+#else
+    NOREF(pHlp); NOREF(pVirtualBox);
+#endif
+    return VERR_INVALID_STATE;
+}
+
+/*static*/ DECLCALLBACK(int)
+ExtPack::i_hlpUnloadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary)
+{
+#ifndef VBOX_COM_INPROC
+    /*
+     * Validate the input and get our bearings.
+     */
+    AssertPtrReturn(pszPluginLibrary, VERR_INVALID_POINTER);
+
+    AssertPtrReturn(pHlp, VERR_INVALID_POINTER);
+    AssertReturn(pHlp->u32Version == VBOXEXTPACKHLP_VERSION, VERR_INVALID_POINTER);
+    ExtPack::Data *m = RT_FROM_CPP_MEMBER(pHlp, Data, Hlp);
+    AssertPtrReturn(m, VERR_INVALID_POINTER);
+    ExtPack *pThis = m->pThis;
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pVirtualBox, VERR_INVALID_POINTER);
+
+    VirtualBox *pVBox = (VirtualBox *)pVirtualBox;
+    return pVBox->i_unloadVDPlugin(pszPluginLibrary);
+#else
+    NOREF(pHlp); NOREF(pVirtualBox);
 #endif
     return VERR_INVALID_STATE;
@@ -2530,8 +2580,5 @@
         {
             if (pExtPack && a_fReplace)
-            {
-                m->pVirtualBox->i_extPackUninstallNotify(pStrName->c_str());
                 hrc = pExtPack->i_callUninstallHookAndClose(m->pVirtualBox, false /*a_ForcedRemoval*/);
-            }
             else if (pExtPack)
                 hrc = setError(E_FAIL,
@@ -2565,8 +2612,5 @@
                     pExtPack->i_callInstalledHook(m->pVirtualBox, &autoLock, &ErrInfo.Core);
                     if (RT_SUCCESS(ErrInfo.Core.rc))
-                    {
                         LogRel(("ExtPackManager: Successfully installed extension pack '%s'.\n", pStrName->c_str()));
-                        m->pVirtualBox->i_extPackInstallNotify(pStrName->c_str());
-                    }
                     else
                     {
@@ -2671,5 +2715,4 @@
                  * Call the uninstall hook and unload the main dll.
                  */
-                m->pVirtualBox->i_extPackUninstallNotify(a_pstrName->c_str());
                 hrc = pExtPack->i_callUninstallHookAndClose(m->pVirtualBox, a_fForcedRemoval);
                 if (SUCCEEDED(hrc))
Index: /trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp	(revision 52595)
+++ /trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp	(revision 52596)
@@ -44,9 +44,4 @@
 /////////////////////////////////////////////////////////////////////////////
 
-// globals
-/////////////////////////////////////////////////////////////////////////////
-static const Utf8Str g_strExtPackPuel("Oracle VM VirtualBox Extension Pack");
-static const char *g_pszVDPluginCrypt = "VDPluginCrypt";
-
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
@@ -117,8 +112,4 @@
 
     HRESULT rc = S_OK;
-
-    /* Load all VD plugins from all extension packs first. */
-    /** @todo: Make generic for 4.4 (requires interface changes). */
-    rc = i_loadExtPackVDPluginCrypt();
 
     /* Fetch info of all available hd backends. */
@@ -1119,60 +1110,17 @@
 
 /**
- * Extension pack install notification
+ * VD plugin load
  */
-void SystemProperties::i_extPackInstallNotify(const char *pszExtPackName)
-{
-    if (g_strExtPackPuel.equals(pszExtPackName))
-    {
-        i_loadExtPackVDPluginCrypt();
-    }
+int SystemProperties::i_loadVDPlugin(const char *pszPluginLibrary)
+{
+    return VDPluginLoadFromFilename(pszPluginLibrary);
 }
 
 /**
- * Extension pack uninstall notification
+ * VD plugin unload
  */
-void SystemProperties::i_extPackUninstallNotify(const char *pszExtPackName)
-{
-    if (g_strExtPackPuel.equals(pszExtPackName))
-    {
-        i_unloadExtPackVDPluginCrypt();
-    }
-}
-
-HRESULT SystemProperties::i_loadExtPackVDPluginCrypt()
-{
-    HRESULT rc = S_OK;
-#ifdef VBOX_WITH_EXTPACK
-    if (mParent->i_getExtPackManager()->i_isExtPackUsable(g_strExtPackPuel.c_str()))
-    {
-        Utf8Str strPlugin;
-        rc = mParent->i_getExtPackManager()->i_getLibraryPathForExtPack(g_pszVDPluginCrypt, &g_strExtPackPuel, &strPlugin);
-        if (SUCCEEDED(rc))
-        {
-            int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
-            NOREF(vrc); /** @todo: don't ignore errors. */
-        }
-        else
-            rc = S_OK; /* ignore errors */
-    }
-# endif
-    return rc;
-}
-
-HRESULT SystemProperties::i_unloadExtPackVDPluginCrypt()
-{
-    HRESULT rc = S_OK;
-#ifdef VBOX_WITH_EXTPACK
-    Utf8Str strPlugin;
-    rc = mParent->i_getExtPackManager()->i_getLibraryPathForExtPack(g_pszVDPluginCrypt, &g_strExtPackPuel, &strPlugin);
-    if (SUCCEEDED(rc))
-    {
-        int vrc = VDPluginUnloadFromFilename(strPlugin.c_str());
-        NOREF(vrc); /** @todo: don't ignore errors. */
-    }
-    else
-        rc = S_OK; /* ignore errors */
-# endif
-    return rc;
+int SystemProperties::i_unloadVDPlugin(const char *pszPluginLibrary)
+{
+    return VDPluginUnloadFromFilename(pszPluginLibrary);
 }
 
Index: /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp	(revision 52595)
+++ /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp	(revision 52596)
@@ -1371,5 +1371,5 @@
           0xa0, 0xd7af, '\0' };
     char *pszName = strName.mutableRaw();
-    int cReplacements = RTStrPurgeComplementSet(pszName, aCpSet, '_');
+    ssize_t cReplacements = RTStrPurgeComplementSet(pszName, aCpSet, '_');
     Assert(cReplacements >= 0);
     NOREF(cReplacements);
@@ -2637,17 +2637,17 @@
 
 /**
- * Extpack install notification
- */
-void VirtualBox::i_extPackInstallNotify(const char *pszExtPackName)
-{
-    m->pSystemProperties->i_extPackInstallNotify(pszExtPackName);
-}
-
-/**
- * Extpack uninstall notification
- */
-void VirtualBox::i_extPackUninstallNotify(const char *pszExtPackName)
-{
-    m->pSystemProperties->i_extPackUninstallNotify(pszExtPackName);
+ * VD plugin load
+ */
+int VirtualBox::i_loadVDPlugin(const char *pszPluginLibrary)
+{
+    return m->pSystemProperties->i_loadVDPlugin(pszPluginLibrary);
+}
+
+/**
+ * VD plugin unload
+ */
+int VirtualBox::i_unloadVDPlugin(const char *pszPluginLibrary)
+{
+    return m->pSystemProperties->i_unloadVDPlugin(pszPluginLibrary);
 }
 
