您的位置:首页 > 移动开发

Apply wininet dbg version to an app build with vs2008.

2009-07-29 09:48 453 查看
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:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable></noInheritable>
<assemblyIdentity type="win32" name="wininet.dbg" version="6.0.2900.2180" processorArchitecture="x86" ></assemblyIdentity>
<file name="wininet.dll" />
</assembly>


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

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

#pragma comment(linker, "/manifestdependency:/"type='win32' name='wininet.dbg' version='6.0.2900.2180' processorArchitecture='x86' language='*'/"")


注意, 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐