Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.



Windows 7: How to stop an app from writing to one of it's files

03 Dec 2011   #1

Windows7 64
 
 
How to stop an app from writing to one of it's files

Hi.

I have an .xml that is associated with an app. Everytime I shut down the app. that .xml file is written to, which I am trying to avoid, because it is changing some values I want to keep. I have made the file "read only", but that doesn't help; the app automatically switches off the "read only" status.

Any way of doing this?

Thanks in advance.

My System SpecsSystem Spec
03 Dec 2011   #2

Windows 7 Pro x64 SP1
 
 

Quote   Quote: Originally Posted by jasong1968 View Post
Hi.

I have an .xml that is associated with an app. Everytime I shut down the app. that .xml file is written to, which I am trying to avoid, because it is changing some values I want to keep. I have made the file "read only", but that doesn't help; the app automatically switches off the "read only" status.

Any way of doing this?

Thanks in advance.
Jasong, something tells me that if the program internally has to write something to a file, then unless you can get into the program options or the source code. your going to be out of luck. Unless there is some kind of configuration file that can be setup or the program can be executed with some command line parms.

The App is probably keeping track of usage or execution times.

What app is doing this?

Rich
My System SpecsSystem Spec
03 Dec 2011   #3

Windows7 64
 
 

Hi, and thank you for taking the time to reply.

"then unless you can get into the program options or the source code. "

There are no prog options to deal with this, and as this is a commercial app still in dev, the source code is out of the question. Not that I would know what to do with it anyway.

The app is Cubase, a music sequencing program. defaults.xml, which resides in the app data folder, keeps track of app-specific configuarations and settings. Positioning (x-y coordinates) of plug-ins, audio track height, color scheme, etc. The problem is, everytime the app is shut down, it changes the value of one of the strings, from a 0 to a 1. I can manually change the 1 to a 0 and save the xml, but upon every launch and shutdown, the app will automatically change that 0 back to a 1. Why do I need that string's value to be a 0? Because of a little bug, that prohibits a certain function from performing when the app sees that string's value as a 1. That function does work however, when the app sees that string's value as a 0. If you are thinking of telling me to be careful - that what I am doing can affect other functions in the app - no need. That string calls to a specific .dll to perform this function, and that .dll is not needed for any other function.

So, what I did was, set the .xml file to "read-only", and try to change the permissions so that the app can read the .xml file upon launch (necessary) but disallow the app from writing to that file. My attempts so far have been unsuccessful. I went into the Advanced security options, where I see:

SYSTEM
Admin (My Comp Name)
My Comp Name (My Comp Name)

All are currently set to full control.

I found that changing the permissions for SYSTEM does nothing, so I clicked on
My Comp Name (My Comp Name) > Change Permissions > My Comp Name (My Comp Name) > Edit, and now I have a list of Allow and Deny checkboxes.

If I check any or all of the Deny checkboxes, the equivalent Allow checkboxes stay checked, but my understanding is that the Deny permission supercedes the Allow permission - that correct?

So, I check all the Deny the boxes, except the ones that say "Read Attrib" and "Read Permissions". The idea here, is to allow the app to have permission to read the file, but not allow it change or write to the file. When I do that, I now see a 4th entry in the Permissions dial box which was not previously there. The three that have been there all the time say Inherited from: C:\Users\My Comp Name. The fourth that was just created says Inherited from: <not inherited>. But when I do this, the app doesn't read that file upon launch - I know this because of the settings that have reverted to the defaults. If I undo those permission changes, going back to the way it was previously, then the app does read the file upon launch, and the settings are as I have left them.

So, I am still wondering if there is any way to do this. Either through permissions, or some other way. Thanks again for any insight.
My System SpecsSystem Spec
.


04 Dec 2011   #4

Windows 7 Pro x64 SP1
 
 

Quote   Quote: Originally Posted by jasong1968 View Post
Hi, and thank you for taking the time to reply.

"then unless you can get into the program options or the source code. "

......
So, I am still wondering if there is any way to do this. Either through permissions, or some other way. Thanks again for any insight.
Something tells me that if you manage to get the program to not write the the file, it will then as you found out, start with the default values. I personally don't think that there is any solution to your problem. Sorry to be the bearer of bad tidings but that's life with computers.

Rich
My System SpecsSystem Spec
04 Dec 2011   #5

Windows7 64
 
 

Thanks again for the time.

There has to be something I am doing wrong with the permissions - so I can get the app to read the xml, but not write to it, no?
My System SpecsSystem Spec
04 Dec 2011   #6

Windows 7 Professional SP1 32-bit
 
 

You could try a workaround: first, make a copy of the .xml file (with your preferred settings in it).

Then, create a small batch file which first runs Cubase, waiting silently in the background until you close and exit Cubase, and then automatically copies the backup .xml file back to the original .xml, overwriting it.

It's not quite as elegant, granted, but it should be a simple solution to your issue.
My System SpecsSystem Spec
05 Dec 2011   #7

Windows7 64
 
 

Quote   Quote: Originally Posted by Corazon View Post
Then, create a small batch file which first runs Cubase, waiting silently in the background until you close and exit Cubase, and then automatically copies the backup .xml file back to the original .xml, overwriting it.
HUH?!??! lol

Thanks for the advice, but I didn't quite follow that.

In any event - I got it. I knew it would be a permission thing - problem was, I was missing one of the permissions originally. Got it now - and it works exactly as I was expecting it to.

Thanks again!
My System SpecsSystem Spec
05 Dec 2011   #8

Windows 7 Professional SP1 32-bit
 
 

Sorry for the confusion LOL. I thought it would be an easier solution than trying to set the file permissions, but I'm glad you got it to work that way. Happy computing

BTW, what I had in mind was a simple .bat file (that you could run via a desktop shortcut) like this:
Code:
pushd "C:\Program Files\Cubase"
Cubase.exe
wait 1
copy /y settings_backup.xml settings.xml
My System SpecsSystem Spec
Reply

 How to stop an app from writing to one of it's files





Thread Tools



Similar help and support threads for2: How to stop an app from writing to one of it's files
Thread Forum
Solved Cant install because Error writing files? Software
Win 7 not writing Minidump files General Discussion
no writing/editing access to my documents and program files. General Discussion
How to stop Windows 7 from writing desktop.ini files everywhere? General Discussion
Solved Writing To Program Files Folder - How (Access Denied) ? General Discussion
Best Program for Writing Help Files? Software
Bsod during writing big files to SATA HDD BSOD Help and Support

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 08:36 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33