📄 plghand2.h
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: plghand2.h,v 1.5.36.1 2004/07/09 02:07:18 hubbe Exp $ * * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. * * The contents of this file, and the files included with this file, * are subject to the current version of the RealNetworks Public * Source License (the "RPSL") available at * http://www.helixcommunity.org/content/rpsl unless you have licensed * the file under the current version of the RealNetworks Community * Source License (the "RCSL") available at * http://www.helixcommunity.org/content/rcsl, in which case the RCSL * will apply. You may also obtain the license terms directly from * RealNetworks. You may not use this file except in compliance with * the RPSL or, if you have a valid RCSL with RealNetworks applicable * to this file, the RCSL. Please see the applicable RPSL or RCSL for * the rights, obligations and limitations governing use of the * contents of the file. * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL") in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your version of * this file only under the terms of the GPL, and not to allow others * to use your version of this file under the terms of either the RPSL * or RCSL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient may * use your version of this file under the terms of any one of the * RPSL, the RCSL or the GPL. * * This file is part of the Helix DNA Technology. RealNetworks is the * developer of the Original Code and owns the copyrights in the * portions it created. * * This file, and the files included with this file, is distributed * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET * ENJOYMENT OR NON-INFRINGEMENT. * * Technology Compatibility Kit Test Suite(s) Location: * http://www.helixcommunity.org/content/tck * * Contributor(s): * * ***** END LICENSE BLOCK ***** */#ifndef _PLGNHAND_H_#define _PLGNHAND_H_#include "hxslist.h"#include "hxplugn.h"#include "hxstring.h"#include "hxguidmap.h"#include "hxprefs.h"#include "hxengin.h"#include "hxcomm.h" #include "hxerror.h"#include "hxphand.h"#include "dbindex.h"#include "unkimp.h"typedef HX_RESULT (HXEXPORT_PTR FPCREATEINSTANCE) (IUnknown** /*OUT*/ ppIUnknown);typedef HX_RESULT (HXEXPORT_PTR FPSHUTDOWN) ();typedef HX_RESULT (HXEXPORT_PTR FPCANUNLOAD2) ();typedef ULONG32 (STDMETHODCALLTYPE *FPWatchRef)(void*);typedef HX_RESULT (STDMETHODCALLTYPE *FPQueryInterfaceWatch)(void*, REFIID riid,void** ppvObj);// This is the new and improved plugin handler. // What is better in this version // (1) Unified Plugins No longer do you have to modify code in seven places when a bug // appears. Simply modify the Plugin Class. It is the heart of the plugin Handler.// (2) The plugin handler now has rudimentary ref counting of the DLLs which it loads.// This means that we cannot (almost) safely shutdown the player. Further, we can// ALMOST unload DLLs when they are not required anymore. class Plugin2Handler;class DLLAccess;class CPluginEnumerator;class CPluginInfoWriter;// you want GUIDS? WE have GUIDS!DEFINE_GUID(IID_IHXPluginWatcherResponse, 0x00000C08, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);DECLARE_INTERFACE_(IHXPluginWatcherResponse, IUnknown){ /* * IUnknown methods */ STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj) PURE; STDMETHOD_(ULONG32,AddRef) (THIS) PURE; STDMETHOD_(ULONG32,Release) (THIS) PURE; /************************************************************************ * Method: * IHXPluginWatcherResponse::AllObjectsDeleted * Purpose: * This function will be called all objects of the given class are * destroyed. */ STDMETHOD(AllObjectsDeleted) (THIS_ void*) PURE;};class Plugin2Handler : public CUnknownIMP, public IHXPluginEnumerator, public IHXPluginReloader, public IHXPlugin2Handler, public IHXPlugin2HandlerEnumeratorInterface, public IHXPluginHandler3, public IHXPluginDatabase, public IHXCallback{ // forward declarations? // see note below class PluginMonitor; class PreferenceEnumerator; class PluginMountPoint; class PluginDLL; class Plugin; class OtherDLL; class PluginSupportingGUID; friend class CPluginEnumerator; friend class PreferenceEnumerator; friend class PluginDLL; friend class Plugin; friend class PluginSupportingGUID; friend class OtherDLL;public: enum Errors { NO_ERRORS = 0, PLUGIN_NOT_FOUND, MEMORY_ERROR, CANT_OPEN_DLL, BAD_DLL, CREATE_INSTANCHXR_FAILURE, CANT_DETERMINE_PLUGIN_DIR, CANT_OPEN_PLUGIN_DIR, BAD_PLUGIN, INVALID_CONTEXT, CANT_GET_FILE_FORMAT_INFO, CANT_GET_RENDERER_INFO, CANT_GET_FILE_SYSTEM_INFO, CANT_LOAD_INTERFACE, SHORT_NAME_NOT_FOUND, PLUGIN_ALREADY_HAS_MOUNT_POINT, INVALID_SHORT_NAME, BAD_REGISTRY_HANDLE, PLUGIN_DIR_NOT_SAME, REQUIRED_PLUGIN_NOT_LOADED, NO_HX_CREATE_INSTANCE, AGGREGATION_NOT_SUPPORTED }; enum eValueTypes { eString, eBuffer, eInt }; DECLARE_UNKNOWN_NOCREATE( Plugin2Handler ) DECLARE_COM_CREATE_FUNCS( Plugin2Handler ) Plugin2Handler(); ~Plugin2Handler(); /* * IHXCallback methods */ STDMETHOD ( Func ) ( THIS ); /* * IHXPluginEnumerator methods */ /************************************************************************ * Method: * IHXPluginEnumerator::GetNumOfPlugins * * Purpose: * return the number of plugins available * */ STDMETHOD_(ULONG32,GetNumOfPlugins) (THIS); /************************************************************************ * Method: * IHXPluginEnumerator::GetPlugin * Purpose: * return an instance(IUnknown) of the plugin * */ STDMETHOD(GetPlugin) (THIS_ ULONG32 /*IN*/ ulIndex, REF(IUnknown*) /*OUT*/ pPlugin); /* * IHXPluginReloader methods */ /************************************************************************ * Method: * IHXPluginReloader::ReloadPlugins * * Purpose: * reloads plugins * */ STDMETHOD(ReloadPlugins) (THIS); /* * IHXPlugin2Handler */ /************************************************************************ * Method: * IHXPlugin2Handler::Init * * Purpose: * Specifies the context and sets the Plugin2Handler in motion. * */ STDMETHOD(Init) (THIS_ IUnknown* pContext); /************************************************************************ * Method: * IHXPlugin2Handler::GetNumPlugins2 * * Purpose: * Gets the info of a particular plugin. * */ STDMETHOD_(ULONG32,GetNumOfPlugins2) (THIS); /************************************************************************ * Method: * IHXPlugin2Handler::GetPluginInfo * * Purpose: * Gets the info of a particular plugin. * */ STDMETHOD(GetPluginInfo) (THIS_ UINT32 unIndex, REF(IHXValues*) /*OUT*/ Values) ; /************************************************************************ * Method: * IHXPlugin2Handler::FlushCache() * * Purpose: * Flushes the LRU cache -- Unloads all DLLs from memory * which currenltly have a refcount of 0. */ STDMETHOD(FlushCache) (THIS); /************************************************************************ * Method: * IHXPlugin2Handler::SetCacheSize * * Purpose: * This function sets the size of the Cache. The cache is * initally set to 1000KB. To disable the cache simply set * the size to 0.If the cache is disabled a DLL will be * unloaded whenever it's refcount becomes zero. Which MAY * cause performance problems. */ STDMETHOD(SetCacheSize) (THIS_ ULONG32 nSizeKB); /************************************************************************ * Method: * IHXPlugin2Handler::ReadFromRegistry * * Purpose: * Reload the DLL information from the registery. It will also * Check to see if this information is valid, and if */ STDMETHOD(ReadFromRegistry)(THIS); /************************************************************************ * Method: * IHXPlugin2Handler::GetInstance * * Purpose: * * This function will return a plugin instance given a plugin index. * */ STDMETHOD(GetInstance) (THIS_ UINT32 index, REF(IUnknown*) ppUnknown); /************************************************************************ * Method: * IHXPlugin2Handler::FindReturnIndexUsingValues * * Purpose: * Finds a plugin which matches the set of values given. An index * is returned which can be used to either get the values (using * GetPluginInfo) or an instance can be created using GetPluing(). * */ STDMETHOD(FindIndexUsingValues) (THIS_ IHXValues*, REF(UINT32) unIndex); /************************************************************************ * Method: * IHXPlugin2Handler::FindReturnPluginUsingValues * * Purpose: * Finds a plugin which matches the set of values given. A Plugin * instance is returned. * */ STDMETHOD(FindPluginUsingValues) (THIS_ IHXValues*, REF(IUnknown*) pUnk); /************************************************************************ * Method: * IHXPlugin2Handler::FindReturnIndexUsingStrings * * Purpose: * Finds a plugin which matches the set of values given. An index * is returned which can be used to either get the values (using * GetPluginInfo) or an instance can be created using GetPluing(). * NOTE: that a max of two values may be given. */ STDMETHOD(FindIndexUsingStrings) (THIS_ char* PropName1, char* PropVal1, char* PropName2,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -