Search code examples
windows-vistauac

Why do files get placed in "C:\Users\<username>AppData\Local\VirtualStore\Program Files(x86)"?


I recently updated my Visual Basic 6.0 application and now include an exe.manifest file to prevent UAC Virtualization. After applying this update, some users can't find their data files (Access MDB files) and after a system search they end up finding it in C:\Users\<username>AppData\Local\VirtualStore\Program Files(x86).

What is this folder area for and how/when do files get moved to this area? How do we prevent it? I'm hoping now that my application uses a .manifest this won't happen again. Did the files get placed there before the manifest was used as the application was being placed in UAC Virtualization?


Solution

  • My guess is that your manifest says asInvoker, and that your app tries to write to Program Files. When the users ran it without a manifest, it wrote to the virtual store for Program Files, which is the path where they found some files later. When they ran with a manifest, it failed to write at all (with access denied) but either your application hid the error from them, or they didn't understand the error so they didn't mention it to you.

    Short term fix - use a requireAdministrator manifest. This will irritate the users but the writes will succeed. Longer term fix - don't write to ProgramFiles. There are better per-user options, like AppData.