View previous topic :: View next topic |
Author |
Message |
Clay
Joined: 20 Mar 2014 Posts: 23
|
Posted: Tue Jan 12, 2016 11:01 pm Post subject: Windows hijacks "open" statment |
|
|
I have an executable that, when installed in Windows, resides in C:\Program Files (x86)\ProgramName\. I've got data files in the install folder which are opened and read at run time. I open the files using a FTN95 "open" statement with the file designated by a text string beginning with "C:\Program Files (x86)\ProgramName\".
What some of our customers have found is that sometimes Windows makes copies of the data files and stashes them in C:\Users\[USER NAME]\AppData\Local\VirtualStore\Program Files (x86)\ProgramName\. What's worse is that when users install updated versions of our program, Windows doesn't update the Virtual Store copies of the data files with the consequence that my executable is opening and using out of date data files. This even though the updated data file is sitting right next to the executable in the install folder and I'm using a file address string pointing at the right file.
What's going on? Is there some syntax I can use for the "open" statement or some other trick to let Windows know that I want to open the file I asked for not a copy of the file stashed in VirtualStore?
Thanks in advance for any comments or advice.
Clay |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Tue Jan 12, 2016 11:15 pm Post subject: |
|
|
It sounds like your installer has an issue of where precisely to store these files. There are "rules" that define where certain things are installed based on which version of the OS under which you installed.
My deployment builder (DeployMaster) help file specifically calls out the change in installation of certain User files from the "Program Files" folder to the "User" folder, similar to what you are referring to.
The text in their Help file says:
Quote: | On Windows Vista and later, normal users can only write to C:\Users\TheirUserName\. All other folders on the C: drive require administrator privileges in order to be written to. If your application uses data files that should be shared by all users on the same PC and that should be writable by all users, then you'll need to create a new folder under %COMMONDOCUMENTS% or %COMMONAPPDATAROOT% and turn the option "grant all users write access to this folder" for that folder. This option tells your installer to change the security permissions on that folder so that all users can write to it. |
The reference to the %xxxx% folder names are unique to DeployMaster. |
|
Back to top |
|
|
Clay
Joined: 20 Mar 2014 Posts: 23
|
Posted: Tue Jan 12, 2016 11:21 pm Post subject: |
|
|
Thank you wahorger.
Forgot to mention that these are ReadOnly data files which are stored in C:\Program Files (x86)\. The files are just databases which I need to use to retrieve values from time to time.
I'll look in the installer Help to see if I can find a hint... |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Wed Jan 13, 2016 8:34 am Post subject: |
|
|
You may want to look at
http://forums.silverfrost.com/viewtopic.php?t=2465&start=60
The problem looks as if you are sometimes opening the files for writing, but do not have the permission for this action.
Could you try using C:\ProgramData\ProgramName\... for your files ?
I have not tried this but it looks as if this is an area provided for this purpose and may have different protection.
Years ago, I had given up trying to solve this problem on Windows 7 and created my own area c:\utils to store files. I probably should have tried C:\ProgramData\ProgramName if it works.
Let us know how you go
John |
|
Back to top |
|
|
Clay
Joined: 20 Mar 2014 Posts: 23
|
Posted: Wed Jan 13, 2016 3:35 pm Post subject: |
|
|
Good idea John.
When the problem first started happening I went through all of the source code and did find a few "open" statements that didn't have "action= 'read'", so even though I was using the file as read-only maybe Windows reserved the ability to read-write by making a copy.
I never noticed the ProgramData folder before, but that may be a winner!
Clay |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Wed Jan 13, 2016 5:08 pm Post subject: |
|
|
Your installer might be able to set the default permissions on the folder and/or files for you as well. |
|
Back to top |
|
|
|