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. QProcess with Elevated permission
Forum Updated to NodeBB v4.3 + New Features

QProcess with Elevated permission

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 787 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.
  • HrishiGoblerH Offline
    HrishiGoblerH Offline
    HrishiGobler
    wrote on last edited by
    #1

    Hello experts,
    Need a helping hand here..

    I am running a thridparty exe using QProcess ( in windows platform ) from my c++ code, and in tern windows automatically ask the user for elevated-permission and the user can either Allow or deny the permission to run the process.

    How can I detect, if the user has pressed Deny?
    ( I have tried different signals to get the exit-code/state/erroroccured, but nothing works so far.. fyi, the state shows as "running" even though user denies the permission)

    Thanks in advance
    Hrishi

    JonBJ 1 Reply Last reply
    0
    • HrishiGoblerH HrishiGobler

      Hello experts,
      Need a helping hand here..

      I am running a thridparty exe using QProcess ( in windows platform ) from my c++ code, and in tern windows automatically ask the user for elevated-permission and the user can either Allow or deny the permission to run the process.

      How can I detect, if the user has pressed Deny?
      ( I have tried different signals to get the exit-code/state/erroroccured, but nothing works so far.. fyi, the state shows as "running" even though user denies the permission)

      Thanks in advance
      Hrishi

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @HrishiGobler
      If the user selects Deny I would expect the OS command to be terminated/not to run. There might not be a signal, I don't know. [I don't run Qt under Windows.]

      If you claim that once the user has clicked Deny the command "continues" to run and does not change state that would sound "bad". It would mean the command will never complete, one way or the other. I find that hard to believe. It is possible that QProcess code might not get the state right, I guess; but look at Task Manager, what is actually going on for the sub-process?

      HrishiGoblerH 1 Reply Last reply
      0
      • JonBJ JonB

        @HrishiGobler
        If the user selects Deny I would expect the OS command to be terminated/not to run. There might not be a signal, I don't know. [I don't run Qt under Windows.]

        If you claim that once the user has clicked Deny the command "continues" to run and does not change state that would sound "bad". It would mean the command will never complete, one way or the other. I find that hard to believe. It is possible that QProcess code might not get the state right, I guess; but look at Task Manager, what is actually going on for the sub-process?

        HrishiGoblerH Offline
        HrishiGoblerH Offline
        HrishiGobler
        wrote on last edited by
        #3

        @JonB Thanks for taking a look on this.
        FYI, the actual process(Notepad.exe) has never started ( as the user presses Deny), I have made sure this from "Task manager" that the process(Notepad.exe) has never started.
        But still, the started() method QProcess returns true.

        JonBJ 1 Reply Last reply
        0
        • HrishiGoblerH HrishiGobler

          @JonB Thanks for taking a look on this.
          FYI, the actual process(Notepad.exe) has never started ( as the user presses Deny), I have made sure this from "Task manager" that the process(Notepad.exe) has never started.
          But still, the started() method QProcess returns true.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @HrishiGobler
          OK. But the issue here is that you claim that after QProcess::started() the process is "stuck" on "Running" and never "finishes" after the user clicks Deny. If that is true it is problematic.

          You could Google for qprocess uac. There are a few hits, but mostly about how you might run elevated not your Deny report. (Nonetheless, some of the advice there about6 running it via Windows shell might be of interest.)

          You might also try running your command via QProcess::start("cmd", { "-c", yourCommand } ) to see if that finishes.

          I doubt anything is going to tell you about Deny having been selected. Certainly not from QProcess. The native Windows ShellExecute()-type calls might do.

          If it is really true that the QProcess never sees the process as having finished you might (first search and then) report it as a Qt bug to see whether the devs have anything to say.

          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