This week I've needed to install (register) a COM component with a non Admin account. In principle COM components write their corresponding CLID entries (when you register them through regsvr32 or when they come with a specific installer that in the end I guess also calls regsvr32) to the registry in HKEY_LOCAL_MACHINE (HKLM), and non Admin users have not write access there. I think you can change this behaviour when compiling the Component, but this was not an option for me as it was a third party COM component (the microsoft DSO component).
After some searching I found that if you write these entries to HKEY_CURRENT_USER (HKCU) rather than HKLM, that user should be able to use the component without a problem. The main problem is to make sure of how many entries have to be written. Well, in the end it turned out to be pretty simple, thanks to this excellent free tool (RegFromApp). I just had to run the DSO installer (with an admin account) through the tool and I got a .reg file with all the entries that had been written. As expected the entries had been written to HKEY_LOCAL_MACHINE. If you replace in the .reg file those HKEY_LOCAL_MACHINE with HKEY_CURRENT_USER, you can use that .reg to install the component with a non Admin user account, and that user will be able to use the COM successfully. A pretty simple procedure that spared us a big problem at work.
I had not much clear the relation between HKLM, HKCU and HKCC, so this entry in Wikipedia turned quite interesting:
HKEY_CLASSES_ROOT (HKCR)
No comments:
Post a Comment