views:

877

answers:

1

When my program first installs it places a file in the user’s AppData directory, and the program then will periodically write to that file. The problem is in Vista the writes are not made to the file in the user’s AppData directory, they are made to a copy of that file in the “VirtualStore/ProgramData” directory. The original file in the user’s AppData directory never gets changed, it seems when the program runs it only has access to the file inside the VirtualStore directory.

Is there a way from inside a C# app to change the permissions on that file so that my program will write to the original one in the AppData directory and not the one in the VirtualStore directory?

Thanks,

Jeff

+1  A: 

The UAC documentation at http://msdn.microsoft.com/en-us/library/bb756973.aspx should help you solve this.

It sounds to me like you need to add an application manifest.

When your application includes an application manifest with a "requestedExecutionLevel" value specified, Vista's virtualization of the registry and file system will be switched off.

Take a look at http://msdn.microsoft.com/en-us/library/bb756929.aspx for specifics.

If you haven't previously tested your application under non-admin conditions, you might find that you need to make some code changes after you turn off Vista's virtualization.

Antony Perkov