CR: Removal of persistent plugin data
Tad Yeager <[email protected]>
| Newsgroups | gmane.comp.multimedia.helix.devel |
|---|---|
| Message-ID | <[email protected]> |
Resending because a portion of a reply wasn't transmitted and there has been only one response. Synopsis: encapsulate the removal of persistent plugin data in the MediaPlatform. Summary: Applications and browser plugins attempt to kill registry keys prior to loading MediaPlatform/ObjectBroker so that plugin handler data will be regenerated when mount points are added. This happens at installation time or if an application detects that plugins have changed locations. The attached changes to MediaPlatform expose a method that deletes preferences using code factored out of MediaPlatform's Reset() function. The location and format of the persistent plugin data can change. The attached changes move ownership from MediaPlatform's clients to MediaPlatform. Branchs: head, hxclient_3_1_0_atlas Affected: MediaPlatform. Risks: low. _______________________________________________ Helix-client-dev mailing list [email protected] http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
client.medpltfm.txt
(text/plain, 10.1 KB)
? Makefile
? client_medpltfm.sln
? client_medpltfm.vcproj
? client_medpltfm_hxmedpltfmdll.sln
? client_medpltfm_hxmedpltfmdll.vcproj
? client_medpltfm_hxmedpltfmlib.sln
? client_medpltfm_hxmedpltfmlib.vcproj
? dbg32
? pylinktmp-hxmedpltfm
? ribosome_logs
Index: chxmedpltfm.cpp
===================================================================
RCS file: /cvsroot/client/medpltfm/chxmedpltfm.cpp,v
retrieving revision 1.51.2.19
diff -u -2 -0 -r1.51.2.19 chxmedpltfm.cpp
--- chxmedpltfm.cpp 8 Nov 2008 17:25:36 -0000 1.51.2.19
+++ chxmedpltfm.cpp 20 Feb 2009 20:04:23 -0000
@@ -87,40 +87,41 @@
#include "hxpreferences.h"
#include "recognizer.h"
#include "hxxml.h"
#include "hxxmlprs.h"
#ifdef HELIX_FEATURE_HTTP_SERVICE
#include "chxhttp.h"
#include "hxhttp.h"
#endif
#include "hxinfcod.h"
#include "hxver.h"
#include "hxstrutl.h"
#include "dbcs.h"
#include "thrdutil.h"
#include "hxtlogutil.h"
//------------------------------- CHXMediaPlatform
BEGIN_INTERFACE_LIST( CHXMediaPlatform )
INTERFACE_LIST_ENTRY_SIMPLE( IHXMediaPlatform )
+ INTERFACE_LIST_ENTRY_SIMPLE( IHXMediaPlatform2 )
INTERFACE_LIST_ENTRY_SIMPLE( IHXCommonClassFactory )
INTERFACE_LIST_ENTRY_SIMPLE( IHXObjectManagerPrivate )
INTERFACE_LIST_ENTRY_DELEGATE_BLIND( _InternalQI )
END_INTERFACE_LIST
CHXMediaPlatform* CHXMediaPlatform::CreateInstance(CHXMediaPlatform* pParent,
CHXMediaPlatform* pRoot)
{
#ifdef HELIX_FEATURE_EXTENDED_MEDIAPLATFORM
return new CHXMediaPlatformEx((CHXMediaPlatformEx*)pParent, (CHXMediaPlatformEx*)pRoot);
#else // HELIX_FEATURE_EXTENDED_MEDIAPLATFORM
return new CHXMediaPlatform(pParent, pRoot);
#endif // HELIX_FEATURE_EXTENDED_MEDIAPLATFORM
}
CHXMediaPlatform::CHXMediaPlatform(CHXMediaPlatform* pParent, CHXMediaPlatform* pRoot)
:m_bInitialized(FALSE)
,m_lastError(HXR_OK)
@@ -586,44 +587,40 @@
}
// Extended context must be released last as it may have overriden
// services used by pther platform objects and it may also have
// aggregated itself into the platform.
// In such case, releasing of the external context will result in its
// destruction and thus any objects that may use its service must
// be released/closed first.
HX_RELEASE(m_pExtCCF);
HX_RELEASE(m_pExtContext);
m_bInitialized = FALSE;
return HXR_OK;
}
STDMETHODIMP
CHXMediaPlatform::Reset(IUnknown* pContext, HXBOOL bPlatformOnly)
{
HX_RESULT rc = HXR_OK;
- IHXBuffer* pPrefKey = NULL;
- IHXPreferences2* pPref2 = NULL;
- IHXPreferences3* pPref3 = NULL;
- IHXPreferenceEnumerator* pPrefEnumerator = NULL;
IHXPluginEnumerator* pPluginEnumerator = NULL;
if (!bPlatformOnly && m_pPluginHandlerUnkown)
{
if (HXR_OK == m_pPluginHandlerUnkown->QueryInterface(IID_IHXPluginEnumerator,
(void**)&pPluginEnumerator))
{
UINT32 ulIndex = 0;
UINT32 ulNumOfPlugins = pPluginEnumerator->GetNumOfPlugins();
IUnknown* pPlugin = NULL;
IHXPlugin2* pPlugin2 = NULL;
for(ulIndex = 0; ulIndex < ulNumOfPlugins; ulIndex++)
{
if (SUCCEEDED(pPluginEnumerator->GetPlugin(ulIndex, pPlugin)))
{
if (SUCCEEDED(pPlugin->QueryInterface(IID_IHXPlugin2, (void**)&pPlugin2)))
{
pPlugin2->Reset();
}
@@ -632,58 +629,87 @@
HX_RELEASE(pPlugin);
}
}
HX_RELEASE(pPluginEnumerator);
}
// We reset the m_pPreferences if it's already initialized via Init()
//
// On the other hand, Reset() can be called without Init(), this can
// happen when the app simply wants to reset the media platform
// during its un-installation
if (!m_pPreferences)
{
if (!m_pExtContext ||
HXR_OK != m_pExtContext->QueryInterface(IID_IHXPreferences, (void**)&m_pPreferences))
{
InitDefaultPreferences();
}
}
+ RemovePreferences(FALSE);
+
+ Close();
+
+ return HXR_OK;
+}
+
+STDMETHODIMP
+CHXMediaPlatform::RemovePersistentPluginData()
+{
+ return RemovePreferences(TRUE);
+}
+
+
+HX_RESULT
+CHXMediaPlatform::RemovePreferences(HXBOOL bMountPointsOnly)
+{
+ IHXBuffer* pPrefKey = NULL;
+ IHXPreferences2* pPref2 = NULL;
+ IHXPreferences3* pPref3 = NULL;
+ IHXPreferenceEnumerator* pPrefEnumerator = NULL;
+
// remove all the entries within m_pPreferences
if (m_pPreferences &&
HXR_OK == m_pPreferences->QueryInterface(IID_IHXPreferences2, (void**)&pPref2) &&
HXR_OK == m_pPreferences->QueryInterface(IID_IHXPreferences3, (void**)&pPref3) &&
HXR_OK == pPref2->GetPreferenceEnumerator(pPrefEnumerator))
{
while (HXR_OK == pPrefEnumerator->GetPrefKey(0, pPrefKey))
{
- pPref3->DeletePref((const char*)pPrefKey->GetBuffer());
+ if (!bMountPointsOnly)
+ {
+ pPref3->DeletePref((const char*)pPrefKey->GetBuffer());
+ }
+ else if (pPrefKey->GetSize() >= sizeof("MountPoints") -1 &&
+ !strncmp("MountPoints", (const char*)pPrefKey->GetBuffer(), sizeof("MountPoints")-1))
+ {
+ pPref3->DeletePref((const char*)pPrefKey->GetBuffer());
+ HX_RELEASE(pPrefKey);
+ break; //assuming only one MountPoints mount point
+ }
HX_RELEASE(pPrefKey);
}
HX_RELEASE(pPrefEnumerator);
HX_RELEASE(pPref3);
HX_RELEASE(pPref2);
}
-
- Close();
-
return HXR_OK;
}
STDMETHODIMP
CHXMediaPlatform::Purge(void)
{
// Purge is not supported on child media platform context
if (m_pParent)
{
return m_pParent->Purge();
}
#if !defined(_STATICALLY_LINKED) && defined(HELIX_FEATURE_PLUGINHANDLER2)
if (m_pPluginHandlerUnkown)
{
// shortcut, UnloadDeadDLLs() needs to be part of the interface
((Plugin2Handler*)(IHXPlugin2Handler*)m_pPluginHandlerUnkown)->UnloadDeadDLLs();
}
return HXR_OK;
Index: pub/chxmedpltfm.h
===================================================================
RCS file: /cvsroot/client/medpltfm/pub/chxmedpltfm.h,v
retrieving revision 1.19.2.6
diff -u -2 -0 -r1.19.2.6 chxmedpltfm.h
--- pub/chxmedpltfm.h 6 Jun 2008 00:37:44 -0000 1.19.2.6
+++ pub/chxmedpltfm.h 20 Feb 2009 20:03:52 -0000
@@ -99,40 +99,41 @@
struct PluginPathInfo
{
char* pszName;
IHXBuffer* pPath;
PluginPathInfo()
{
pszName = NULL;
pPath = NULL;
};
~PluginPathInfo()
{
HX_VECTOR_DELETE(pszName);
HX_RELEASE(pPath);
};
};
class CHXMediaPlatform : public CUnknownIMP
, public IHXMediaPlatform
+ , public IHXMediaPlatform2
, public IHXCommonClassFactory
, public IHXObjectManagerPrivate
{
// The IUnknown implementation declaration
DECLARE_UNKNOWN( CHXMediaPlatform )
protected:
typedef enum
{
HX_MP_COM_INSTRINSIC = 0,
HX_MP_COM_REGULAR
} HX_MP_COM_TYPE;
HXBOOL m_bInitialized;
HX_RESULT m_lastError;
IUnknown* m_pExtContext;
IUnknown* m_pPluginHandlerUnkown;
IHXCommonClassFactory* m_pExtCCF;
@@ -187,72 +188,78 @@
CHXSimpleList* m_pSingleLoadPlugins;
CHXSimpleList* m_pLoadAtStartupPlugins;
HX_RESULT InitBasicServices(void);
HX_RESULT LoadStartupPlugins(void);
void UnloadStartupPlugins(void);
HX_RESULT InitExtendableServices(void);
HX_RESULT CheckAndQueryInterface(HX_MP_COM_TYPE type, REFIID riid, void** ppvObj);
HX_RESULT CheckAndCreateInstance(HX_MP_COM_TYPE type, REFCLSID rclsid, void** ppUnknown);
virtual HX_RESULT CreateIntrinsicType(REFCLSID rclsid, REF(IUnknown*) pUnknown, IUnknown* pOuter);
virtual HX_RESULT CreateGeneralType(REFCLSID clsid, REF(IUnknown*) pObject, IUnknown* pUnkOuter, IUnknown* pContext);
HX_RESULT CreateInstanceFromPluginHandler(REFCLSID rclsid, void** ppUnknown, IUnknown *pUnkOuter, IUnknown* pContext);
HX_RESULT InitDefaultPreferences(void);
HX_RESULT InitLogging();
HX_RESULT _InternalQI(REFIID riid, void** ppvObj);
+ HX_RESULT RemovePreferences(HXBOOL bMountPointsOnly);
public:
static CHXMediaPlatform* CreateInstance(CHXMediaPlatform* pParent = NULL,
CHXMediaPlatform* pRoot = NULL);
CHXMediaPlatform(CHXMediaPlatform* pParent = NULL, CHXMediaPlatform* pRoot = NULL);
~CHXMediaPlatform(void);
/*
* IHXMediaPlatform methods
* see common/include/ihxmedpltfm.h for detail description
*/
STDMETHOD(GetVersion) (THIS_
UINT32* pVersion);
STDMETHOD(AddPluginPath) (THIS_
const char* pszName,
const char* pszPath);
STDMETHOD(Init) (THIS_
IUnknown* pContext);
STDMETHOD(Close) (THIS);
STDMETHOD(Reset) (THIS_
IUnknown* pContext,
HXBOOL bPlatformOnly = TRUE);
STDMETHOD(Purge) (THIS);
STDMETHOD(CreateChildContext) (THIS_
IHXMediaPlatform** ppChildContext);
/*
+ * IHXMediaPlatform2 methods
+ */
+ STDMETHOD(RemovePersistentPluginData) (THIS);
+
+ /*
* IHXCommonClassFactory methods
*/
STDMETHOD(CreateInstance) (THIS_
REFCLSID rclsid,
void** ppUnknown);
STDMETHOD(CreateInstanceAggregatable) (THIS_
REFCLSID rclsid,
REF(IUnknown*) ppUnknown,
IUnknown* pUnkOuter);
// IHXObjectManagerPrivate methods
STDMETHOD(ObjectFromCLSIDPrivate) (THIS_ REFCLSID clsid,REF(IUnknown *)pObject,
IUnknown *pUnkOuter, IUnknown* pContext );
STDMETHOD( UnloadPluginPrivate )(THIS_ REFCLSID clsid);
};
#endif /* _CHXMEDPLTFM_H_ */
common.include.txt
(text/plain, 5.7 KB)
Index: hxiids.h
===================================================================
RCS file: /cvsroot/common/include/hxiids.h,v
retrieving revision 1.132.2.11
diff -u -2 -0 -r1.132.2.11 hxiids.h
--- hxiids.h 2 Dec 2008 13:53:31 -0000 1.132.2.11
+++ hxiids.h 20 Feb 2009 20:07:43 -0000
@@ -104,40 +104,41 @@
#if ( !defined(_HXCOMM_H_) || !defined(HELIX_FEATURE_FULLGUID) )
DEFINE_GUID_ENUM(IID_IHXStatistics, 0x00000001, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
DEFINE_GUID_ENUM(IID_IHXRegistryID, 0x00000002, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
DEFINE_GUID_ENUM(IID_IHXServerFork, 0x00000003, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
DEFINE_GUID_ENUM(IID_IHXServerControl, 0x00000004, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
DEFINE_GUID_ENUM(IID_IHXServerControl2, 0x00000005, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
DEFINE_GUID_ENUM(IID_IHXReconfigServerResponse, 0x00000006, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
DEFINE_GUID_ENUM(IID_IHXServerReconfigNotification, 0x00000007, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
DEFINE_GUID_ENUM(IID_IHXWantServerReconfigNotification, 0x00000008, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
// $Private:
DEFINE_GUID_ENUM(IID_IHXResolverExec, 0x00000009, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
// $Private:
DEFINE_GUID_ENUM(IID_IHXFastAlloc, 0x0000000a, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
DEFINE_GUID_ENUM(IID_IHXAccurateClock, 0x0000000b, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
// $EndPrivate.
#endif
#if ( !defined(_IHXMEDPLTFM_H_) || !defined(HELIX_FEATURE_FULLGUID) )
DEFINE_GUID_ENUM(IID_IHXMediaPlatform, 0x00000080, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
+DEFINE_GUID_ENUM(IID_IHXMediaPlatform2, 0xd482f2d4, 0x641f, 0x49c8, 0xa4, 0xe0, 0x39, 0xb5, 0x16, 0xb5, 0x10, 0xd3)
DEFINE_GUID_ENUM(IID_IHXMediaPlatformKicker, 0x00000081, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59)
#endif /* _IHXMEDPLTFM_H_ */
/*
* File:
* hxengin.h
* Description:
* Interfaces related to callbacks, networking, and scheduling.
* Interfaces:
* IID_IHXCallback: {00000100-0901-11d1-8B06-00A024406D59}
* IID_IHXScheduler: {00000101-0901-11d1-8B06-00A024406D59}
* IID_IHXTCPResponse: {00000102-0901-11d1-8B06-00A024406D59}
* IID_IHXTCPSocket: {00000103-0901-11d1-8B06-00A024406D59}
* IID_IHXListenResponse: {00000104-0901-11d1-8B06-00A024406D59}
* IID_IHXListenSocket: {00000105-0901-11d1-8B06-00A024406D59}
* IID_IHXNetworkServices: {00000106-0901-11d1-8B06-00A024406D59}
* IID_IHXUDPResponse: {00000107-0901-11d1-8B06-00A024406D59}
* IID_IHXUDPSocket: {00000108-0901-11d1-8B06-00A024406D59}
* IID_IHXResolver: {00000109-0901-11d1-8B06-00A024406D59}
* IID_IHXResolverResponse: {0000010A-0901-11d1-8B06-00A024406D59}
Index: ihxmedpltfm.h
===================================================================
RCS file: /cvsroot/common/include/ihxmedpltfm.h,v
retrieving revision 1.10.2.3
diff -u -2 -0 -r1.10.2.3 ihxmedpltfm.h
--- ihxmedpltfm.h 5 Feb 2009 15:07:52 -0000 1.10.2.3
+++ ihxmedpltfm.h 20 Feb 2009 19:55:36 -0000
@@ -210,40 +210,78 @@
* IHXMediaPlatform::Purge
* Purpose:
* Force unloading of any unused plugins by the platform
*/
STDMETHOD(Purge) (THIS) PURE;
/************************************************************************
* Method:
* IHXMediaPlatform::CreateChildContext
* Purpose:
* Create a new media platform context from the current context
*/
STDMETHOD(CreateChildContext) (THIS_
IHXMediaPlatform** ppChildContext) PURE;
};
/****************************************************************************
*
* Interface:
*
+ * IHXMediaPlatform2
+ *
+ * Purpose:
+ *
+ * This interface is intended to provide a method to remove persistent
+ * data about plugins, like mount points & checksums. Used during
+ * application install or uninstall
+ *
+ * IID_IHXMediaPlatform2:
+ *
+ * {D482F2D4-641F-49c8-A4E0-39B516B510D3}
+ *
+ */
+DEFINE_GUID(IID_IHXMediaPlatform2, 0xd482f2d4, 0x641f, 0x49c8, 0xa4, 0xe0, 0x39,
+ 0xb5, 0x16, 0xb5, 0x10, 0xd3);
+
+#define CLSID_IHXMediaPlatform2 IID_IHXMediaPlatform2
+
+#undef INTERFACE
+#define INTERFACE IHXMediaPlatform2
+
+DECLARE_INTERFACE_(IHXMediaPlatform2, IUnknown)
+{
+ /************************************************************************
+ * Method:
+ * IHXMediaPlatform::RemovePersistentPluginData
+ * Purpose:
+ * Remove MountPoints from Preferences so PluginHandlerData may be
+ * regenerated
+ *
+ */
+ STDMETHOD(RemovePersistentPluginData) (THIS) PURE;
+};
+
+/****************************************************************************
+ *
+ * Interface:
+ *
* IHXMediaPlatformKicker
*
* Purpose:
*
* This interface is intended for systems that do not support asynchronous
* timer. For systems that support asynchronous timer, the interface will
* be no-op when its called.
*
* IID_IHXMediaPlatformKicker:
*
* {0000081-0901-11d1-8B06-00A024406D59}
*
*/
DEFINE_GUID(IID_IHXMediaPlatformKicker, 0x00000081, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
0xa0, 0x24, 0x40, 0x6d, 0x59);
#define CLSID_IHXMediaPlatformKicker IID_IHXMediaPlatformKicker
#undef INTERFACE
#define INTERFACE IHXMediaPlatformKicker