Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Administrator permissions required
Forum Update on Tuesday, May 27th 2025

[SOLVED]Administrator permissions required

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 17.9k 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.
  • J Offline
    J Offline
    Jake007
    wrote on last edited by
    #1

    Hi!

    I'm trying to make an updater for my application.

    I'm searching for a way, how to change permissions on .dll (Windows) files, so that they can be changed without administrator privileges ( program update might one day require to update .dll file).
    I tried setting file permissions (QFile::setPermissions) with administrator permissions, but operation failed.
    I can download file and write it to hard drive, but later I cannot delete it or rename it... ( Typical Windows thing since Vista)
    How do other installers/updaters have this problem solved?

    Another this is, why does a program also need administrator privileges as soon as network module is added to project?
    Is there a way to use normal permissions? On Windows OS, there is usually only firewall warning.

    Regards,
    Jake


    Code is poetry

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MuldeR
      wrote on last edited by
      #2

      Giving non-Admin users access to modify/replace the DLL is a severe security issue! Don't do it !!!

      There is a reason why on Vista and later "C:\Program Files" is protected.

      Instead, if you need to update the DLL, make the update program request "admin" privileges (via UAC manifest).

      And, if the user agrees to install the update (UAC dialog!), updating will work fine.

      You can, for example, make the "main" program download & run the update program, which will then take over.

      ...or you distribute a second "updater" EXE along with the "main program" EXE file.

      --

      The correct way to do it with NSIS, for example:
      http://pastebin.com/EvMkyLLt

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      1 Reply Last reply
      0
      • K Offline
        K Offline
        KamranMackey
        wrote on last edited by
        #3

        [quote author="MuldeR" date="1357951299"]Giving non-Admin users access to modify/replace the DLL is a severe security issue! Don't do it !!!

        There is a reason why on Vista and later "C:\Program Files" is protected.

        Instead, if you need to update the DLL, make the update program request "admin" privileges (via UAC manifest).

        And, if the user agrees to install the update (UAC dialog!), updating will work fine.

        You can, for example, make the "main" program download & run the update program, which will then take over.

        ...or you distribute a second "updater" EXE along with the "main program" EXE file.

        --

        The correct way to do it with NSIS, for example:
        http://pastebin.com/EvMkyLLt[/quote]

        Yeah, what MuldeR said. It's a bad idea to give non-Admin users access. They could do bad stuff to it. So don't do it please.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuldeR
          wrote on last edited by
          #4

          If you really had to update a DLL from a non-elevated process, which I still think is a bad idea, you'd have to install it into "%%APPDATA%%\Your Company\Your App". And of course you cannot update the DLL while there is still some process running that uses the DLL. That's yet another reason to create a proper installer/updater program. NSIS has a nice "LockedList":http://nsis.sourceforge.net/LockedList_plug-in Plug-in for that purpose...

          (BTW: Why this board doesn't allow to make literal percent signs ???)

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jake007
            wrote on last edited by
            #5

            Based on what you told me, I decided to dump idea of a custom updater ( on Windows platforms).
            Updater will just download NSIS updater and launch it.

            Do you maybe know how is with permissions on Linux/Unix based OS's?
            Will there be the same problem?


            Code is poetry

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MuldeR
              wrote on last edited by
              #6

              [quote author="Jake007" date="1358090331"]Based on what you told me, I decided to dump idea of a custom updater ( on Windows platforms).
              Updater will just download NSIS updater and launch it.[/quote]

              Be sure you launch the updater with ShellExecute(Ex) in order to trigger the required UAC dialog.

              CreatePorcess() from a non-elevated process will fail when trying to run an executable that requires elevation!

              [quote author="Jake007" date="1358090331"]Do you maybe know how is with permissions on Linux/Unix based OS's?
              Will there be the same problem?[/quote]

              Yes!

              Binaries and shared objects (equivalent to DLL) will normally be installed to /usr/bin or /user/local/bin.

              These of course are protected and we have to use "sudo <command>" to update/modify files there.

              Also on Linux platforms it's very uncommon to have a program "manually" install updates.

              Instead the OS' package manager (e.g. APT) will check for updates and install them, for all apps on the system.

              You just have to provide the packages in the correct form for the target distribution (e.g. DEB) and add your server (repository) to the list of software sources on the local computer.

              !http://en.opensuse.org/images/c/c3/Packagemanagement.png(screenshot)!

              See also: https://help.ubuntu.com/community/Repositories/CommandLine

              My OpenSource software at: http://muldersoft.com/

              Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

              Go visit the coop: http://youtu.be/Jay...

              1 Reply Last reply
              0
              • J Offline
                J Offline
                Jake007
                wrote on last edited by
                #7

                Hi!

                Thanks!

                Today I also found about Qt installer "here":http://doc-snapshot.qt-project.org/qtifw-1.2/index.html , and I'm going to try it out.

                Regards,
                Jake


                Code is poetry

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved