We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Win 7 User Account Control Data Redirection question

Hi,
I am having a problem understanding the Win7 UAC Data Redirection rules and/or intent.

Our installer puts data files in the Common App Data tree (in Win7 that is C:\ProgramData\[CompanyName]\[ProductName]\[ProductVersion]). That is all going fine, except when I install an update to our system to go (say) from v130844 to v130855, then I am running into a problem.

When a limited user launches our application if their %appdata% tree doesn't have the latest data files that are stored in the Common App Data tree then we copy the files from their into the user's %appdata% tree (C:\Users\[Username]\AppData\Roaming\[CompanyName]\[ProductName]\[ProductVersion]). The reason for this is our installer puts the latest version of these data files in Common App Data, so that when other non-Admin users launch the app then that folder will be the source folder for these latest data files.

e.g.
FileCopy C:\ProgramData\[CompanyName]\[ProductName]\[ProductVersion]\file1, C:\Users\[Username]\AppData\Roaming\[CoName]\[ProductName]\[ProductVersion]\file1
FileCopy C:\ProgramData\[CompanyName]\[ProductName]\[ProductVersion]\file2, C:\Users\[Username]\AppData\Roaming\[CoName]\[ProductName]\[ProductVersion]\file2
etc.

To find the actual folder names we make calls to the SHGetFolderPath API using the CSIDL_COMMON_APPDATA and CSIDL_APPDATA constants.

What I am finding is that the file1 in the %appdata% tree is not the version of file that is expected. If I look at the file timestamp of file1 in the Common App Data tree it is 1/2/2014 3:40pm, but the file that is ending up in the %appdata% tree is dated 1/1/2014 11:40am which happens to correspond with the timestamp of the file in C:\Users\[Username]\AppData\Local\VritualStore\ProgramData\[CoName]\[ProductName]\[ProductVersion]\file1

So it seems that Win7 is doing some data redirection for me...but how do go about fixing it so that the file1 is sourced from Common App Data tree? Or what are my other options to fix this?

Thanks.
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Win 7 User Account Control Data Redirection question

Ok, after some more research I'd like to re-pose my question this way, because I now feel like our old installer is well behaved and is not violating any of the MS/Windows rules.

According to the article Where Should I Store my Data and Configuration Files if I Target Multiple OS Versions? and the Comments section below it:
ProgramData is the recommended location for per machine configuration data. As you point out, by default, BUILTIN\Users will only have RX. If you have a requirement for standard users to be able to write to the file, you will need to grant that permission. The best time to do this is during install time. Installers normally run elevated and can set any folder permissions.
So the question now is, with AI, how do I go about setting permissions on our sub-folders of the CSIDL_COMMON_APPDATA folder, so that all (limited) Users have Full Control of all of our configuration data files located here:
C:\ProgramData\[CompanyName]\[ProductName]\[ProductVersion]\
It seems like the way to do this is in Files and Folders > Common Application Data > [CompanyName] > Properties > Permissions > Users > Full Control and also turn "on" the "Apply permissions to all subfolders".

Is this the recommended approach?

Thanks.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Win 7 User Account Control Data Redirection question

Hi,

Sorry for the delayed reply.
So the question now is, with AI, how do I go about setting permissions on our sub-folders of the CSIDL_COMMON_APPDATA folder, so that all (limited) Users have Full Control of all of our configuration data files located here:
C:\ProgramData\[CompanyName]\[ProductName]\[ProductVersion]\
It seems like the way to do this is in Files and Folders > Common Application Data > [CompanyName] > Properties > Permissions > Users > Full Control and also turn "on" the "Apply permissions to all subfolders".

Is this the recommended approach?
Yes, this is the recommended approach. You can set "Full Control" permissions for the "Everyone" username that is displayed by default when you go to the "Permission" dialog.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”