How to debug IE9 HTA?

岁酱吖の 提交于 2019-11-28 04:35:11

问题


Has anyone gotten a debugger attached to mshta.exe after installing IE9? (64bit or WOW64)


回答1:


I'm on a Vista x64, so I have to contend with the 32bit/64bit barrier.

HTA

  • c:\windows\system32\mshta.exe (mshta32)
  • c:\windows\syswow64\mshta.exe (mshta64)

Launching

  • "mshta32 foo.hta" may use mshta32 or mshta64 depending on what is associated with HTA
  • the same goes if "mshta64 foo.hta" is used
  • "cmd /C start foo.hta" would have the same affect.

Debugger

  • MS Script Editor (from Office XP/2003) for JS debugging in IE/HTA

Normally I would use the debugger keyword to initiate the launching of the debugger, however with IE9, it doesn't seem to do that anymore. I must launch the debugger first, attach to the mshta.exe process manually (only supports 32bit). Then everything appears to work fine!

EDIT:

With coworkers, different machine have exhibited different behaviors:

  • debugger keyword works fine
  • Connecting to MSHTA.EXE from the debugger doesn't work

I haven't yet found a silver bullet.




回答2:


If you have Visual Studio, go to Tools -> Attach to Process and attach to the MSHTA.EXE process. Then pick Script as the target to debug.




回答3:


Try using 'Stop' statement. This should raise the debugger dialog




回答4:


I had the same problem. Finally pieced together how to debug using Visual Studio from two sources

  1. Turn on script debugging through Internet Explorer, as described here and here
  2. Start up Visual Studio. Click on Debug -> Attach to Process
  3. Run the .hta file and select the running process from the Attach to Process dialog


来源:https://stackoverflow.com/questions/5397152/how-to-debug-ie9-hta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!