basehand.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:24k
源码类别:

Symbian

开发平台:

C/C++

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Version: RCSL 1.0/RPSL 1.0
  3.  *
  4.  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
  5.  *
  6.  * The contents of this file, and the files included with this file, are
  7.  * subject to the current version of the RealNetworks Public Source License
  8.  * Version 1.0 (the "RPSL") available at
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed
  10.  * the file under the RealNetworks Community Source License Version 1.0
  11.  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
  12.  * in which case the RCSL will apply. You may also obtain the license terms
  13.  * directly from RealNetworks.  You may not use this file except in
  14.  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
  15.  * applicable to this file, the RCSL.  Please see the applicable RPSL or
  16.  * RCSL for the rights, obligations and limitations governing use of the
  17.  * contents of the file.
  18.  *
  19.  * This file is part of the Helix DNA Technology. RealNetworks is the
  20.  * developer of the Original Code and owns the copyrights in the portions
  21.  * it created.
  22.  *
  23.  * This file, and the files included with this file, is distributed and made
  24.  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  25.  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  26.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
  27.  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  28.  *
  29.  * Technology Compatibility Kit Test Suite(s) Location:
  30.  *    http://www.helixcommunity.org/content/tck
  31.  *
  32.  * Contributor(s):
  33.  *
  34.  * ***** END LICENSE BLOCK ***** */
  35. #ifndef _BASEHAND_H_
  36. #define _BASEHAND_H_
  37. #include "hxphand.h"
  38. #include "unkimp.h"
  39. #include "hxslist.h"
  40. #include "hxmap.h"
  41. // Plugin Types.
  42. #define PLUGIN_FILESYSTEM_TYPE     "PLUGIN_FILE_SYSTEM"
  43. #define PLUGIN_FILEFORMAT_TYPE     "PLUGIN_FILE_FORMAT"
  44. #define PLUGIN_FILEWRITER_TYPE     "PLUGIN_FILE_WRITER"
  45. #define PLUGIN_METAFILEFORMAT_TYPE  "PLUGIN_METAFILE_FORMAT"
  46. #define PLUGIN_RENDERER_TYPE     "PLUGIN_RENDERER"
  47. #define PLUGIN_STREAM_DESC_TYPE     "PLUGIN_STREAM_DESC"
  48. #define PLUGIN_CLASS_FACTORY_TYPE   "PLUGIN_CLASS_FACT"
  49. #define PLUGIN_PAC_TYPE     "PLUGIN_PAC"
  50. #define PLUGIN_CLASS     "PluginType"
  51. #define PLUGIN_FILENAME     "PluginFilename"
  52. #define PLUGIN_REGKEY_ROOT     "PluginHandlerData"
  53. #define PLUGIN_PLUGININFO     "PluginInfo"
  54. #define PLUGIN_GUIDINFO     "GUIDInfo"
  55. #define PLUGIN_NONHXINFO     "NonHXDLLs"
  56. #define PLUGIN_DESCRIPTION2     "Description"
  57. #define PLUGIN_FILE_HASH     "FileHash"
  58. #define PLUGIN_INDEX     "IndexNumber"
  59. #define PLUGIN_FILENAMES     "FileInfo"
  60. #define PLUGIN_COPYRIGHT2     "Copyright"
  61. #define PLUGIN_LOADMULTIPLE     "LoadMultiple"
  62. #define PLUGIN_VERSION     "Version"
  63. #define PLUGIN_FILESYSTEMSHORT     "FileShort"
  64. #define PLUGIN_FILESYSTEMPROTOCOL   "FileProtocol"
  65. #define PLUGIN_FILEMIMETYPES     "FileMime"
  66. #define PLUGIN_FILEEXTENSIONS     "FileExtensions"
  67. #define PLUGIN_FILEOPENNAMES     "FileOpenNames"
  68. #define PLUGIN_RENDERER_MIME     "RendererMime"
  69. #define PLUGIN_RENDERER_GRANULARITY "Renderer_Granularity"
  70. #define PLUGIN_STREAMDESCRIPTION    "StreamDescription"
  71. #define PLUGIN_NUM_PLUGINS     "NumPlugins"
  72. #define PLUGIN_FILE_CHECKSUM     "DLLCheckSum"
  73. #define PLUGIN_DLL_SIZE     "DLLSize"
  74. #define PLUGIN_HAS_FACTORY     "DLLHasFactory"
  75. typedef HX_RESULT (HXEXPORT_PTR FPCREATEINSTANCE) (IUnknown** /*OUT*/ ppIUnknown);
  76. typedef HX_RESULT (HXEXPORT_PTR FPSHUTDOWN) ();
  77. typedef HX_RESULT (HXEXPORT_PTR FPCANUNLOAD2) ();
  78. class DLLAccess;
  79. class CFindFile;
  80. class BaseHandler : public CUnknownIMP,
  81. public IHXPluginEnumerator,
  82. public IHXPlugin2Handler,
  83.      public IHXPluginHandler3
  84. {
  85.     class PluginMountPoint;
  86.     class PluginDLL;
  87.     class Plugin;
  88.     class OtherDLL;
  89.     friend class CPluginEnumerator;
  90.     friend class PluginDLL;
  91.     friend class Plugin;
  92.     friend class OtherDLL;
  93. public:
  94.     enum    Errors
  95.     {
  96. NO_ERRORS = 0,
  97. PLUGIN_NOT_FOUND,
  98. MEMORY_ERROR,
  99. CANT_OPEN_DLL,
  100. BAD_DLL,
  101. CREATE_INSTANCHXR_FAILURE,
  102. CANT_DETERMINE_PLUGIN_DIR,
  103. CANT_OPEN_PLUGIN_DIR,
  104. BAD_PLUGIN,
  105. INVALID_CONTEXT,
  106. CANT_GET_FILE_FORMAT_INFO,
  107. CANT_GET_RENDERER_INFO,
  108. CANT_GET_FILE_SYSTEM_INFO,
  109. CANT_LOAD_INTERFACE,
  110. SHORT_NAME_NOT_FOUND,
  111. PLUGIN_ALREADY_HAS_MOUNT_POINT,
  112. INVALID_SHORT_NAME,
  113. BAD_REGISTRY_HANDLE,
  114. PLUGIN_DIR_NOT_SAME,
  115. REQUIRED_PLUGIN_NOT_LOADED,
  116. NO_HX_CREATE_INSTANCE,
  117. AGGREGATION_NOT_SUPPORTED
  118.     };
  119.     enum eValueTypes
  120.     {
  121. eString,
  122. eBuffer,
  123. eInt
  124.     };
  125.     DECLARE_UNKNOWN_NOCREATE( BaseHandler )
  126.     DECLARE_COM_CREATE_FUNCS( BaseHandler )
  127.     BaseHandler();
  128.     ~BaseHandler();
  129.     /*
  130.      * IHXPluginEnumerator methods
  131.      */
  132.     /************************************************************************
  133.      * Method:
  134.      *     IHXPluginEnumerator::GetNumOfPlugins
  135.      *
  136.      * Purpose:
  137.      *     return the number of plugins available
  138.      *
  139.      */
  140.     STDMETHOD_(ULONG32,GetNumOfPlugins) (THIS);
  141.     /************************************************************************
  142.      * Method:
  143.      *     IHXPluginEnumerator::GetPlugin
  144.      * Purpose:
  145.      *     return an instance(IUnknown) of the plugin
  146.      *
  147.      */
  148.     STDMETHOD(GetPlugin)   (THIS_
  149.     ULONG32     /*IN*/  ulIndex,
  150.     REF(IUnknown*)  /*OUT*/ pPlugin);
  151.     /*
  152.      * IHXPlugin2Handler
  153.      */
  154.      /************************************************************************
  155.      * Method:
  156.      *     IHXPlugin2Handler::Init
  157.      *
  158.      * Purpose:
  159.      *     Specifies the context and sets the BaseHandler in motion.
  160.      *
  161.      */
  162.     STDMETHOD(Init)    (THIS_ IUnknown* pContext);
  163.     /************************************************************************
  164.      * Method:
  165.      *     IHXPlugin2Handler::GetNumPlugins2
  166.      *
  167.      * Purpose:
  168.      *     Gets the info of a particular plugin.
  169.      *
  170.      */
  171.     STDMETHOD_(ULONG32,GetNumOfPlugins2)    (THIS);
  172.     /************************************************************************
  173.      * Method:
  174.      *     IHXPlugin2Handler::GetPluginInfo
  175.      *
  176.      * Purpose:
  177.      *     Gets the info of a particular plugin.
  178.      *
  179.      */
  180.     STDMETHOD(GetPluginInfo) (THIS_
  181. UINT32 unIndex,
  182. REF(IHXValues*) /*OUT*/ Values) ;
  183.     /************************************************************************
  184.      * Method:
  185.      *     IHXPlugin2Handler::FlushCache()
  186.      *
  187.      * Purpose:
  188.      *     Flushes the LRU cache -- Unloads all DLLs from memory
  189.      *     which currenltly have a refcount of 0.
  190.      */
  191.     STDMETHOD(FlushCache) (THIS);
  192.     /************************************************************************
  193.      * Method:
  194.      *     IHXPlugin2Handler::SetCacheSize
  195.      *
  196.      * Purpose:
  197.      *     This function sets the size of the Cache. The cache is
  198.      *     initally set to 1000KB. To disable the cache simply set
  199.      * the size to 0.If the cache is disabled a DLL will be
  200.      *     unloaded whenever it's refcount becomes zero. Which MAY
  201.      * cause performance problems.
  202.      */
  203.     STDMETHOD(SetCacheSize) (THIS_ ULONG32 nSizeKB);
  204.     /************************************************************************
  205.      * Method:
  206.      *     IHXPlugin2Handler::ReadFromRegistry
  207.      *
  208.      * Purpose:
  209.      *     Reload the DLL information from the registery. It will also
  210.      *     Check to see if this information is valid, and if
  211.      */
  212.     STDMETHOD(ReadFromRegistry)(THIS);
  213.     /************************************************************************
  214.      * Method:
  215.      *     IHXPlugin2Handler::GetInstance
  216.      *
  217.      * Purpose:
  218.      *
  219.      *     This function will return a plugin instance given a plugin index.
  220.      *
  221.      */
  222.     STDMETHOD(GetInstance) (THIS_ UINT32 index, REF(IUnknown*) ppUnknown);
  223.     /************************************************************************
  224.      * Method:
  225.      *     IHXPlugin2Handler::FindReturnIndexUsingValues
  226.      *
  227.      * Purpose:
  228.      *     Finds a plugin  which matches the set of values given. An index
  229.      *     is returned which can be used to either get the values (using
  230.      *     GetPluginInfo) or an instance can be created using GetPluing().
  231.      *
  232.      */
  233.     STDMETHOD(FindIndexUsingValues)     (THIS_ IHXValues*,
  234.     REF(UINT32) unIndex);
  235.     /************************************************************************
  236.      * Method:
  237.      *     IHXPlugin2Handler::FindReturnPluginUsingValues
  238.      *
  239.      * Purpose:
  240.      *     Finds a plugin  which matches the set of values given. A Plugin
  241.      *     instance is returned.
  242.      *
  243.      */
  244.     STDMETHOD(FindPluginUsingValues)     (THIS_ IHXValues*,
  245.     REF(IUnknown*) pUnk);
  246.     /************************************************************************
  247.      * Method:
  248.      *     IHXPlugin2Handler::FindReturnIndexUsingStrings
  249.      *
  250.      * Purpose:
  251.      *     Finds a plugin  which matches the set of values given. An index
  252.      *     is returned which can be used to either get the values (using
  253.      *     GetPluginInfo) or an instance can be created using GetPluing().
  254.      *     NOTE: that a max of two values may be given.
  255.      */
  256.     STDMETHOD(FindIndexUsingStrings)     (THIS_ char* PropName1,
  257.     char* PropVal1,
  258.     char* PropName2,
  259.     char* PropVal2,
  260.     char* PropName3,
  261.     char* PropVal3,
  262.     REF(UINT32) unIndex);
  263.     /************************************************************************
  264.      * Method:
  265.      *     IHXPlugin2Handler::FindReturnPluginUsingStrings
  266.      *
  267.      * Purpose:
  268.      *     Finds a plugin  which matches the set of values given. A Plugin
  269.      *     instance is returned.
  270.      *     NOTE: that a max of two values may be given.
  271.      */
  272.     STDMETHOD(FindPluginUsingStrings)     (THIS_ char* PropName1,
  273.     char* PropVal1,
  274.     char* PropName2,
  275.     char* PropVal2,
  276.     char* PropName3,
  277.     char* PropVal3,
  278.     REF(IUnknown*) pUnk);
  279.     /************************************************************************
  280.      * Method:
  281.      *     IHXPlugin2Handler::FindImplementationFromClassID
  282.      *
  283.      * Purpose:
  284.      *     Finds a CommonClassFactory plugin which supports the
  285.      *     ClassID given. An instance of the Class is returned.
  286.      */
  287.     STDMETHOD(FindImplementationFromClassID)
  288.     (
  289. REFGUID GUIDClassID,
  290. REF(IUnknown*) pIUnknownInstance
  291.     );
  292.     /************************************************************************
  293.      * Method:
  294.      *     IHXPlugin2Handler::Close
  295.      *
  296.      * Purpose:
  297.      *     A function which performs all of the functions of delete.
  298.      *
  299.      *
  300.      */
  301.     STDMETHOD(Close) (THIS);
  302.     /************************************************************************
  303.      * Method:
  304.      *     IHXPlugin2Handler::SetRequiredPlugins
  305.      *
  306.      * Purpose:
  307.      *     This function sets the required plugin list
  308.      *
  309.      *
  310.      */
  311.     STDMETHOD(SetRequiredPlugins) (THIS_ const char** ppszRequiredPlugins);
  312.     /************************************************************************
  313.      * Method:
  314.      *     IHXPluginHandler3::RegisterContext
  315.      *
  316.      * Purpose:
  317.      *     Sets up the context without loading any plugin info
  318.      *
  319.      */
  320.     STDMETHOD( RegisterContext )( THIS_ IUnknown* pContext );
  321.     /************************************************************************
  322.      * Method:
  323.      *     IHXPluginHandler3::AddPluginMountPoint
  324.      *
  325.      * Purpose:
  326.      *
  327.      */
  328.     STDMETHOD( AddPluginMountPoint )( THIS_ const char* pName, UINT32 majorVersion,
  329.     UINT32 minorVersion, IHXBuffer* pPath );
  330.     /************************************************************************
  331.      * Method:
  332.      *     IHXPluginHandler3::RefreshPluginMountPoint
  333.      *
  334.      * Purpose:
  335.      *
  336.      */
  337.     STDMETHOD( RefreshPluginMountPoint )( THIS_ const char* pName );
  338.     /************************************************************************
  339.      * Method:
  340.      *     IHXPluginHandler3::RemovePluginMountPoint
  341.      *
  342.      * Purpose:
  343.      *
  344.      */
  345.     STDMETHOD( RemovePluginMountPoint )( THIS_ const char* pName );
  346.     /************************************************************************
  347.      * Method:
  348.      *     IHXPluginHandler3::FindImplementationFromClassID
  349.      *
  350.      * Purpose:
  351.      *     Finds a CommonClassFactory plugin which supports the
  352.      *     ClassID given. An instance of the Class is returned.
  353.      *     The plugin instance is initialized with the specified
  354.      *     context
  355.      */
  356.     STDMETHOD( FindImplementationFromClassID )( THIS_ REFGUID GUIDClassID,
  357. REF(IUnknown*) pIUnknownInstance,
  358. IUnknown* pIUnkOuter, IUnknown* pContext );
  359.     /************************************************************************
  360.      * Method:
  361.      *     IHXPluginHandler3::FindCLSIDFromName
  362.      *
  363.      * Purpose:
  364.      *
  365.      *     Maps a text name to a CLSID based on information from
  366.      *     component plugins
  367.      */
  368.     STDMETHOD( FindCLSIDFromName )( THIS_ const char* pName, REF(IHXBuffer*) pCLSID );
  369.     /************************************************************************
  370.      * Method:
  371.      *     IHXPluginHandler3::FindGroupOfPluginsUsingValues
  372.      *
  373.      * Purpose:
  374.      *     Builds a collection of plugins that match the criteria
  375.      *
  376.      */
  377.     STDMETHOD(FindGroupOfPluginsUsingValues)(THIS_ IHXValues* pValues,
  378.     REF(IHXPluginSearchEnumerator*) pIEnumerator);
  379.     /************************************************************************
  380.      * Method:
  381.      *     IHXPluginHandler3::FindGroupOfPluginsUsingStrings
  382.      *
  383.      * Purpose:
  384.      *     Builds a collection of plugins that match the criteria
  385.      *
  386.      */
  387.     STDMETHOD(FindGroupOfPluginsUsingStrings)(THIS_ char* PropName1,
  388.     char* PropVal1,
  389.     char* PropName2,
  390.     char* PropVal2,
  391.     char* PropName3,
  392.     char* PropVal3,
  393.     REF(IHXPluginSearchEnumerator*) pIEnumerator);
  394.     /************************************************************************
  395.      * Method:
  396.      *     IHXPluginHandler3::GetPlugin
  397.      *
  398.      * Purpose:
  399.      *     Allocates a plugin based on index.  Supports aggregation
  400.      *
  401.      */
  402.     STDMETHOD(GetPlugin)(THIS_ ULONG32 ulIndex,
  403.     REF(IUnknown*) pIUnkResult,
  404.     IUnknown* pIUnkOuter );
  405.     /************************************************************************
  406.      * Method:
  407.      *     IHXPluginHandler3::FindPluginUsingValues
  408.      *
  409.      * Purpose:
  410.      *     Allocates a plugin based on criteria.  Supports aggregation
  411.      *
  412.      */
  413.     STDMETHOD(FindPluginUsingValues)(THIS_ IHXValues*,
  414.     REF(IUnknown*) pIUnkResult,
  415.     IUnknown* pIUnkOuter );
  416.     /************************************************************************
  417.      * Method:
  418.      *     IHXPluginHandler3::FindPluginUsingStrings
  419.      *
  420.      * Purpose:
  421.      *     Allocates a plugin based on criteria.  Supports aggregation
  422.      *
  423.      */
  424.     STDMETHOD(FindPluginUsingStrings)(THIS_ char* PropName1,
  425.     char* PropVal1,
  426.     char* PropName2,
  427.     char* PropVal2,
  428.     char* PropName3,
  429.     char* PropVal3,
  430.     REF(IUnknown*) pIUnkResult,
  431.     IUnknown* pIUnkOuter );
  432.     /************************************************************************
  433.      * Method:
  434.      *     IHXPluginHandler3::UnloadPluginFromClassID
  435.      *
  436.      * Purpose:
  437.      *     Finds a plugin from the classID and unloads it if it supports CanUnload2
  438.  * and returns TRUE in response to query
  439.      */
  440.     STDMETHOD( UnloadPluginFromClassID )( THIS_ REFGUID GUIDClassID );
  441.     /************************************************************************
  442.      * Method:
  443.      *     IHXPluginHandler3::UnloadPackageByName
  444.      *
  445.      * Purpose:
  446.      *     finds a package from the name passed in and attempts to unload it.
  447.      */
  448.     STDMETHOD (UnloadPackageByName) (const char* pName);
  449.     //------------------------------------ Class Methods
  450.     Errors     Stat(const char* pszFilename, struct stat* pStatBuffer);
  451.     IHXBuffer*     ChecksumFile(char* pszFileName, IHXBuffer* pPathBuffer);
  452.     IHXBuffer*     ConvertToAsciiString(char* pBuffer, UINT32 nBuffLen);
  453.     HX_RESULT     FindGroupOfPluginsUsingStrings(char* PropName1,
  454.     char* PropVal1,
  455.     char* PropName2,
  456.     char* PropVal2,
  457.     char* PropName3,
  458.     char* PropVal3,
  459.     REF(CPluginEnumerator*) pEnumerator);
  460.     HX_RESULT     FindGroupOfPluginsUsingValues(IHXValues* pValues,
  461.     REF(CPluginEnumerator*) pEnumerator);
  462.     void     ReportError( UINT8 severity, const char* pDLLName, const char* pDesc );
  463.     static const char* const zm_pszFileExtension;
  464.     static const char* const zm_pszDirectorySeperator;
  465.     static const char* const zm_pszValueSeperator;
  466.     static const char* const zm_pszListStart;
  467.     static const char* const zm_pszListEnd;
  468.     static const char* const zm_pszValueSeperator2;
  469.     static const char    zm_cDirectorySeperator;
  470.     static const char* const zm_pszKeyNameRegKey;
  471.     static const char* const zm_pszRegKeySeperator;
  472.     HX_RESULT ReloadPluginsNoPropagate();
  473.     HX_RESULT ReloadPluginsNoPropagateWithFindFile(
  474.                PluginMountPoint* pMountPoint, CFindFile* pFileFinder,
  475.                IHXBuffer* pPathBuffer, char* pszPluginDir);
  476.     HX_RESULT ReloadPluginsNoPropagate( PluginMountPoint* pMountPoint );
  477. private:
  478.     void UnloadDeadDLLs(void);
  479.     Errors     LoadDLL(char* pszDllName, PluginMountPoint* pMountPoint);
  480.     void     LoadPluginsFromComponentDLL( BaseHandler::PluginDLL* pPluginDll,
  481. IHXComponentPlugin* pIIterator );
  482.     // Methods to determine out of data DLLs
  483.     BOOL     FindPlugin(const char* pFileName, UINT32 nDLLIndex, REF(UINT32) nIndex);
  484.     HX_RESULT     AddToValues(IHXValues*, char* pPropName, char* pPropVal, eValueTypes eValueType);
  485.     HX_RESULT     RefreshPluginInfo( PluginMountPoint* pMountPoint );
  486.     CHXMapStringToOb     m_MountPoints;
  487.     CHXSimpleList     m_PluginDLLList;
  488.     CHXSimpleList     m_PluginList;
  489.     CHXSimpleList     m_MiscDLLList;
  490.     CHXMapStringToOb     m_GUIDtoSupportList;
  491.     IUnknown*     m_pContext;
  492.     class PluginMountPoint
  493.     {
  494.     public:
  495. PluginMountPoint( BaseHandler* pContext, const char* pName,
  496.   UINT32 majorVersion, UINT32 minorVersion,
  497.   IHXBuffer* pPath );
  498. ~PluginMountPoint();
  499. STDMETHOD_(ULONG32,AddRef)( THIS );
  500. STDMETHOD_(ULONG32,Release)( THIS );
  501. #if !defined(_STATICALLY_LINKED) || defined(HELIX_CONFIG_CONSOLIDATED_CORE)
  502. IHXBuffer* Path();
  503. #endif
  504.     private:
  505. #if !defined(_STATICALLY_LINKED) || defined(HELIX_CONFIG_CONSOLIDATED_CORE)
  506. IHXBuffer* m_pPath;
  507. #endif
  508. INT32 m_lRefCount;
  509.     };
  510.     class PluginDLL : public IUnknown
  511.     {
  512.     public:
  513. PluginDLL(const char* pszFileName, PluginMountPoint* pMountPoint,
  514.     BaseHandler* pBaseHandler);
  515. ~PluginDLL();
  516. /*
  517.  * IUnknown methods
  518.  */
  519. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj);
  520. STDMETHOD_(ULONG32,AddRef) (THIS);
  521. STDMETHOD_(ULONG32,Release) (THIS);
  522. Errors Load(IUnknown* pContext);
  523. HX_RESULT Unload(BOOL safe = TRUE);
  524. BOOL IsLoaded();
  525. Errors CreateInstance( IUnknown** ppUnk, UINT32 uIndex );
  526. UINT32 AddDLLReference();
  527. UINT32 ReleaseDLLReference();
  528. // Accessors
  529. void SetHash(char* phash) {m_hash = phash;}
  530. void SetFileSize(INT32 nSize) {m_nSizeBites = nSize;}
  531. PluginMountPoint* GetMountPoint() { return m_pMountPoint; }
  532. IHXBuffer* GetFileName();
  533. INT32 GetFileSize() { return m_nSizeBites; }
  534. void SetNamespace(IHXBuffer* pNamespace);
  535. IHXBuffer* GetNamespace();
  536. const char* GetHash() { return (const char*) m_hash; }
  537. CHXString const& GetPackageName () const { return m_packageName; }
  538. UINT32 GetNumPlugins() { return m_NumOfPlugins; }
  539. BOOL DoesExist() { return m_bDoesExist; }
  540.     private:
  541. FPCREATEINSTANCE m_fpCreateInstance;
  542. FPSHUTDOWN m_fpShutdown;
  543. FPCANUNLOAD2 m_fCanUnload;
  544. PluginMountPoint* m_pMountPoint;
  545. IHXBuffer* m_pFileName;
  546. IHXBuffer* m_pNamespace;
  547. CHXString m_packageName;
  548. CHXString m_hash;
  549. LONG32 m_nSizeBites;
  550. INT32 m_lRefCount;
  551. UINT16 m_NumOfPlugins : 16;
  552. HX_BITFIELD m_bHas_factory : 1;
  553. HX_BITFIELD m_bLoaded : 1;
  554. BOOL m_bDoesExist;
  555. DLLAccess* m_pDLLAccess;
  556. UINT32 m_nActiveReferences;
  557. BaseHandler* m_pBaseHandler;
  558.     };
  559.     class Plugin : public IUnknown
  560.     {
  561. public:
  562. STDMETHOD(QueryInterface) (THIS_
  563. REFIID riid,
  564. void** ppvObj);
  565. STDMETHOD_(ULONG32,AddRef) (THIS);
  566. STDMETHOD_(ULONG32,Release) (THIS);
  567. Plugin(IUnknown* pContext);
  568. ~Plugin();
  569. // Exposed to the BaseHandler
  570. void                        SetPluginProperty(const char * pszPluginType);
  571. BOOL     DoesMatch(IHXValues* pValues);
  572. Errors     GetValuesFromDLL(IHXPlugin* pHXPlugin);
  573. // Creates an instance of the top-level plugin object
  574. Errors     GetPlugin( REF(IUnknown*) ppUnknown );
  575. // Checks to see if this is a component plugin and does the appropriate indirection
  576. Errors     GetInstance(REF(IUnknown*) ppUnknown, IUnknown* pIUnkOuter = NULL );
  577. HX_RESULT     GetPluginInfo(REF(IHXValues*));
  578. IHXBuffer*     GetFileName();
  579. BOOL     IsLoaded();
  580. void     SetInfoNeedsRefresh(BOOL bRefresh) { m_bInfoNeedsRefresh = bRefresh;}
  581. void     SetDLL(PluginDLL * pPluginDll);
  582. PluginDLL*     GetDLL() {return m_pPluginDLL;}
  583. void     SetIndex(UINT16 nIndex);
  584. UINT16     GetIndex() {return m_nPluginIndex;}
  585. void     SetPropertyULONG32(char* , char*);
  586. void     SetPropertyCString(char*, char*);
  587. void     SetPropertyBuffer(char*, BYTE*, UINT32);
  588. // FIX  This is to support the initialization of component plugins
  589. void InitializeComponentPlugin( IHXPlugin* pIPlugin, IHXValues* pIValues );
  590. // void* because the client doesn't have these
  591. // XXXAH not supported currently...  They were not in the old plugin handler either...
  592. // must be some code in the server that talks directly to this (BLEECH!)
  593. void*     m_process;
  594.     private:
  595. LONG32     m_lRefCount;
  596. UINT16     m_nPluginIndex;
  597. PluginDLL*     m_pPluginDLL;
  598. IHXValues*     m_pValues;
  599. HX_BITFIELD     m_bCanUnload : 1;
  600. HX_BITFIELD     m_bInfoNeedsRefresh : 1;
  601. IUnknown*     m_pContext;
  602. IHXCommonClassFactory*     m_pClassFactory;
  603. // Methods to retreive from the DLL
  604. Errors     GetBasicValues(IHXPlugin* pHXPlugin);
  605. Errors     GetExtendedValues(IHXPlugin* pHXPlugin);
  606. // Support Functions
  607. HX_RESULT   CatStrings(char** pInStrings,
  608.        REF(IHXBuffer*) pOutBuffer);
  609. BOOL     AreBufferEqual(IHXBuffer* pBigBuff,
  610.    IHXBuffer* pSmallBuff);
  611. Errors     CreateWatcher(IUnknown* pUnknown);
  612.     };
  613.     class OtherDLL
  614.     {
  615.     public:
  616.     CHXString m_filename;
  617.     CHXString m_fileChecksum;
  618.     PluginMountPoint* m_pMountPoint;
  619.     };
  620. };
  621. class CPluginEnumerator :
  622.     public CUnknownIMP,
  623.     public IHXPluginSearchEnumerator
  624. {
  625. public:
  626.     CPluginEnumerator();
  627.     virtual ~CPluginEnumerator();
  628.     DECLARE_UNKNOWN_NOCREATE( CPluginEnumerator )
  629.     /*
  630.      * IHXPluginSearchEnumerator
  631.      */
  632.     STDMETHOD_(UINT32, GetNumPlugins)(THIS);
  633.     STDMETHOD_(void, GoHead)(THIS);
  634.     STDMETHOD(GetNextPlugin)( THIS_ REF(IUnknown*) pIUnkResult,
  635.     IUnknown* pIUnkOuter );
  636.     STDMETHOD(GetNextPluginInfo)( THIS_ REF(IHXValues*) pRetValues );
  637.     STDMETHOD(GetPluginAt)( THIS_ UINT32 index,
  638.     REF(IUnknown*) pIUnkResult,
  639.     IUnknown* pIUnkOuter );
  640.     STDMETHOD(GetPluginInfoAt)( THIS_ UINT32 index,
  641.     REF(IHXValues*) pRetValues );
  642.     //---------------- Class methods
  643.     void Add(BaseHandler::Plugin* pPlugin);
  644.     // FIX This is for backwards compatibility, and should be removed
  645.     HX_RESULT GetNext(REF(IUnknown*) pRetUnk);
  646. protected:
  647. private:
  648.     CHXSimpleList   m_ListOfPlugins;
  649.     UINT32     m_nIndex;
  650. };
  651. #endif /* _BASEHAND_H_ */