I am working on a task not to prompt a normal user a popup(UAC) for approval to install windows Addin application while registering a .net assembly during installation using instalshield. On windows xp, its working fine but during installation on vista and windows 7, a popup comes up for approval. As per the requirement, it shouldnt come. Is there any way to bypass this pop up on vista and windows 7 if UAC is on and registered the assembly per user without administrator privileges?
Kindly help?
Thank You.
Actually, COM can be registered per-user or per-machine as HKEY_CLASSES_ROOT is a view derived from both HKEY_CURRENT_USER\Software\Classes and HKEY_LOCAL_MACHINE\Software\Classes. If you run regasm /regfile:foo.dll you can generate a regfile and then change all the references in the key names to make it local to the current user.
In the .reg file that gets generated, all the reg key additions will be to HKEY_CLASSES_ROOT. You need to replace these with "HKEY_CURRENT_USER\Software\Classes".
Also if you need the COM registration to work with 32 bit applications and you're running x64, then for additions to HKEY_CLASSES_ROOT\CLSID, you'll need to insert "\Wow6432Node" before the CLSID token like.
To be clear, additions to "HKEY_CLASSES_ROOT\CLSID" become "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID". To make it work on x86 you only need to make this change for CLSID entries.
Also, in certain situations, you can consider making use of Registration Free COM Interop by creating a manifest file for the EXE that consumes the COM server to make the ProgID/ClassID's available to the EXE without actually writing the registration information to the registry.
This is a common mistake among developers which are not familiar with elevation and user privileges.
The assembly you are installing is registered per-machine. This is why it requires elevation for its registration process. It's also elevated on XP, but you don't see if because its automatic. If you would run the installation under a normal user account, it would fail because of insufficient privileges.
Since this assembly was designed to be registered per-machine, why are you trying to change its behavior? It's like trying to modify Windows to support your application. You adapt to the environment, not the other way around.
So the correct solution would be to use a per-machine installer. This way your installation process will be installed for all users and will always require Administrator privileges.
Per-user installations are designed for products which use only per-user locations. If you are installing resources in a per-machine location, then you should use a per-machine installation.