none
COM Interop with UAC

    Question

  • Hi all, I'm having great difficulty getting my application to build...  I've written an application (COM Interop) which talks to Visual Source Safe (using code available from:  http://msdn.microsoft.com/en-us/library/bb509339.aspx) which builds and performs just as I would like it to (jumping into the Init method etc) when I've turned the UAC off...  As soon as I flip the UAC back on however:

    Error 3 Cannot register assembly "blah blah blah file name.dll" - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\name of dll' is denied.

    I'm aware that under Vista (I'm running on Vista Ultimate, but I doubt there's any difference) the admin account is treated in a rather shady manner, so I suspect that if I disable certain parts of the UAC, my problems will disappear...  I'd obviously rather not have to leave my computer expose though, is there any way I can use my application without having to worry about turning my UAC off?

    Many thanks


    Rob
    Tuesday, December 16, 2008 12:27 PM

Answers

  • Writing keys in the HKCR hive is strictly verboten in Vista UAC.  Registering a COM component is something you'll only have to do once.  You'll need to create an installer that runs with administrator privileges.  
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Monday, December 22, 2008 2:49 PM
    Tuesday, December 16, 2008 12:44 PM
    Moderator

All replies

  • I should probably mention that I've installed and run "Standard User Analyser Wizard", and when running once with "Elevated" checked and again with it unchecked, it worked as expected...
    Tuesday, December 16, 2008 12:32 PM
  • Writing keys in the HKCR hive is strictly verboten in Vista UAC.  Registering a COM component is something you'll only have to do once.  You'll need to create an installer that runs with administrator privileges.  
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Monday, December 22, 2008 2:49 PM
    Tuesday, December 16, 2008 12:44 PM
    Moderator
  •  Thanks for you reply, I'll give this a go!
    Tuesday, December 16, 2008 3:00 PM