Apply wininet dbg version to an app build with vs2008.

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章