How do I have my app update itself if it can't write to the installation folder?

I have an app I sell that presently is designed to update itself when a new version is available and the user opts to update. My approach is simple. I install two programs: MyApp.exe and MyAppUpdater.exe. When MyApp needs to be updated it starts up MyAppUpdater and shuts down. MyAppUpdater downloads a new version of MyApp saving it to the installation folder as MyApp.tmp. It then verifies that the entire app was successfully downloaded and if so deletes the old MyApp.exe and renames MyApp.tmp to MyApp.exe. Works fine and saves my users from having to download the entire installer, uninstall and reinstall.

If I understand correctly it looks like Vista won't let an app write anything to the application folder. Anything written to the app folder is sent to the folder C:\Users\<your_account>\AppData\Local\VirtualStore\Program
Files\MyApp\. So how am I supposed to go about updating my software now Forcing my users to download the full install every time will cost me a lot of bandwidth and change what used to be a very easy and straight-forward updating process to more of a pain for my users.



Answer this question

How do I have my app update itself if it can't write to the installation folder?

  • RisTar

    I'm not an expert, just a befuddled developer feeling my way along.

    I think this is a security feature that prevents anyone with restricted user status from having write access to the Program Files folder(s). Anything run by a normal (restricted) user (either deliberate programs or malware) cannot make changes to software or other files stored there. A virtural folder is set up to allow you to run in the "VirtualStore" sandbox, but the actual Program Files area can't be touched.

    I've not tried what you are doing, but I'm using InstallAware which does an MSI installation for my application. The script is written to check for admin privileges, and works quite well. It does do the entire uninstall/reinstall scenario, though, and you are trying to avoid that.

    What this means: Normal (restricted) users won't be able to install or update software into places where they don't have proper access. This is normal now in the usual corporate lock-down environment that any moderately secure IT department enforces. I guess it is enforced by default by Vista. Your user will need admin rights, or have someone with admin rights do the update.

    BTW, under WinXP & Win2K, some of my older apps will install and run from folders outside the Program Files area where the user has write access . This is NOT secure; it means any program can modify and/or corrupt programs and files in my installation folder. But it works for users who don't want to bother an admin or don't have admin rights. I'm in the process of re-writing some of these older apps because of this <sigh>.



  • How do I have my app update itself if it can't write to the installation folder?