An application that is not running with raised privileges should does not have access to the Program Files and Program Files (x86) directories. This is good for safety. In addition, in most cases when a developer tells his program to save data in the Program Files folder, e.g. program settings, he has completely forgotten that program settings shoud be a per-user thing! That is, every user on the local computer should be able to use the program without affecting the other users. In other words, a well-behaved application should instead save its settings in the
C:\Users\<User Name>\AppData\Local\<Manufacturer>\<Product>\<Product Version>
directory.
For instance, my AlgoSim software writes to
C:\Users\<User Name>\AppData\Local\Rejbrand\AlgoSim\2.0
Of course, the
C:\Users\<User Name>\AppData\Local\
path must be looked-up dynamically at runtime. Use
SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, @path);
for this.
Ever since Windows Vista, applications that are not running with raised privileges that try to write to the Program Files (or Program Files (x86)) folder will in fact write to the VirtualStore folder, unknowingly. Microsoft thought that this would be better than a program failure (caused by the access restriction). And indeed, thanks to this most old programs that save their settings in the Program Files folder will continue to work with Windows Vista +, and each user will get her own settings, as a bonus, even though the original software manufacturer did not think of this.
You can use a manifest to tell Windows that your application is aware of VirtualStore and that Windows should not change any paths during runtime. But if you really want to be able to write to the Program Files folder, then I think that you have to run the application with raised privileges, every time, which is inadvisable in general.
The details on how to create manifests to make your program display the UAC promt on each execution, and how to disable VirtualStore, have been addressed at several preveous SO questions. Feel free to use the search box!