views:

689

answers:

2

I have made an ActiveX control and have made its .cab file for automatic installation on client machine using Internet Explorer.. It working fine of Windows XP, but on windows Vista and Windows 7 its installation is blocked by UAC (User account control), and when I disable it, all things works fine... I have signed my .cab file with a certificate for development enviornment... What is the way to over come this problem.. I don't want to tell users to disable their UAC module...

+1  A: 

Most likely this is because you're trying to register your control in HKEY_LOCAL_MACHINE, which is the default in ATL. If you change your control to register in HKEY_CURRENT_USER (the only part of the registry accessible when UAC is enabled and you aren't elevated), you should be fine.

If you're using VS2008 and ATL, you can do this by calling:

AtlSetPerUserRegistration(perUser);

In older versions, you need a little more of a hack. Here is a class that we used to solve the issue in FireBreath, a cross-browser plugin framework I help maintain:

http://code.google.com/p/firebreath/source/browse/src/ActiveXPlugin/axutil.cpp http://code.google.com/p/firebreath/source/browse/src/ActiveXPlugin/axutil.h

then you just have to put: FbPerUserRegistration perUser(true); in your DllRegisterServer and DllUnregisterServer entrypoints.

Alternately (I don't use .cab installs, so I haven't tried this), but there is a document on msdn that discusses ways to modify your .cab install to do this, that shouldn't require modification of your control:

http://msdn.microsoft.com/en-us/library/dd433049%28VS.85%29.aspx

Another quick note, you can use Process Monitor to see what keys you are using when you register your control; it takes some practice fiddling with the filters, but once you get the hang of it it's not bad. If you're writing to HKCR (HKEY_CLASSES_ROOT) that will by default put things in HKEY_LOCAL_MACHINE/Software/Classes. What you want to do (to avoid problems with not having administrator privileges) is to put the keys in HKEY_CURRENT_USER/Software/Classes.

Hope that helps

Taxilian
A: 

The methods above did not work for me.

I have an active x control (compressed as cabinet file) which I want to install over web under windows 7.

The same cabinet file works for Windows XP. It works under Windows 7, only if I disable UAC (which I dont prefer).

As said, I tried all the methods above (including cab file with modified INF file).

In my source code, I changed all references to HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE. This did not change anything.

skol