C++ – Avoiding UAC in vista

cuacwindows-vista

im writing an application that downloads and installs addons for programs which needs to save the data to program files (for the programs in question). Now this works fine on xp and vista with uac disabled however it is failing on normal vista due to the virtual folders.

How would one get around this with out needing to request admin rights every time the app started?

P.s. Program is written in c++, vis 2005

Edit: File system virtual folders: http://www.codeproject.com/KB/vista-security/MakingAppsUACAware.aspx

Best Answer

Only write to Program Files during installation. After that, write to the user folders.

You can elevate the apps privileges later, but you'll just be delaying the prompt. The whole point of UAC is to prevent random apps from writing to folders that require admin privileges. (ok, not the whole point, but a large portion of it.)

You could create a service with admin privileges and send commands to it to move the downloaded files into the desired target directories, but this opens up a user's system to being abused by other apps if you don't design it very carefully.

This article talks about getting apps to work nicely with UAC. Also, see this article here.

Related Topic