canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Optional registration of Shell Extensions

Hello everyone,

all of our software installs without admin rights, except for a shell extension (to be registered with regsvr32 or equivalent), which is a non vital (so to speak "optional") component of our software. We always want it to be copied to the user's harddisk, but the registration with Windows should only be attempted on XP when the executing user is admin, or on Windows Vista if he desires so (and then he should be asked via security prompt (if he's admin) or be provided a login prompt to enter admin credentials).

So far I have only come up with the following approach, which I hope will work technically and satisfy the users by providing the simplest interface to the installation for them:

1) Having an installer for the shell extension (shell-ext installer)
2) Having an installer (main installer) for the software, which also installs the shell-ext installer (!), so that it can have a shortcut for later installation, should the user later decide for it.

The main installer has a "requested execution level" of "As Invoker" so it can be used and run non-elevated without security prompts.
The shell-ext installer will be included in the main installer and it will have a "requested execution level" of "Require Administrator".

The main installer will have a custom action before or after installation which asks the user wether he wants to register the shell extension (if he's admin on XP, or if he's on Vista).

At the end of the installation of the main installer, it executes the shell-ext installer - if the user decided for it (on XP as non-admin he does not get asked, but instead be told about executing the shell-ext installer as admin, should he want that).

Does that make sense? Did I miss something, is it too complicated, or can anyone suggest an alternative route?



Thanks in advance for your feedback.



With best regards

Clemens Anhuth
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Optional registration of Shell Extensions

Hi Clemens,

Your approach is good and it should work if you implement it correctly. Also, I don't see another option because of the way Vista works (the package can be elevated only when it is launched, not during the installation).

Here are some tips which may help you:
- you can use a custom dialog or a Yes/No message box to ask the user about registering the shell extension
- the property set by the custom dialog or by the message box can be used to condition the custom action which launches the shell extension package
- you should use the Privileged property to determine if the user can register the shell extension on XP; this property can be used as a control condition for the checkbox (to disable it) or as a condition for the custom action which shows the Yes/No message box
- the custom action which launches the shell extension package must be set with the "Asynchronous execution, do not wait for return" option

If you encounter problems with this approach or you have other questions, don't hesitate to ask.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Re: Optional registration of Shell Extensions

Thank you Cosmin, I will try that, after the main installer is done.

With best regards

Clemens Anhuth

Return to “Common Problems”