Asynchronous Pluggable Protocols

源代码下载

如果你用过Borland Developer Studio 2006,就会发现在Welcome Page的地址中显示的URL为"bds:/default.htm"。在Visual Studio 2003,同样会发现在起始页中联机资源的URL为"vs:/default.htm"(可以通过使用IE Source Viewer查看);另外在Microsoft Office InfoPath中设计或填写表单时,使用IE Source Viewer查看,其URL为"x-view://xxxx/default.htm"。

为什么会有这些奇怪的URL哪?

还有一些如下:
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/dnmsdn2/html/msdnstart.htm
mk:@MSITStore:C:\WINDOWS\Help\iis.chm::/iint1.htm
……

但是上面的两个URL可以在IE中访问,而bds:、vs:和x-view:则无法在IE中访问。为什么出现这么奇怪的现象哪?

带着这些疑问在Google上尝试了NN次关键字的组合,终于发现了一个技术很有嫌疑,名为"Asynchronous Pluggable Protocols"。

常见的应用层协议包括http、FTP等。另外,微软还允许用户在标准的应用层协议之外,扩展自己的协议,称为Asynchronous Pluggable Protocols(APPs)。APPs可以指定对所有进程有效,在注册表HKEY_CLASSES_ROOT\PROTOCOLS\Handler中进行协议定义;也可以指定只在某个进程内有效,不过这个时候微软就不叫它APPs了,而是称之为Pluggable Namespace Handler。

前面我们提到的bds:、vs:和x-view:是Pluggable Namespace Handler的实现。这些协议只允许在各自的进程中使用,所以无法在IE中访问。而ms-help:和mk:则是Asynchronous Pluggable Protocols的实现,可以在HKEY_CLASSES_ROOT\PROTOCOLS\Handler中找到,所以可以在IE中访问。解释了这些疑问之后,我饶有兴趣地实现了一个自定义协议tpp:。

如果继续研究APPs会发现,该技术还可以用于MIME过滤等。不过要求有IE 4.0或更高版本支持和URL monikers支持。

更多信息:
Build Simple Asynchronous Pluggable Protocols for Windows

Asynchronous Pluggable Protocols Reference
Asynchronous Pluggable Protocols Overview
IInternetProtocolRoot
IInternetProtocol
IInternetProtocolSink
EtcProtocol Demonstrates Pluggable Protocol Handler (From KnowledgeBase: never got this sample to work in VC5 or 6)

posted on 2005-12-10 00:19  Voidclass  阅读(2498)  评论(4编辑  收藏  举报

导航