Apply wininet dbg version to an app build with vs2008.

来源:互联网 发布:mac不知管理员名称密码 编辑:程序博客网 时间:2024/06/13 09:04

keyword: wininet.dll urlmon.dll debug version iexplore.exe.local Microsoft.VC90.ATL.manifest Microsoft.VC90.CRT.manifest msvcr90.dll atl90.dll

 

在 side-by-side component 之前, 运用 Dynamic-Link Library Redirection, 你可以很容易的使用 wininet.dll/urlmon.dll 的 debug 版来调试程序. 只需要在程序(app.exe) 所在的目录创建一个 app.exe.local, 然后把 debug 版的 wininet.dll 放到这个目录, 设置环境变量 SET WININETLOG=1, 运行程序就能生成一个 wininet log 文件了.

 

但如果你的程序是 vs2008 编译的, 就会发现这个方法不好使了. Ref[2] 中提到这么一句.

"If the application has a manifest, then any .local files are ignored."

 

要想让你的 vs2008 编译的新程序也能使用 debug 版的 wininet.dll. 你必须使用 manifest 文件. 将下面的 code 保存为 wininet.dbg.manifest:

注意其中的版本号, 要和你的 debug wininet.dll 的版本一致. 注意 assemblyIdentity 中的 name 属性.  file 节点在这里是必须的. 指定是哪个 dll.

 

在你的程序的代码这加入下面这段: 

注意, name 属性 wininet.dbg 要和上面的 xml 文件中的 assemblyIdentity name 属性保持一致. 并且和 wininet.dbg.manifest 的文件名保持一致. 三个地方出现的 wininet.dbg 可以替换成任意字符串, 除了 wininet

 

在测试这个 manifest 文件的时候, process monitor 帮了很大的忙.

 

 

Reference:

1. How to use the debug version of the Wininet.dll file for Internet Explorer

http://support.microsoft.com/kb/884931

 

2. Dynamic-Link Library Redirection

http://msdn.microsoft.com/en-us/library/ms682600(VS.85).aspx

 

3. Isolated Applications and Side-by-side Assemblies

http://msdn.microsoft.com/en-us/library/aa375193(VS.85).aspx

原创粉丝点击