I've created a BHO (32-bit, C++, linking dynamically against the VC++ 2005 runtime) - it's been installed on many machines, but occasionally I get a report back from a new user that it doesn't work. The BHO itself installs a menu item underneath the Tools menu and displays a dialog box when the menu item is selected, but the user isn't seeing the menu item.
I've tried to reproduce the bug myself but have not been able to. I've created several fresh/clean VM images, with different operating systems, with different versions of IE, and my add-on always works.
With the current report, I've asked the customer some questions about their environment and was told that they are running under WinXP, have the correct (and exact) matching VC++ runtime installed, and have full admin privileges. When they go into IE's "Manage Add-Ons" dialog box, my BHO is listed, yet they don't see the menu item underneath the Tools menu.
Since the correct VC++ runtime is installed, and the BHO appears in the add-on manager dialog box, I'm lead to believe that the DLL itself has been registered correctly. So that leads me to the question, why doesn't it appear in the menu? If I had access to the machine there's a number of things that I'd try, but since I don't, there's only so much I can do.
So my first question is, are there any idea as to why it isn't appearing?
Could there be a setting in "Internet Options" that is somehow blocking it? Like the "Disable toolbars and browser helpers when InPrivate browsing starts" option?
It seems to me that there are two bottlenecks (points of potential failure): the registration of the DLL, and the registry settings, but it appears that the DLL itself is correctly being registered, and the BHO registry settings are good also.
Next, I'd like to hear if anyone has any suggestions as to what to do in terms of troubleshooting this.
Some things I may try are:
1) create a custom build - one which has logging and tracing information and see what's going on in SetSite() and the startup code.
2) If that doesn't help, I'll create a new BHO which statically links against the VC++ runtime.
3) Maybe create a custom EXE that reads the registry and verifies that the registry settings for my BHO are present and are correct.
Thanks for any suggestions,
Yes! Use a log file. It will tell you at which point of the loading the BHO stops, and be sure to always log any and all errors.
Try loading the BHO using VBScript. A simple CreateObject() call will fail if the BHO is not registered correctly or a required dependency is missing.
If the user is willing to, ask him/her to install Dependency Walker and load the BHO using this tool. The tool will inform of any missing dependencies.
Jose R. MCP
I've been able to repro the issue on a test machine, and at the moment it's looking like the issue is due to IE's "Enable protected mode" option. I created several basic BHO DLLs, all based on "Building Browser Helper Objects with Visual Studio 2005" (http://msdn.microsoft.com/en-us/library/ie/bb250489%28v=vs.85%29.aspx). I originally thought the issue was with the VC++ runtime or with an unresolved DLL which couldn't be found, but that's not the issue - the DLLs are able to be registerd, and the DllMain() of each is executed when registered, yet the code isn't exectuted when IE runs (verified with log files).
After a lot of testing and troubleshooting, I've zeroed in on IE's "Enable protected mode" option. The BHOs are listed as being enabled (in IE's manage add-on dialog box). When the "Enable protected mode" option is on, none get executed. When I turn "Enable protected mode" off, close IE, then restart IE, the add-ons all work.
Now, I don't want to tell my customers they have to disable this feature in IE just to run a BHO, and I'd like to know more as to what's going on and why. I attempted to find the exact specific option to enable/disable in the dialog box... I enabled protected mode back on and went into the "Custom level" dialog box... I changed everything to "enabled", but when I restarted IE, the BHOs still wouldn't run.
What option in the custom level security setting dialog box controls wheither BHOs can execute or not?
It was a red hearing. In an effort to try and find out why my BHO is failing to appear on some customer's machines, I created a test BHO add-on based on the"Building BHO w/VS 2005" article, and added logging to try and find what methods were and weren't getting called. When I ran my test BHO on my Win7 machine using IE9, events were logged when the DLL was registered, but not when IE ran. When I ran IE, I didn't see any log files while protection mode was on. Turn it off and everything worked as expected.
Well, the issue in this case was that IE is sandboxing the files system. When I tried to write to a specific location, IE was instead mapping/invisibly converting the location into \AppData\Local\Microsoft\Windows\Temporary Internet Files\Virtualized\ .
So (for me) the good news is that on my local machine, everything runs fine. The bad news is that I'm back to remotely troubleshoot this issue. Just thought I'd post an update...