forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Windows hijacks "open" statment

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Clay



Joined: 20 Mar 2014
Posts: 23

PostPosted: Tue Jan 12, 2016 11:01 pm    Post subject: Windows hijacks "open" statment Reply with quote

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
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Jan 12, 2016 11:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Clay



Joined: 20 Mar 2014
Posts: 23

PostPosted: Tue Jan 12, 2016 11:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Wed Jan 13, 2016 8:34 am    Post subject: Reply with quote

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
View user's profile Send private message
Clay



Joined: 20 Mar 2014
Posts: 23

PostPosted: Wed Jan 13, 2016 3:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Wed Jan 13, 2016 5:08 pm    Post subject: Reply with quote

Your installer might be able to set the default permissions on the folder and/or files for you as well.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group