dcsimg
Results 1 to 10 of 10
  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    141

    Resolved [RESOLVED] Install program without Admin permissions. (where?)

    I've always made my installers so they run with Admin permissions and create the program folder in
    c:\program files\

    Once installed the app doesn't need admin permission. Just the installation process needed it so that it could create that c:\program files\ folder

    But in future I'd rather do everything at the lowest permission possible. So, I'd like to be able to install without admin as well.

    But if I make the installer to run as normal user then it obviously can't write to
    c:\program files\

    So. My question is where is the 'User' Program Files folder.

    I use INNO setup and that appears to use this as the user program files folder.
    c:\Users\USER\AppData\Local\Programs

    But looking at my own computer where I have dozens of apps from different companies not one of them uses that folder.

    Does everybody elevate to admin for installation and go to c:\program files\

    Surely there's a proper user level program files folder for the user? Is ..

    c:\Users\USER\AppData\Local\Programs

    .. the correct place?

    Thank you
    Last edited by Axcontrols; Mar 4th, 2018 at 12:59 PM.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    39,857

    Re: Install program without Admin permissions. (where?)

    From what I understand \AppData\Local\Programs is an acceptable location to install things, but there are a few reasons that most programs don't do that, and instead require admin permissions.

    One is that if multiple users of a computer want to use your program, they each have to install a copy of it, which wastes disk space.

    Another is that the user can modify/delete important files, which breaks the program. That may lead to hassle for you, but might not (most users who do it would tend to either re-install it, or never use it again).

    A much bigger one is that any software that is run on their computer (including malware) can also modify/delete important files... and if it is malware, it makes your software look bad (even if you didn't cause it but only "allowed" it to happen).

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    141

    Re: Install program without Admin permissions. (where?)

    Quote Originally Posted by si_the_geek View Post
    A much bigger one is that any software that is run on their computer (including malware) can also modify/delete important files... and if it is malware, it makes your software look bad (even if you didn't cause it but only "allowed" it to happen).
    Important files. The most important files, in my mind, is User's data. The databases and documents that the user creates using my, or any other, software. An application running at normal user level, even if that app is in c:\program files\ has no choice but to keep those databases and documents in user writable folders where malware such as WannaCry always has free reign.

    Admin elevation is also not very protective either. Most users are just so used to answering YES to the "Do you want to allow.... " prompt.

    But thank you Si_.

    I think I will just continue to install as Admin. Not because I believe it offers much protection but, at least on corporate locked down machines, it puts the onus onto the IT/Admin guy to click the button.
    Last edited by Axcontrols; Mar 4th, 2018 at 02:13 PM.

  4. #4
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,054

    Re: [RESOLVED] Install program without Admin permissions. (where?)

    Admin elevation is also not very protective either. Most users are just so used to answering YES to the "Do you want to allow.... " prompt.

    Then that is the users fault. Application data is for data. Not exe files.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    141

    Re: [RESOLVED] Install program without Admin permissions. (where?)

    Quote Originally Posted by ident View Post
    ...Application data is for data. Not exe files.

    Thanks you. I agree. That's why I'm confused. So, in your opinion, where does a user, without elevating, place his executables?

    If you've used INNO setup you'll know that it has a variable {pf} and that resolves to the machine's \Program Files\ folder (which automatically defaults to \Program Files(x86)\ if installing 32bit app on 64bit windows.)

    Using {pf} INNO will obviously abort if installer is not elevated to admin.

    So INNO has another variable {userpf} which is supposed to point to the user's program files folder. In other words the folder where a user has write permission and can install an application without admin permissions.

    But {userpf} points to

    c:\Users\USER\AppData\Local\Programs

    That folder exists already. i didn't make it up. Why is the an appdata\local\programs folder if not for programs?

    If that isn't the user's program files folder. Where is it?

  6. #6
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,054

    Re: [RESOLVED] Install program without Admin permissions. (where?)

    Quote Originally Posted by Axcontrols View Post
    Thanks you. I agree. That's why I'm confused. So, in your opinion, where does a user, without elevating, place his executables?
    That's a good question. Microsoft has set out rules for us to follow. Now no One can force these rules. But I would like to know where an application is running from. The point of UAC is to stop applications installing if not at required priverlidges. I think the simple answer is, it doesn't have a place. All for very good reasons.

  7. #7
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,054

    Re: [RESOLVED] Install program without Admin permissions. (where?)

    Applications written with the assumption that the user will be running with administrator privileges experienced problems in earlier versions of Windows when run from limited user accounts, often because they attempted to write to machine-wide or system directories (such as Program Files) or registry keys (notably HKLM). UAC attempts to alleviate this using File and Registry Virtualization, which redirects writes (and subsequent reads) to a per-user location within the user’s profile. For example, if an application attempts to write to “C:\program files\appname\settings.ini” and the user doesn’t have permissions to write to that directory, the write will get redirected to “C:\Users\username\AppData\Local\VirtualStore\Program Files\appname\settings.ini”


    https://en.wikipedia.org/wiki/User_Account_Control

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    141

    Re: [RESOLVED] Install program without Admin permissions. (where?)

    Quote Originally Posted by ident View Post
    For example, if an application attempts to write to “C:\program files\appname\settings.ini” and the user doesn’t have permissions to write to that directory, the write will get redirected to “C:\Users\username\AppData\Local\VirtualStore\Program Files\appname\settings.ini”
    That's not true for applications that are UAC aware. So, if an application contains a manifest containing RunAsInvoker then windows sees that the program is UAC aware and does not virtualize it. if the user doesn't have permission it just fails.

    But you didn't actually answer the question.

  9. #9
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,054

    Re: [RESOLVED] Install program without Admin permissions. (where?)

    It's regarding earlier versions of windows. I included it to alongside my point it's generally IMO not a good idea as things can go wrong.

    I answered your question. I said there is not One.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    141

    Re: [RESOLVED] Install program without Admin permissions. (where?)

    Quote Originally Posted by ident View Post

    I answered your question. I said there is not One.
    Sorry. My mistake. I did not notice your first shorter post. When I clicked the link in my email it scrolled straight to the bottom of the thread to your longer post about UAC in general.

    As I said, I was just confused by the {pf} and {userpf} variables in INNO setup which seem to suggest using the folder
    Users\USER\AppData\Local\Programs for per user installs. ie installs without elevation.

    Googling some more it seems that, since Windows 7, Microsoft is suggesting to use that folder for "Per User" installations

    https://msdn.microsoft.com/en-us/lib.../dd765197.aspx

    scroll about 2/3rds of the way down that page to per user program Files.

    ProgramFilesFolder
    Windows Server 2008 R2 and Windows 7: The property value is the full path of the Programs folder for the current user (for example, %LocalAppData%\Programs.) The identifier for this folder is FOLDERID_UserProgramFiles on 32-bit and 64-bit systems. There is no equivalent CSIDL identifier for FOLDERID_UserProgramFiles. Files in this folder can be accessed only by the user that installed this folder.

    Windows Server 2008 and earlier, and Windows Vista and earlier: No per-user capable folder is available. The path is the same as for the per-machine context (for example, %ProgramFiles% or %ProgramFiles(x86)%.) Files in this folder can be accessed by all users.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width


×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.