📄 plghand2.h
字号:
void ReconnectDLL(const char* pszDLLName, Plugin2Handler::PluginDLL* pNewDLL); BOOL GetNonHXInfo(REF(char*) pszCurrentPos, PluginMountPoint* pMountPoint, REF(Plugin2Handler::OtherDLL*) pOtherData); void WriteHugePref( IHXPreferences* pPrefs, const char* pszKeyName, IHXBuffer* pBigBuffer); HX_RESULT ReadHugePref( IHXPreferences* pPrefs, const char* pszKeyName, REF(IHXBuffer*) pBigBuffer); void DeleteHugePref_ (IHXPreferences*, IHXPreferences3*, const char*); // Internal shared code HX_RESULT FindImplementationFromClassIDInternal( REFGUID GUIDClassID, REF(IUnknown*) pIUnknownInstance, IUnknown* pContext ); // New plugin info loading methods HX_RESULT ClearMountPoint_ (PluginMountPoint*); HX_RESULT RefreshPluginInfo( PluginMountPoint* pMountPoint ); HX_RESULT WritePluginInfo( PluginMountPoint* pMountPoint ); HX_RESULT ReadPluginInfoFast( PluginMountPoint* pMountPoint ); HX_RESULT WritePluginInfoFast( PluginMountPoint* pMountPoint ); HX_RESULT ReadPluginInfoSlow( PluginMountPoint* pMountPoint ); HX_RESULT WritePluginInfoSlow( PluginMountPoint* pMountPoint ); CPluginDatabaseIndex* FindDBIndex( const char* pKeyName ); void AddPluginToIndices( Plugin2Handler::Plugin* pPlugin ); void RemovePluginFromIndices( Plugin2Handler::Plugin* pPlugin ); CHXMapStringToOb m_MountPoints; CHXSimpleList m_PluginDLLList; CHXSimpleList m_PluginList; CHXSimpleList m_MiscDLLList; CHXSimpleList m_CanUnload2DllList; CHXMapStringToOb m_GUIDtoSupportList; CHXMapStringToOb m_dbIndices; CHXMapStringToOb m_GUIDSupportListIsValid; CHXMapStringToOb m_FileNameMap; IHXBuffer* m_pPluginDir; IHXPreferences* m_pPreferences; IHXErrorMessages* m_pErrorMessages; IUnknown* m_pContext; INT32 m_nCacheSizeBites; CHXSimpleList m_DLL_LRUList; class PluginMountPoint { public: PluginMountPoint( Plugin2Handler* pContext, const char* pName, UINT32 majorVersion, UINT32 minorVersion, IHXBuffer* pPath ); ~PluginMountPoint(); STDMETHOD_(ULONG32,AddRef)( THIS ); STDMETHOD_(ULONG32,Release)( THIS ); void AddClient(); INT32 RemoveClient(); // XXXND This is for backward compatibility BOOL IsHXCompliant(); IHXPreferences* Prefs(); IHXBuffer* Path(); private: INT32 m_lRefCount; INT32 m_lClientCount; // XXXND This is for backward compatibility BOOL m_bHXCompliant; IHXPreferences* m_pIPrefs; IHXBuffer* m_pIPath; }; class PluginDLL : public IUnknown { public: PluginDLL(const char* pszFileName, PluginMountPoint* pMountPoint, Plugin2Handler* pPlugin2Handler); ~PluginDLL(); /* * IUnknown methods */ STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); STDMETHOD_(ULONG32,AddRef) (THIS); STDMETHOD_(ULONG32,Release) (THIS); Errors Load(IUnknown* pContext); HX_RESULT Unload(BOOL safe = TRUE); BOOL IsLoaded(); Errors CreateInstance( IUnknown** ppUnk, UINT32 uIndex ); UINT32 AddDLLReference(); UINT32 ReleaseDLLReference(); void SetPref( int nNumberPlugins, char* pszCheckSum, int nDLLSize, BOOL bFactory ); HX_RESULT WritePref2( REF(CPluginInfoWriter) piw); HX_RESULT WritePref( PreferenceEnumerator* pPrefEnum ); HX_RESULT ReadPref( PreferenceEnumerator* pPrefs ); // Accessors void SetHash(char* phash) {m_hash = phash;} void SetFileSize(INT32 nSize) {m_nSizeBites = nSize;} PluginMountPoint* GetMountPoint() { return m_pMountPoint; } IHXBuffer* GetFileName(); INT32 GetFileSize() { return m_nSizeBites; } void SetNamespace(IHXBuffer* pNamespace); IHXBuffer* GetNamespace(); const char* GetHash() { return (const char*) m_hash; } CHXString const& GetPackageName () const { return m_packageName; } UINT32 GetNumPlugins() { return m_NumOfPlugins; } BOOL DoesExist() { return m_bDoesExist; } private: FPCREATEINSTANCE m_fpCreateInstance; FPSHUTDOWN m_fpShutdown; FPCANUNLOAD2 m_fCanUnload; PluginMountPoint* m_pMountPoint; IHXBuffer* m_pFileName; IHXBuffer* m_pNamespace; CHXString m_packageName; CHXString m_hash; LONG32 m_nSizeBites; INT32 m_lRefCount; UINT16 m_NumOfPlugins : 16; HX_BITFIELD m_bHas_factory : 1; HX_BITFIELD m_bLoaded : 1; BOOL m_bDoesExist; DLLAccess* m_pDLLAccess; UINT32 m_nActiveReferences; Plugin2Handler* m_pPlugin2Handler; }; class Plugin : public IHXPluginWatcherResponse { public: STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj); STDMETHOD_(ULONG32,AddRef) (THIS); STDMETHOD_(ULONG32,Release) (THIS); STDMETHOD(AllObjectsDeleted) (THIS_ void*); Plugin(IUnknown* pContext); ~Plugin(); // Exposed to the Plugin2Handler BOOL DoesMatch(IHXValues* pValues); HX_RESULT WritePref2(REF(CPluginInfoWriter) piw); HX_RESULT WritePref(PreferenceEnumerator* pPrefEnum); HX_RESULT ReadPref(PreferenceEnumerator* pPrefs); Errors GetValuesFromDLL(IHXPlugin* pHXPlugin); // Creates an instance of the top-level plugin object Errors GetPlugin( REF(IUnknown*) ppUnknown ); // Checks to see if this is a component plugin and does the appropriate indirection Errors GetInstance(REF(IUnknown*) ppUnknown, IUnknown* pIUnkOuter = NULL ); HX_RESULT GetPluginInfo(REF(IHXValues*)); IHXBuffer* GetFileName(); BOOL IsLoaded(); BOOL DoesInfoNeedsRefresh() {return m_bInfoNeedsRefresh;} void SetInfoNeedsRefresh(BOOL bRefresh) { m_bInfoNeedsRefresh = bRefresh;} void SetDLL(PluginDLL * pPluginDll); PluginDLL* GetDLL() {return m_pPluginDLL;} void SetIndex(UINT16 nIndex); UINT16 GetIndex() {return m_nPluginIndex;} void SetPropertyULONG32(char* , char*); void SetPropertyCString(char*, char*); void SetPropertyBuffer(char*, BYTE*, UINT32); // this causes an init plugins should be handled with care. HX_RESULT GetBandwidthInfo(); // FIX This is to support the initialization of component plugins void InitializeComponentPlugin( IHXPlugin* pIPlugin, IHXValues* pIValues ); // void* because the client doesn't have these // XXXAH not supported currently... They were not in the old plugin handler either... // must be some code in the server that talks directly to this (BLEECH!) void* m_process; private: LONG32 m_lRefCount; UINT16 m_nPluginIndex; PluginDLL* m_pPluginDLL; IHXValues* m_pValues; HX_BITFIELD m_bCanUnload : 1; HX_BITFIELD m_bInfoNeedsRefresh : 1; IUnknown* m_pContext; // Methods to retreive from the DLL Errors GetBasicValues(IHXPlugin* pHXPlugin); Errors GetExtendedValues(IHXPlugin* pHXPlugin); // Support Functions HX_RESULT CatStrings( char** pInStrings, REF(IHXBuffer*) pOutBuffer); HX_RESULT CatPropertiesULONG32( REF(IHXBuffer*) pBuffer, const char* pPropName, ULONG32 nValue); HX_RESULT CatPropertiesCString( REF(IHXBuffer*) pBuffer, const char* pPropName, IHXBuffer* pValue); BOOL GetNextValueFromString( REF(char*) pszValues, REF(UINT32) nType, REF(IHXBuffer*) pValueNameBuffer, REF(IHXBuffer*) pValueBuffer, REF(ULONG32) nValue); BOOL AreBufferEqual( IHXBuffer* pBigBuff, IHXBuffer* pSmallBuff); Errors CreateWatcher(IUnknown* pUnknown); }; class PluginSupportingGUID { public: CHXString m_filename; UINT32 m_nIndexInDLL; PluginMountPoint* m_pMountPoint; }; class OtherDLL { public: CHXString m_filename; CHXString m_fileChecksum; PluginMountPoint* m_pMountPoint; }; class PreferenceEnumerator { public: HX_RESULT BeginSubPref(const char* pszSubPref); HX_RESULT EndSubPref(); HX_RESULT WriteSubPref(const char* pszSubName, IHXBuffer* pBuffer); HX_RESULT ReadPref(const char* pszSubName, REF(IHXBuffer*) /*OUT*/ pBuffer); HX_RESULT GetPrefKey(UINT32 nIndex, IHXBuffer*& pBuffer); HX_RESULT ResetPropNameList(); PreferenceEnumerator(IHXPreferences* pIHXPref); ~PreferenceEnumerator(); private: CHXString m_RegKey; CHXSimpleList m_ListofProps; IHXPreferenceEnumerator* m_pPrefEnum; IHXPreferences* m_pPreferences; };};class CPluginEnumerator : public CUnknownIMP, public IHXPluginSearchEnumerator{public: CPluginEnumerator(); virtual ~CPluginEnumerator(); DECLARE_UNKNOWN_NOCREATE( CPluginEnumerator ) /* * IHXPluginSearchEnumerator */ STDMETHOD_(UINT32, GetNumPlugins)(THIS); STDMETHOD_(void, GoHead)(THIS); STDMETHOD(GetNextPlugin)( THIS_ REF(IUnknown*) pIUnkResult, IUnknown* pIUnkOuter ); STDMETHOD(GetNextPluginInfo)( THIS_ REF(IHXValues*) pRetValues ); STDMETHOD(GetPluginAt)( THIS_ UINT32 index, REF(IUnknown*) pIUnkResult, IUnknown* pIUnkOuter ); STDMETHOD(GetPluginInfoAt)( THIS_ UINT32 index, REF(IHXValues*) pRetValues ); //---------------- Class methods void Add(Plugin2Handler::Plugin* pPlugin); // FIX This is for backwards compatibility, and should be removed HX_RESULT GetNext(REF(IUnknown*) pRetUnk);protected:private: CHXSimpleList m_ListOfPlugins; UINT32 m_nIndex;};// Helper class used to write plugin info to registry...class CPluginInfoWriter{public: CPluginInfoWriter(); ~CPluginInfoWriter(); HX_RESULT Init(IHXPreferences* pPrefs, const char* pBaseKeyName, IHXBuffer* pIHXBuffer); HX_RESULT Write(IHXBuffer *pBuffer); HX_RESULT Write(const char *pInfo); HX_RESULT Write(const char *pInfo, UINT32 len); HX_RESULT Flush();private: void TerminateBuffer(); void WriteToRegistry(); static BOOL IsAscii7Compliant (const char*, const UINT32 len); IHXBuffer* m_pIHXBuffer; // Contains a pointer to internal buffer IHXPreferences* m_pIHXPreferences; // Used to write to registry UINT32 m_NumWrites; // Keeps track of how many times we have written to registry during lifetime of class UINT32 m_BufUsed; // Keeps track of how much we have written to internal buffer between writes to registry UINT32 m_BufSize; // Size of internal buffer; Used to determine when to write info to registry UINT32 m_Checksum; // Total size of the data written to the registry across the lifetime of the object. CHXString m_BaseKeyName; // Combined with m_NumWrite to generate the name of the registry key to which we write};#endif /* _PLGNHAND_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -