none
Windows Vista Program Files Folder Protection

    Question

  • We install (using Windows Installer) a .config file in our folder under the C:\Program Files tree in Vista.

     

    At times we need to edit this file using Notepad and we can copy it out to the desktop, edit it, and copy it back into the our "program files" folder and it appears fine.  (Date is changed, etc.)

     

    Our .NET program does not see the change we made at all. 

     

    We can open the file (it's XML) in Notepad and the change is there.

     

    We can open the file in IE7 and the change is NOT there.

     

    The properties shown in IE7 (file | Properties menu) show dates identical to the original file.

     

    The properties shown using windows explorer reflect the new date and time as if the file were edited.

     

    Any ideas?

    Thanks,

    Pat

     

     

     

    Wednesday, May 23, 2007 11:32 PM

Answers

  • Yup, the Program Files folder is not (ordinarily) writable in Vista. 

     

    What happens when you write to it anyhow is that the writing goes to a virtual location that is not in the actual directory.  Some operations will find it, others won't. 

     

    That Program Files and other areas would be protected in Vista is one of the differences that there has been lots of warning about.  Whether the virtualization was a good idea or not is a different question, but writing to the Program Files tree has always been discouraged, especially since it is not writeable by default for non-administrator accounts even in Windows XP.

     

    Here;s a link that will get you started figuring this one out:

    http://www.hanselman.com/blog/VistasShowCompatibilityFilesAndTheScrumptiousWonderThatIsFileVirtualization.aspx

     

     - Dennis

     

    PS: You should get your hands on the guidelines for "Works with Vista" and "Designed for Vista" and review all of these little stumbling blocks: 

    http://devreadiness.org/blogs/works_with_windows_vista/default.aspx

    Thursday, May 24, 2007 1:02 AM

All replies

  • Yup, the Program Files folder is not (ordinarily) writable in Vista. 

     

    What happens when you write to it anyhow is that the writing goes to a virtual location that is not in the actual directory.  Some operations will find it, others won't. 

     

    That Program Files and other areas would be protected in Vista is one of the differences that there has been lots of warning about.  Whether the virtualization was a good idea or not is a different question, but writing to the Program Files tree has always been discouraged, especially since it is not writeable by default for non-administrator accounts even in Windows XP.

     

    Here;s a link that will get you started figuring this one out:

    http://www.hanselman.com/blog/VistasShowCompatibilityFilesAndTheScrumptiousWonderThatIsFileVirtualization.aspx

     

     - Dennis

     

    PS: You should get your hands on the guidelines for "Works with Vista" and "Designed for Vista" and review all of these little stumbling blocks: 

    http://devreadiness.org/blogs/works_with_windows_vista/default.aspx

    Thursday, May 24, 2007 1:02 AM
  • Thanks very much for the information.  Very few people at ISV Partner Support know about this.  Actually, none that we talked to.  This forum is a valuable resource.  Thanks again.

     

    Pat

     

    Friday, May 25, 2007 5:34 AM
  • For me I had to simply rename my program SDetective.exe to SDetective-setup.exe. 

     

    This magically means that it can *only* run as (real) adminstrator, so gets installed in the right place.

     

    You can just see how this virtualization was designed by marketing, not real architects.   This hack joins many others that break our mental models.  Thats why we love Unix -- very crude but we understand it.

     

    Anthony

    Monday, April 14, 2008 4:55 AM
  • So this obnoxious thing is still with us in WIndows 7?
    That is why I run everything at home in the hidden Administrator accpount.
    I was hoping there was a way around this in Windows 7, No such luck I guess?
    Monday, February 02, 2009 7:53 PM
  • uhm.. what!?

    I just tried this and it worked! :|

    Is there a Windows system setting to turn this off so that all apps can write to the Program Files folder?

    Friday, July 29, 2016 6:24 PM