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

jasong1968

New member
VIP
Local time
12:34 AM
Messages
107
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 Computer My Computer

At a glance

Windows7 64
OS
Windows7 64
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 Computer My Computer

At a glance

Windows 7 Pro x64 SP1Intel Core I716 GigsNVIDIA GeForce GTX 670M
Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Laptop Qosimo X870
OS
Windows 7 Pro x64 SP1
CPU
Intel Core I7
Motherboard
Toshiba Qosmio
Memory
16 Gigs
Graphics Card(s)
NVIDIA GeForce GTX 670M
Monitor(s) Displays
17.7" laptop
Screen Resolution
1600 x 900
Hard Drives
256 Gig SanDisk SSD for C
256 Gig Intel SSD for D
Internet Speed
50/25 FIOS
Antivirus
Vipre (all you can eat for 10 machines)
Browser
IE and FF
Other Info
I have dos 6.22, wfwg 3.11, win98, 2000 and xp VHD's available for testing. MS's Virtual PC works great.
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 Computer My Computer

At a glance

Windows7 64
OS
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. "

......
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. :devil:

Rich
 

My Computer My Computer

At a glance

Windows 7 Pro x64 SP1Intel Core I716 GigsNVIDIA GeForce GTX 670M
Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Laptop Qosimo X870
OS
Windows 7 Pro x64 SP1
CPU
Intel Core I7
Motherboard
Toshiba Qosmio
Memory
16 Gigs
Graphics Card(s)
NVIDIA GeForce GTX 670M
Monitor(s) Displays
17.7" laptop
Screen Resolution
1600 x 900
Hard Drives
256 Gig SanDisk SSD for C
256 Gig Intel SSD for D
Internet Speed
50/25 FIOS
Antivirus
Vipre (all you can eat for 10 machines)
Browser
IE and FF
Other Info
I have dos 6.22, wfwg 3.11, win98, 2000 and xp VHD's available for testing. MS's Virtual PC works great.
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 Computer My Computer

At a glance

Windows7 64
OS
Windows7 64
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 Computer My Computer

At a glance

Windows 7 Professional SP1 32-bitIntel Core 2 Duo E6600 2.4GHz4GB DDR2-667 (4x1GB in dual-channel config)nVidia GeForce 9800 GT
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom-built
OS
Windows 7 Professional SP1 32-bit
CPU
Intel Core 2 Duo E6600 2.4GHz
Motherboard
Asus PL5D2
Memory
4GB DDR2-667 (4x1GB in dual-channel config)
Graphics Card(s)
nVidia GeForce 9800 GT
Sound Card
Creative X-Fi XtremeMusic
Monitor(s) Displays
Acer P236H
Screen Resolution
1920x1200 (DVI)
Hard Drives
OCZ SSD Vertex Plus 60GB SATA (Firmware 3.55), 64MB cache
Hitachi HD321KJ SATA, 320GB, 7200rpm, 16MB cache
PSU
Antec TruePower 2.0
Case
Cooler Master Centurion
Cooling
Too many fans
Keyboard
Standard
Mouse
Microsoft wireless optical mouse
Internet Speed
AT&T U-verse (18mbit/sec)
Antivirus
Microsoft Security Essentials
Browser
Firefox
Other Info
Other devices:
Compaq CQ-60 laptop
Google Nexus 7 (2012) tablet
Nvidia SHIELD tablet (US/LTE)
Hardkernel ODROID-XU single-board computer (Samsung Exynos 5420)
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. :sick:

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 Computer My Computer

At a glance

Windows7 64
OS
Windows7 64
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 Computer My Computer

At a glance

Windows 7 Professional SP1 32-bitIntel Core 2 Duo E6600 2.4GHz4GB DDR2-667 (4x1GB in dual-channel config)nVidia GeForce 9800 GT
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom-built
OS
Windows 7 Professional SP1 32-bit
CPU
Intel Core 2 Duo E6600 2.4GHz
Motherboard
Asus PL5D2
Memory
4GB DDR2-667 (4x1GB in dual-channel config)
Graphics Card(s)
nVidia GeForce 9800 GT
Sound Card
Creative X-Fi XtremeMusic
Monitor(s) Displays
Acer P236H
Screen Resolution
1920x1200 (DVI)
Hard Drives
OCZ SSD Vertex Plus 60GB SATA (Firmware 3.55), 64MB cache
Hitachi HD321KJ SATA, 320GB, 7200rpm, 16MB cache
PSU
Antec TruePower 2.0
Case
Cooler Master Centurion
Cooling
Too many fans
Keyboard
Standard
Mouse
Microsoft wireless optical mouse
Internet Speed
AT&T U-verse (18mbit/sec)
Antivirus
Microsoft Security Essentials
Browser
Firefox
Other Info
Other devices:
Compaq CQ-60 laptop
Google Nexus 7 (2012) tablet
Nvidia SHIELD tablet (US/LTE)
Hardkernel ODROID-XU single-board computer (Samsung Exynos 5420)
Back
Top