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

给你一囗甜甜゛ 提交于 2019-12-01 20:30:47

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

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