Writing a file into Program Files folder

Blitz3D Forums/Blitz3D Programming/Writing a file into Program Files folder

Marcell(Posted 2014) [#1]
Hello,
is it possible to write a file into %PROGRAM FILES% folder with Blitz3D?

My test program that is installed with NSIS-script into %PROGRAM FILES% seems to write there something, the data seems to be saved, but actual file doesn't show up in the folder.

Can this issue be related to NSIS-script?

I use Windows 7.


Floyd(Posted 2014) [#2]
You have run afoul of the virtual store. Microsoft has long advised against writing to the program files directory, but did not enforce that rule. It now does so by default.

In order to let older misbehaving programs run there is now the Virtual Store. When your program tries to write to the program folder Windows actually writes to the virtual store instead. It seems to write where you told it to, but really does not. This system works fairly well until you go outside your program and look for the file. It is not where you thought it was.

For example, on my Windows 7 64-bit there is

C:\Users\Floyd\AppData\Local\VirtualStore\Program Files (x86)\Blitz3D

which is where things like blitzide.prefs will get stored.


You can work around this by running a program as administrator. Then it can write to the real Program Files directory. That's a security risk I suppose, but for your own program there should be no harm.


Marcell(Posted 2014) [#3]
Thanks! This really clarified the question!