Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Outlook Addin denied Access to Registry

Morning all,
I have an Outlook addin that attempts to write to the registry under "HKLM\Software\companyname\companyproduct".

My domain account is in the administrators groups

The system is running a fully updated version of Vista.

Application developed in VB .NET

The addin adds a button to a new mail message. When the button is clicked the application atempts to read/write from the above hive. If it isn't there is attempts to create it.

When I run Outlook, click the new mail button, and click the Addin button, I get an Access is denied to "HKLM/sofware/companyname/companyproduct" error. However, when I right click outlook and select "run as administrator" it runs fine and writes to the registry no problem.

Another test i ran is to put the same code into a seperate windows application and run it that way. When I do that the values are written to "HKU\someuserid\SOFWARE\CLASSES\VirtualStore\Machine\Sofware\companyname\companyproduct". I know this has something to do with the Vista Virtualization "feature"

Any help would be great, pulling my hair out here.

Thanks
ThePope
[1171 byte] By [ThePope78705] at [2007-11-11 10:29:41]
# 1 Re: Outlook Addin denied Access to Registry
Did you write this add-in? If so, you should modify the code so that it saves its settings to HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE. If you didn't write it, contact the vendor and report this behavior as a bug: http://www.microsoft.com/technet/technetmag/issues/2006/08/LUABugs/
Phil Weber at 2007-11-11 20:47:39 >
# 2 Re: Outlook Addin denied Access to Registry
Yes, I did write the add-in. However, the value being stored under HKLM needs to be accessible by other users, not just the current one.
ThePope78705 at 2007-11-11 20:48:34 >
# 3 Re: Outlook Addin denied Access to Registry
Is it possible to have the installer write the value(s) to HKLM? Then the add-in will not require an admin account. The bottom line, as noted in the article referenced in my previous post, is that well-behaved applications should not require administrative privileges unless they require administrative privileges. ;-)
Phil Weber at 2007-11-11 20:49:33 >
# 4 Re: Outlook Addin denied Access to Registry
I am going to look into figuring out another way to store a shared value for all users. In the meantime, why is it that, when I (an administrator) double click on the Outlook icon, Outlook does not run as administrator? Why do I, as an administrator, have to right click select "Run as Administrator" if I am an administrator?
ThePope78705 at 2007-11-11 20:50:40 >