IE Toolbar Crashing under UAC

Add-in Express™ Support Service
That's what is more important than anything else

IE Toolbar Crashing under UAC
 
andrew.helgeland


Guest


So, I've run into a very strange problem. It's very similar to http://stackoverflow.com/questions/2230982/webbrowser-navigate-throws-comexception/15092209#15092209

Up until now I haven't seen this happen, but here's a brief overview:

My toolbar updates from a web service, saves the json response to Temporary Internet Files\Low\CompanyName\data.txt.
Then it rebuilds it's dropdowns and links using this data.
This all works just fine, however, after updating, it can only navigate to some links. Others cause the entire toolbar to crash. This happens only with UAC turned on.
Running IE as administrator fixes the problem.
Running the debugger, no exception is thrown, it just crashes.
It crashes at the line IEApp.Navigate2(url)

Using IE in Protected Mode, it also crashes, however the ProtectedModeApi.LaunchURL(url) method actually throws a Win32Exception: "There are no more files"

IEApp.Busy is false before navigating.
IEApp.Stop() before navigating does not fix this.
Only certain URL's cause this crash.

I can send you a copy of my add-on, but it might be a bit overwhelming, and I would need an email address to send it to.

Windows 7, UAC On, VS 2012 Premium (as admin), AIX Premium

Any help is greatly appreciated.
Posted 26 Feb, 2013 09:12:01 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Andrew,

What exactly urls produce such an issue? You can send them by e-mail if you wish.
Did you test the code in the Visual Studio debugger? Probably you pass an incorrect url string to the Navigate2 method. Please check it in the debugger.
Posted 26 Feb, 2013 11:44:01 Top
andrew.helgeland


Guest


I've tried in the debugger. It just dies on the navigate method, no exception, no warning.

I added the site to the "trusted sites" in internet options, and it works fine then. I think this has something to do with UAC and IE Protected Mode.

The urls are actually anything external to my company. Google, for instance. I'm working on testing it on some external boxes, and I'm not running into the same issues.

Is there anything wrong with just always using the ProtectedModeAPI.LaunchURL, even when not in protected mode?
Posted 26 Feb, 2013 14:06:31 Top
andrew.helgeland


Guest


Actually, ProtectedModeAPI.LaunchURL opens the links in a new window. When you close the window it leaves two iexplore.exe zombie processes running. Why is this happening?
Posted 26 Feb, 2013 15:05:45 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Andrew,

Do you have a test project that reproduces the issue?
ProtectedModeAPI class is designed to work when Protected Mode is on. Please don't use it when PM is off.

Actually, ProtectedModeAPI.LaunchURL opens the links in a new window. When you close the window it leaves two iexplore.exe zombie processes running. Why is this happening?

One process is the main process of IE and other processes handle remaining IE tabs.
Posted 27 Feb, 2013 03:15:27 Top
andrew.helgeland


Guest


So, I've figured out the underlying issue here.

First off, the above issue with the toolbar crashing for certain links was due to protected mode, and different settings between Internet and Intranet. Instead of being able to resolve that issue, it's actually uncovered more issues..

The problem now is this:

My toolbar calls a .NET web service which responds with JSON for updates, and the toolbar rebuilds it's dropdowns' text and links from the response.

The web service is added to my toolbar project as a "Web Reference". In protected mode, an exception is thrown when instantiating the web service class.

Is there a way to use a web service from within protected mode? Do you know why this is happening? Is there a way to manually POST to a URL using the ProtectedModeAPI instead of using a web reference?
Posted 27 Feb, 2013 14:56:39 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Andrew,

To resolve the issue with the web service you just need to enable the 'Generate serialization assembly' option in your project (just set it to 'On'). In this case the serialization assembly will be created automatically when you build the project. You also need to deploy this assembly in the same location with the add-on assembly.
Posted 28 Feb, 2013 07:07:01 Top
andrew.helgeland


Guest


Well, now I'm pretty close to having my project work under both Protected Mode and non-Protected Mode. :)
Thank you very much for your answers, just one last question (hopefully)..

My toolbar has a settings dialog which is just a simple Windows Form with a webbrowser control in it. The webbrowser control dies when navigating to the page in Protected Mode. Probably because it's just another instance of IE, but it's not being opened in Protected Mode. I've found quite a few posts about this issue from 2007, and no actual answers anywhere..

I also cast the WebBrowser control as an ActiveXInstance to force the zoom setting to 100%:
((Interop.SHDocVw.WebBrowser)webBrowser1.ActiveXInstance).ExecWB(OLECMDID_OPTICAL_ZOOM, Interop.SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, 100, IntPtr.Zero);


And add an event handler for navigate errors in the dialog's constructor:
Interop.SHDocVw.WebBrowser instance = (Interop.SHDocVw.WebBrowser)webBrowser1.ActiveXInstance;
            instance.NavigateError += new Interop.SHDocVw.DWebBrowserEvents2_NavigateErrorEventHandler(WebBrowser_NavigateError);


Is there a way to open a WebBrowser control in Protected Mode and still accomplish the above (and also intercept the document completed and click events)?
Posted 28 Feb, 2013 08:52:20 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Andrew,

I don't see any issues with the System.Windows.Form.WebBrowser control on a modal form in IE.
Please provide the code that you use to display the form.
Posted 28 Feb, 2013 10:34:32 Top
andrew.helgeland


Guest


Hey, you're right. My mistake. I was having problems for a different reason.

Thanks a lot for your help.
Posted 28 Feb, 2013 16:52:37 Top