Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Vista and access to Common Application Data folders

Vista and access to Common Application Data folders

Scheduled Pinned Locked Moved C#
helpquestionworkspace
10 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Glen Harvy 0
    wrote on last edited by
    #1

    Hi, I am trying to come to grips with Vista UAC and am having problems understanding the following.... My installer software (InstallAware) uses $ALLAPPDATA$ as a pointer to the environment variable 'common user data' which prior to Vista was c:\documents and settings\all users\application data\program name etc' . In Vista it becomes 'c:\programdata\program name etc'. The installer installs all the data files in either Vista and XP etc OK but when the user runs my program in Vista, my program says it can't access the data files. Disabling the UAC fixes the problem. I specifically use InstallAware to set permissions for all users to have read write access to the $ALLAPPDATA$ folder. Can someone tell me what I am missing? Thanks...

    Glen Harvy

    L T G D 4 Replies Last reply
    0
    • G Glen Harvy 0

      Hi, I am trying to come to grips with Vista UAC and am having problems understanding the following.... My installer software (InstallAware) uses $ALLAPPDATA$ as a pointer to the environment variable 'common user data' which prior to Vista was c:\documents and settings\all users\application data\program name etc' . In Vista it becomes 'c:\programdata\program name etc'. The installer installs all the data files in either Vista and XP etc OK but when the user runs my program in Vista, my program says it can't access the data files. Disabling the UAC fixes the problem. I specifically use InstallAware to set permissions for all users to have read write access to the $ALLAPPDATA$ folder. Can someone tell me what I am missing? Thanks...

      Glen Harvy

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You might be missing a few Vista rants :) Anyway, turning UAC off solves the problem, so, the solution is turning UAC off. What do you need it for anyway?

      G 1 Reply Last reply
      0
      • G Glen Harvy 0

        Hi, I am trying to come to grips with Vista UAC and am having problems understanding the following.... My installer software (InstallAware) uses $ALLAPPDATA$ as a pointer to the environment variable 'common user data' which prior to Vista was c:\documents and settings\all users\application data\program name etc' . In Vista it becomes 'c:\programdata\program name etc'. The installer installs all the data files in either Vista and XP etc OK but when the user runs my program in Vista, my program says it can't access the data files. Disabling the UAC fixes the problem. I specifically use InstallAware to set permissions for all users to have read write access to the $ALLAPPDATA$ folder. Can someone tell me what I am missing? Thanks...

        Glen Harvy

        T Offline
        T Offline
        tech603
        wrote on last edited by
        #3

        With Vista you sometimes have to right click on the application and select run as administrator. This will run the program as the administrator without have to always to UAC off. Hope that helps.

        Matthew Vass QA Analyst mvass@hostmysite.com HostMySite.com

        G 1 Reply Last reply
        0
        • G Glen Harvy 0

          Hi, I am trying to come to grips with Vista UAC and am having problems understanding the following.... My installer software (InstallAware) uses $ALLAPPDATA$ as a pointer to the environment variable 'common user data' which prior to Vista was c:\documents and settings\all users\application data\program name etc' . In Vista it becomes 'c:\programdata\program name etc'. The installer installs all the data files in either Vista and XP etc OK but when the user runs my program in Vista, my program says it can't access the data files. Disabling the UAC fixes the problem. I specifically use InstallAware to set permissions for all users to have read write access to the $ALLAPPDATA$ folder. Can someone tell me what I am missing? Thanks...

          Glen Harvy

          G Offline
          G Offline
          Glen Harvy 0
          wrote on last edited by
          #4

          I have been telling my users to switch the UAC of and of course this solves their immediate problem. However, that doesn't solve the issue - why can't my program read the data directory :mad: After another couple of hours research it seems InstallAware isn't changing the permissions as I thought it was. This now seems to make everything fall into place for me. I have found this http://stackoverflow.com/questions/243995/setting-folder-permissions-on-vista[^] and as I already have InstallAware (which is running with sufficient privileges) run an update program then I will include the method and make sure the said directory is granted read/write access.

          Glen Harvy

          C 1 Reply Last reply
          0
          • L Lost User

            You might be missing a few Vista rants :) Anyway, turning UAC off solves the problem, so, the solution is turning UAC off. What do you need it for anyway?

            G Offline
            G Offline
            Glen Harvy 0
            wrote on last edited by
            #5

            harold aptroot wrote:

            What do you need it for anyway?

            When someone downloads my program to test it out, the last thing I want them to have to do is send me an email saying - it doesn't work :confused: I would think many would just uninstall it and I've lost a sale. If I know my program doesn't work then I need to tell my users how to bypass/fix the problem or fix it myself. I don't want to tell my prospective client that MS doesn't know what it is doing in regards to the UAC and please turn it off. What are they going to think about me :(

            Glen Harvy

            L 1 Reply Last reply
            0
            • T tech603

              With Vista you sometimes have to right click on the application and select run as administrator. This will run the program as the administrator without have to always to UAC off. Hope that helps.

              Matthew Vass QA Analyst mvass@hostmysite.com HostMySite.com

              G Offline
              G Offline
              Glen Harvy 0
              wrote on last edited by
              #6

              tech603 wrote:

              right click on the application and select run as administrator

              I never knew that - thanks - it is another option I can suggest until I get this issue resolved.

              Glen Harvy

              1 Reply Last reply
              0
              • G Glen Harvy 0

                harold aptroot wrote:

                What do you need it for anyway?

                When someone downloads my program to test it out, the last thing I want them to have to do is send me an email saying - it doesn't work :confused: I would think many would just uninstall it and I've lost a sale. If I know my program doesn't work then I need to tell my users how to bypass/fix the problem or fix it myself. I don't want to tell my prospective client that MS doesn't know what it is doing in regards to the UAC and please turn it off. What are they going to think about me :(

                Glen Harvy

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Ok well fortunately a program can request admin privileges - but I think it has to be restarted for that. It'll throw an UAC prompt of course but everyone always clicks OK anyway.

                1 Reply Last reply
                0
                • G Glen Harvy 0

                  Hi, I am trying to come to grips with Vista UAC and am having problems understanding the following.... My installer software (InstallAware) uses $ALLAPPDATA$ as a pointer to the environment variable 'common user data' which prior to Vista was c:\documents and settings\all users\application data\program name etc' . In Vista it becomes 'c:\programdata\program name etc'. The installer installs all the data files in either Vista and XP etc OK but when the user runs my program in Vista, my program says it can't access the data files. Disabling the UAC fixes the problem. I specifically use InstallAware to set permissions for all users to have read write access to the $ALLAPPDATA$ folder. Can someone tell me what I am missing? Thanks...

                  Glen Harvy

                  D Offline
                  D Offline
                  DaveyM69
                  wrote on last edited by
                  #8

                  If it's just during the program run rather than the application install, you need to add an Application Manifest File and edit it to request the permissions in there. The user will be greeted with the UAC prompt each time, but that's life with Vista :mad: The recommendation is to make the program not require elevation, but as you know, that's not always possible/practical.

                  Dave
                  BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                  Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

                  G 1 Reply Last reply
                  0
                  • D DaveyM69

                    If it's just during the program run rather than the application install, you need to add an Application Manifest File and edit it to request the permissions in there. The user will be greeted with the UAC prompt each time, but that's life with Vista :mad: The recommendation is to make the program not require elevation, but as you know, that's not always possible/practical.

                    Dave
                    BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                    Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

                    G Offline
                    G Offline
                    Glen Harvy 0
                    wrote on last edited by
                    #9

                    Thanks for your comments. I have made some progress:

                    DaveyM69 wrote:

                    you need to add an Application Manifest File

                    Actually, VS2008 adds it for you automatically and it defaults to 'asInvoker'. That's why my application runs OK when launched by the installer (by default the installer has elevated privileges) but not when the user (without elevated privileges) launches my application.

                    DaveyM69 wrote:

                    The recommendation is to make the program not require elevation, but as you know, that's not always possible/practical.

                    My application pops up it's own messagebox saying it can't access it's database. I included this ages ago well before Vista. I have determined that with Vista, it is because the UAC prevents access to the Common Application Data folder. The name of that folder is to me incongruous and lead me away from the fact that it cannot be read or accessed unless you have sufficient privileges. It's 'common' to all users accessing my application but not 'common' to all user privileges. Having discovered that fact, I later discovered that my Installer (InstallAware) fails to set privileges even if I do tell it to. Apparently you need to write additional scripts to get InstallAware to do it in Vista but InstallAware's help file and support generally lacks any specific information on how to do this. Earlier in this thread, you will read how I have discovered some code which I have now included in a program that runs at install time and therefor inherits InstallAware's elevated privileges. This code apparently sets the permissions successfully. Unfortunately I don't even own a copy of Vista so I can't personally test this. I am waiting for a tech savvy person I know who owns Vista to test it for me. If it works, I will post a small article because frankly, I don't see what all the fuss is about in regards to the UAC and Vista.

                    Glen Harvy

                    1 Reply Last reply
                    0
                    • G Glen Harvy 0

                      I have been telling my users to switch the UAC of and of course this solves their immediate problem. However, that doesn't solve the issue - why can't my program read the data directory :mad: After another couple of hours research it seems InstallAware isn't changing the permissions as I thought it was. This now seems to make everything fall into place for me. I have found this http://stackoverflow.com/questions/243995/setting-folder-permissions-on-vista[^] and as I already have InstallAware (which is running with sufficient privileges) run an update program then I will include the method and make sure the said directory is granted read/write access.

                      Glen Harvy

                      C Offline
                      C Offline
                      Chirag B
                      wrote on last edited by
                      #10

                      Check this out: http://www.snaponcode.com/post/2009/11/27/Setup-and-Deployment-Solution-in-Visual-Studio20083cscript-language3djavascript-src3dhttpsa12alphagodaddycomhosting_adsgd01js3e3cscript3e.aspx#comment[^] Here is the link that will help you write some code in setup project for read-write permissions. http://social.msdn.microsoft.com/Forums/zh/winformssetup/thread/8eeb0a7f-7fa4-4335-bee5-8c41d4665160[^] I hope this helps!

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups