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. Qt Installer Framework and Administrator privileges [SOLVED]
Forum Updated to NodeBB v4.3 + New Features

Qt Installer Framework and Administrator privileges [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
44 Posts 15 Posters 39.6k 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.
  • E Offline
    E Offline
    exiBob
    wrote on last edited by
    #17

    ECHO is on.

    It was originally calling the batch file from the system32 directory so I added a call to cd and now change it to the .bat's current dir and slightly modified the folder layout and updated the batch file accordingly. This is was cmd window prints out

    C:\Windows\system32>cd C:\Users\Bobby\SFC4000\

    C:\Users\Bobby\SFC4000>cd ".\Driver\exi"

    C:\Users\Bobby\SFC4000\Driver\exi>rundll32.exe libusb0.dll,usb_install_driver_np
    _rundll sfc3000.inf

    C:\Users\Bobby\SFC4000\Driver\exi>pause
    Press any key to continue . . .

    1 Reply Last reply
    0
    • A Offline
      A Offline
      amahta
      wrote on last edited by
      #18

      Sorry I didn't get it. Is this the output for Installer running your batch or is this the result for Run application???
      There are no errors here, if you're saying that it ran just fine when you tried it with Run then it seems we're stuck at this point!
      My advice would be to check the scripts again one more time and if you are 100% sure that it just isn't working for you then try another installer creator (like inno setup) for the time being. Until new release for QTIFW comes out.

      Thou shalt programme
      http://www.amin-ahmadi.com

      1 Reply Last reply
      0
      • E Offline
        E Offline
        exiBob
        wrote on last edited by
        #19

        That was the output in the command window when using your win+r instructions.

        Its OK now though I finally have it working!! I applied all of the changes that you suggested and also changed the installer compatibility settings in it's properties so that it's run as administrator. I probably would have got it working much sooner if i hadn't spent an hour or so trying to install the 32bit drivers on my 64bit machine DUHHHH! But hey, we live and learn.

        Thanks for your help really appreciate it :)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          amahta
          wrote on last edited by
          #20

          :) Wow. Ok. Glad to hear you made it work finally.

          Thou shalt programme
          http://www.amin-ahmadi.com

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nwoki
            wrote on last edited by
            #21

            Hi, sorry to bring this post back to life, but I'm having problems executing a bundled installer from the installscript.qs in my QtInstaller application.

            What I do is install the .msi to the @TargetDir@ and then try to launch it with

            @component.addOperation("Execute", "msiexec.exe /i", ""@TargetDir@\MyUsbDriver.msi"");@

            (I used the double quotes for the target dir because my installer application can accept paths with spaces, I'm installing on wnidows)

            I keep on getting error messages stating:

            bq. Execution Failed: Could not start: "C:\Program Files\MyApp\MyUsbDriver.msi" (Process failed to start: The parameter is incorrect)
            (I used the double quotes for the target dir because my installer application can accept paths with spaces, I'm installing on wnidows)

            Any ideas on how to correctly launch the .msi file?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              amahta
              wrote on last edited by
              #22

              [quote author="amahta" date="1390477421"]To be precise, this is how I solved my problem because I was working on Windows and if you are also on Windows, I suggest you also do this and skip all the complications:
              @
              Component.prototype.createOperations = function()
              {
              try
              {
              // call the base create operations function
              component.createOperations();
              if (installer.value("os") === "win")
              {
              component.addOperation("Execute", "cmd /C "@TargetDir@\SomeFolder\SomeFile.exe"");
              }
              } catch (e)
              {
              print(e);
              }
              }
              @
              You don't need to add admin rights for this to work.
              Just let the command prompt do the job for you :)[/quote]

              This should work for you. Pass your msi file using "msiexec" command to "cmd"

              Thou shalt programme
              http://www.amin-ahmadi.com

              1 Reply Last reply
              0
              • N Offline
                N Offline
                nwoki
                wrote on last edited by
                #23

                Using

                @component.addOperation("Execute", "cmd /C", "msiexec.exe /i", ""@TargetDir@\MyUsbDriver.msi"");
                @

                gives me the same execution error stated above.

                Running the command from cmd starts the driver installation though. So it's got to be something in the installscript.qs.

                Any ideas?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sandeepsastry
                  wrote on last edited by
                  #24

                  I have a related issue and am struggling to get it going for quite sometime. I have even raised a jira on Qt Installer Framework https://bugreports.qt-project.org/browse/QTIFW-497 but did not get a reply/comment yet. Any pointers would be of great help.

                  1 Reply Last reply
                  0
                  • W Offline
                    W Offline
                    wesblake
                    wrote on last edited by
                    #25

                    [quote author="nwoki" date="1398777153"]Using

                    @component.addOperation("Execute", "cmd /C", "msiexec.exe /i", ""@TargetDir@\MyUsbDriver.msi"");
                    @

                    gives me the same execution error stated above.

                    Running the command from cmd starts the driver installation though. So it's got to be something in the installscript.qs.

                    Any ideas?[/quote]

                    Hi, I have a similar issue to this thread, and closer to that quoted above. I've looked everywhere and can find threads about executing exe's, etc AFTER installation of my own app, but need to know how to install a prerequisite for my app. This is common functionality in other installers but I can't seem to find info on it for QT Installer Framework.
                    I.E., I need to first run vcredist_x86.exe or my program will not work. Better yet would be detecting if they already have that or not (other advanced installer I've seen do this) and launch accordingly, but even as simple launch before we install ours would work ok too. Can this be done?

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      nwoki
                      wrote on last edited by
                      #26

                      Forgot to post my answer. This is how i resolved my problem. Basically, every parameter must be seperated as follows

                      @ component.addOperation("Execute"
                      , "msiexec"
                      , "/i"
                      , "@TargetDir@\Driver.msi"
                      , "UNDOEXECUTE"
                      , "msiexec"
                      , "/qb"
                      , "/x"
                      , "@TargetDir@\Driver.msi");@

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        blackpainter
                        wrote on last edited by
                        #27

                        Hello Everyone,

                        I hate to warm this up, but i am encountering the same problems.
                        I need to install some drivers along with my software, which need admin rights for installment.

                        All together i added:
                        @<RequiresAdminRights>true</RequiresAdminRights> @
                        to the package.xml
                        and
                        @function Component()
                        {
                        }

                        Component.prototype.createOperations = function()
                        {
                        try
                        {
                        installer.gainAdminRights();
                        component.createOperations();
                        if (installer.value("os") === "win")
                        {
                        // component.addElevatedOperation("Execute", "cmd", "/C", ""@TargetDir@\CP210xVCPInstaller_x64.exe"", "workingDirectory=@TargetDir@");
                        component.addElevatedOperation("Execute", "{256}", ""@TargetDir@\CP210xVCPInstaller_x64.exe"", "workingDirectory=@TargetDir@");
                        }
                        } catch (e)
                        {
                        print(e);
                        }
                        }@

                        This returns the error:
                        @Error during installation process (driver_x64):
                        Execution failed(Unexpected exit code: 0): ""[Filepath]""@

                        The returncode is not the issue. it does not even start the driver installation.
                        I tried the cmd version also, but could not get it to work either.

                        When i manually start the installer with admin rights, it works fine.

                        Any advice? Thanks in advance.

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          trallallero
                          wrote on last edited by
                          #28

                          Hi all and thanks for the hints.
                          I've found a problem related to admin rights so I write here instead of opening a new thread.

                          I created a "TestInstaller" that installs a "qt hello world" program to "Program Files (86)/TestInstaller" with admin privileges.

                          Then if I uninstall it using admin privileges, the directory "Program Files (86)/TestInstaller" is deleted as it should.

                          If I uninstall it NOT using admin privileges, the directory is not deleted and still contains the file "uninstall.exe".

                          How can I fix this ?

                          1 Reply Last reply
                          0
                          • N Offline
                            N Offline
                            nwoki
                            wrote on last edited by
                            #29

                            You can't. It's a know bug bug nobody has picked it up at the moment.

                            https://bugreports.qt-project.org/browse/QTIFW-447?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

                            1 Reply Last reply
                            0
                            • T Offline
                              T Offline
                              trallallero
                              wrote on last edited by
                              #30

                              I tried to post a thanks to nwoki the 1 October but the forum was presumably down as I could not.
                              Thanks.

                              Anyway, I have other problems now: beside the logo not shown, I need to create an installer for a customer and it should NOT have admin rights.
                              So I wrote
                              <RequiresAdminRights>false</RequiresAdminRights>
                              in package.xml, I DON'T call
                              installer.gainAdminRights();
                              but when I execute the created installer, the admin password is asked.
                              Another bug or what ?
                              I have a Qt license, shall I contact the support ?

                              1 Reply Last reply
                              0
                              • W Offline
                                W Offline
                                Wilmord
                                wrote on last edited by
                                #31

                                @amahta said:

                                TargetDir

                                Hello All,

                                Actually, I have a same problem ( using 2.0.0 version), I want to use this command below:

                                component.addElevatedOperation("Execute", "{0,3010}", "@TargetDir@\vcredist\vcredist_x86.exe", "/norestart", "/q");

                                But It crashes when installing process. In my package.xml, <RequiresAdminRights>true</RequiresAdminRights> tag is exist.

                                Thanks in advance.

                                A 1 Reply Last reply
                                0
                                • W Wilmord

                                  @amahta said:

                                  TargetDir

                                  Hello All,

                                  Actually, I have a same problem ( using 2.0.0 version), I want to use this command below:

                                  component.addElevatedOperation("Execute", "{0,3010}", "@TargetDir@\vcredist\vcredist_x86.exe", "/norestart", "/q");

                                  But It crashes when installing process. In my package.xml, <RequiresAdminRights>true</RequiresAdminRights> tag is exist.

                                  Thanks in advance.

                                  A Offline
                                  A Offline
                                  Andreas
                                  wrote on last edited by
                                  #32

                                  @Wilmord: It seems to be new bug in IFW 2.0.0. See Bugreport: https://bugreports.qt.io/browse/QTIFW-659

                                  --
                                  Andreas

                                  1 Reply Last reply
                                  0
                                  • W Offline
                                    W Offline
                                    Wilmord
                                    wrote on last edited by
                                    #33

                                    Yes. It seems like that. I entered comment it and hope that they will fix soon.
                                    Thanks.

                                    1 Reply Last reply
                                    0
                                    • tomyT Offline
                                      tomyT Offline
                                      tomy
                                      wrote on last edited by
                                      #34

                                      Hello all.
                                      I think I have also the same issue. If possible please take a look at this thread as well.
                                      Thank you very much.

                                      1 Reply Last reply
                                      0
                                      • A amahta

                                        After lots of searching finally I found a solution. Unfortunately this is not documented in version 1.4

                                        Add the following line to your component's package xml file:
                                        @<RequiresAdminRights>true</RequiresAdminRights>@

                                        And use this line in your script file:
                                        @component.addElevatedOperation("Execute", "someCommand");@
                                        instead of
                                        @component.addOperation("Execute", "someCommand");@

                                        U Offline
                                        U Offline
                                        user2301
                                        wrote on last edited by
                                        #35

                                        @amahta said in Qt Installer Framework and Administrator privileges [SOLVED]:

                                        <RequiresAdminRights>true</RequiresAdminRights>

                                        How to provide admin access rights or run installer.performOperation in elevated rights?
                                        For component.addElevatedOperation("Execute", "someCommand") it works.

                                        But for controller script thid doesn't work

                                        RatzzR 1 Reply Last reply
                                        0
                                        • U user2301

                                          @amahta said in Qt Installer Framework and Administrator privileges [SOLVED]:

                                          <RequiresAdminRights>true</RequiresAdminRights>

                                          How to provide admin access rights or run installer.performOperation in elevated rights?
                                          For component.addElevatedOperation("Execute", "someCommand") it works.

                                          But for controller script thid doesn't work

                                          RatzzR Offline
                                          RatzzR Offline
                                          Ratzz
                                          wrote on last edited by
                                          #36

                                          @user2301 said in Qt Installer Framework and Administrator privileges [SOLVED]:

                                          But for controller script thid doesn't work

                                          Can you show me what have you tried?

                                          --Alles ist gut.

                                          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