[译].NET程序集的Shell扩展
By robot-v1.0
本文链接 https://www.kyfws.com/applications/shell-extensions-for-net-assemblies-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 5 分钟阅读 - 2472 个词 阅读量 0[译].NET程序集的Shell扩展
原文地址:https://www.codeproject.com/Articles/2910/Shell-Extensions-for-NET-Assemblies
原文作者:Heath Stewart
译文由本站 robot-v1.0 翻译
前言
Shell extensions to distinguish between .NET assemblies and Win32 applications and libraries.
Shell扩展,用于区分.NET程序集和Win32应用程序和库.
- 下载源程序包(压缩)-33 Kb(Download source package (zipped) - 33 Kb)
- 下载Windows Installer程序包(压缩)-326 Kb(Download Windows Installer package (zipped) - 326 Kb)
关于.NET程序集的Shell扩展(About the Shell Extensions for .NET Assemblies)
编写这些Shell扩展程序是为了帮助区分.NET程序集和Win32库,并提供有关程序集的更多信息,而不必使用命令提示符来使用SDK和CLR工具.这些Shell扩展的功能类似于加载程序,该加载程序使.NET和VB(.NET之前)都可以作为可执行代码:PE/COFF标头.因此,该库非常快,不会妨碍您的文件系统浏览体验.最近的更新通过跳过慢速路径(例如UNC路径或驱动器通过VPN到远程文件系统的映射)上的程序集检测进一步提高了性能.(These shell extensions were written to help distinguish between .NET assemblies and Win32 libraries, as well as give extra information about the assemblies without having to drop to a command-prompt to use the SDK and CLR tools. These shell extensions function similar to the loader that makes both .NET and VB (pre-.NET) possible as executable code: the PE/COFF header. As such, the library is very fast and won’t hinder your file system browsing experience. A recent update further enhances performance by skipping assembly detection on slow paths, such as UNC paths or drive mappings to remote filesystems via VPN.)
该库中提供:(Provided in this library are:)
- .NET程序集(.dll)的覆盖图标(Overlay icons for .NET assemblies (.dll))
- 列处理程序,用于显示公共密钥令牌和.NET程序集的特定类型.(Column handlers to show the public key token and specific type of .NET assemblies.)
- 用于在您自己的应用程序和库中获取上述信息的自动化对象.(Automation object for getting the above information in your own applications and libraries.)
自动化对象(The Automation Object)
该工具不仅可以帮助您区分.NET程序集和Win32应用程序和库,而且还为您提供了这些Shell扩展使用的简单自动化对象.(Not only does this tool help you distinguish between .NET assemblies and Win32 applications and libraries, but it also provides you with a simple automation object that these shell extensions use.)
要从类型库生成代码,请添加引用或(To generate code from the type library, add a reference or) #import
类型库名为" AsmShell 1.0类型库".使用成员(the type library named “AsmShell 1.0 Type Library”. Use the members of the) IAssemblyInfo
自动化界面如下:(automation interface as follows:)
IAssemblyInfo::IsAssembly([in]BSTR path, [out, retval]VARIANT_BOOL* retVal)
退货(Returns)true
如果指定的文件是程序集,(if the specified file is an assembly,)false
如果不是,则在出现问题时引发错误.(if it is not, and raises errors when problems occur.)IAssemblyInfo::GetFileType([in]BSTR path, [out, retval]FileType* retVal)
返回一个(Returns a)FileType
枚举成员,具体取决于PE/COFF标头中指定文件的信息.(enumeration member depending on the information for the specified file in the PE/COFF header.)IAssemblyInfo::GetPublicKeyToken([in]BSTR path, [out, retval]BSTR* retVal)
返回指定程序集的公钥令牌.(Returns the public key token for the specified assembly.)IAssemblyInfo::GetPublicKey([in]BSTR path, [out, retval]SAFEARRAY(BYTE)* retVal)
以指定程序集的字节数组形式返回公钥. JScript或VBScript不支持此功能,它们都仅支持一组VARIANT.(Returns the public key as a byte array for the specified assembly. This is not supported by JScript or VBScript, both of which only support an array of VARIANTs.) 对于每种方法,后期绑定语言(如Visual Basic)将使用返回值(标记为[out,retval])作为方法的返回类型,也不再需要使用上面指定属性标记的参数.(For each method, late-binding languages like Visual Basic will use the return value (marked with [out, retval]) as the return type of the method, also getting rid of the need for the parameter labeled with the specified attributes above.)
因此,在VB6和.NET(C#,VB.NET等)中,方法签名如下所示:(So, in VB6 and .NET (C#, VB.NET, et. al.), the methods signatures would look like:)
bool IsAssembly(string path);
FileType GetFileType(string path);
string GetPublicKeyToken(string path);
byte[] GetPublicKey(string path);
要求(Requirements)
如果当前正在加载正在安装的文件,则可能需要重新引导.如果您使用的是Windows XP,并且先前的条件为false,则无需重新启动.如果您使用的是Windows 98,ME或2000,则应先注销然后重新启动,或者在没有覆盖图标的情况下重新启动系统.安装完成后,列处理程序应立即准备就绪.(You may be required to reboot if files being installed are currently loaded. If you have Windows XP and the previous condition is false, no reboot should be necessary. If you’re using Windows 98, ME, or 2000, you should either log off and back on or reboot your system if the overlay icon is not present; the column handlers should be ready immediately after the installation is finished.)
变化(Changes)
-
2005年11月17日(November 17, 2005)
- 注意:较早版本的最新文章更新(Note: late article update for an earlier release)
- 添加了对显示程序集的x86(和MSIL)以及IA64和x64的支持(Added support to display x86 (and MSIL) for assemblies, as well as IA64 and x64)
-
2005年5月30日(May 30, 2005)
- 添加了对Windows Me的支持(Added support for Windows Me)
- 添加了GetPublicKey方法(Added GetPublicKey method)
- 修复了在Windows资源管理器中对公钥令牌列进行排序时发生的崩溃错误(Fixed crashing bug when sorting public key token column in Windows Explorer)
- 性能增强(Performance enhancements)
- 看到(See) http://blogs.msdn.com/heaths/archive/2005/05/30/423293.aspx(http://blogs.msdn.com/heaths/archive/2005/05/30/423293.aspx) 了解更多信息.(for more information.)
-
2004年8月29日(August 29, 2004)
- 增加了定位能力(Added localizability)
- 字符串缓存以获得更好的性能(String caching for better performance)
- 支持.NET模块(.netmodule)(Support for .NET modules (.netmodule))
-
2003年10月15日(October 15, 2003)
- 增加了条件,即不应为慢速路径解析文件(例如:VPN)(Added condition that files should not be parsed for slow paths (ex: VPN))
-
2002年9月19日(September 19, 2002)
- 最初发布到The Code Project上的网络(Initial release to the web on The Code Project)
免责声明(Disclaimer)
本软件按"原样"提供,不提供任何明示或暗示的担保,包括但不限于针对特定目的的适销性和适用性的暗示担保.在任何情况下,作者或他的贡献者均不对任何直接,间接,偶发,特殊,特殊或后果性的损害(包括但不限于,替代商品或服务的购买,使用,数据或利润的损失)承担责任.或业务中断),无论基于合同,严格责任或侵权行为(包括疏忽或其他方式),无论是否出于任何责任,都应通过使用本软件的任何方式(即使已事先告知)进行了赔偿.(THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
VC7.1 C++ VC7.0 WinXP Windows Win2K Visual-Studio VS.NET2003 QA Dev 新闻 翻译