views:

52

answers:

1

Hello,

I am writing a program that is used for simplifying the download of an application installer. The app is really simple in it's working: it just asks the BITS subsystem to download a ZIP from the net and decompress it on the user's desktop and run the second stage installer (the idea is that many of our end users are too dumb to be trusted with a ZIP download link and instructions on how to install the program).

Now, if a user runs IE 7+ in Vista/7, has UAC enabled and selects "execute" instead of "save as", then the program fails. In fact, all attempts to write to the file system or the registry fails due to IE's protected mode.

In order to work around this, I've tagged the executable to trigger a UAC prompt, which works fine. However, it will now trigger the prompt even if that trigger is unnecessary: the program is designed to do the download in the background and resume downloads if the user closes his session before it is done. Now, the UAC prompt is triggered every time the executable is launched.

I would like to detect the fact that I'm running inside the sandbox and, in that case, restart the process, this time with a UAC prompt (easy enough to do). I don't know how I can detect that situation, however, short of attempting to write to the registry.

Any idea ?

+1  A: 

Call the IEIsProtectedModeProcess function.

A good document covering IE's protected mode is Understanding and Working in Protected Mode Internet Explorer.

glob
I believe API is only available from within the IE process, not from spawned processes.
Stephane