Issue with .cab file (ActiveX) installation on Windows Vista and 7

无人久伴 提交于 2019-12-20 02:12:59

问题


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:


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



来源:https://stackoverflow.com/questions/1769623/issue-with-cab-file-activex-installation-on-windows-vista-and-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!