Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. [pyqt5] QProcess instantly finishes without output when using rundll32 Windows
Forum Updated to NodeBB v4.3 + New Features

[pyqt5] QProcess instantly finishes without output when using rundll32 Windows

Scheduled Pinned Locked Moved Solved Qt for Python
4 Posts 2 Posters 1.0k 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.
  • D Offline
    D Offline
    deleted355
    wrote on last edited by deleted355
    #1

    I am trying to launch a patching dll for The Lord of The Rings Online with QProcess and get the output, but it only works on Linux (where I am doing it through wine with QProcess). I think it would be the same with any dll though. I just don't know of any standard ones I could use in an example.

    I have tried a lot without success, and have come to the conclusion that the issue may be rundll32 launching the patcher as a separate process that is not tracked by QProcess. This doesn't even really hold up though, because the patching at least in my testing (others say it has worked sometimes) has not happened.

    Example:

    from qtpy import QtCore, QtWidgets
    import sys
    
    class PatchWindow(QtWidgets.QMainWindow):
        def __init__(self):
            super().__init__()
            self.setFixedSize(720, 400)
    
            self.txtLog = QtWidgets.QTextBrowser(self)
            self.txtLog.setGeometry(5,5,710,351)
    
            self.process = QtCore.QProcess()
            self.process.readyReadStandardOutput.connect(self.readOutput)
            self.process.readyReadStandardError.connect(self.readErrors)
            self.process.finished.connect(self.processFinished)
    
            self.process.setWorkingDirectory("C:/LOTRO/")
    
            self.show()
    
            self.startProcess()
    
        def readOutput(self):
            line = self.process.readAllStandardOutput()
            line = str(line, encoding="utf8", errors="replace")
            self.txtLog.append(line)
    
        def readErrors(self):
            line = self.process.readAllStandardError()
            line = str(line, encoding="utf8", errors="replace")
            self.txtLog.append(line)
    
        def processFinished(self, exitCode, exitStatus):
            self.txtLog.append("Process Finished")
    
        def startProcess(self):
            self.process.start("rundll32", ["patchclient.dll,Patch", "patch.lotro.com:6015", 
                                          "--language DE", "--productcode LOTRO", "--highres"])
            self.txtLog.append("Process Started")
    
    app = QtWidgets.QApplication(sys.argv)
    PatchWindow = PatchWindow()
    
    sys.exit(app.exec_())
    

    There should be output similar to:

    Connecting to patch.lotro.com:6015
    
    Checking files...
    files to patch: 0 bytes to download: 0
    Patching files:
    
    File patching complete
    

    , but there is nothing. The actual code for this project is here

    Any help is appreciated.

    jsulmJ 1 Reply Last reply
    0
    • D deleted355

      I am trying to launch a patching dll for The Lord of The Rings Online with QProcess and get the output, but it only works on Linux (where I am doing it through wine with QProcess). I think it would be the same with any dll though. I just don't know of any standard ones I could use in an example.

      I have tried a lot without success, and have come to the conclusion that the issue may be rundll32 launching the patcher as a separate process that is not tracked by QProcess. This doesn't even really hold up though, because the patching at least in my testing (others say it has worked sometimes) has not happened.

      Example:

      from qtpy import QtCore, QtWidgets
      import sys
      
      class PatchWindow(QtWidgets.QMainWindow):
          def __init__(self):
              super().__init__()
              self.setFixedSize(720, 400)
      
              self.txtLog = QtWidgets.QTextBrowser(self)
              self.txtLog.setGeometry(5,5,710,351)
      
              self.process = QtCore.QProcess()
              self.process.readyReadStandardOutput.connect(self.readOutput)
              self.process.readyReadStandardError.connect(self.readErrors)
              self.process.finished.connect(self.processFinished)
      
              self.process.setWorkingDirectory("C:/LOTRO/")
      
              self.show()
      
              self.startProcess()
      
          def readOutput(self):
              line = self.process.readAllStandardOutput()
              line = str(line, encoding="utf8", errors="replace")
              self.txtLog.append(line)
      
          def readErrors(self):
              line = self.process.readAllStandardError()
              line = str(line, encoding="utf8", errors="replace")
              self.txtLog.append(line)
      
          def processFinished(self, exitCode, exitStatus):
              self.txtLog.append("Process Finished")
      
          def startProcess(self):
              self.process.start("rundll32", ["patchclient.dll,Patch", "patch.lotro.com:6015", 
                                            "--language DE", "--productcode LOTRO", "--highres"])
              self.txtLog.append("Process Started")
      
      app = QtWidgets.QApplication(sys.argv)
      PatchWindow = PatchWindow()
      
      sys.exit(app.exec_())
      

      There should be output similar to:

      Connecting to patch.lotro.com:6015
      
      Checking files...
      files to patch: 0 bytes to download: 0
      Patching files:
      
      File patching complete
      

      , but there is nothing. The actual code for this project is here

      Any help is appreciated.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Jeremy-Stepp said in [pyqt5] QProcess instantly finishes without output when using rundll32 Windows:

      self.process.start("rundll32 patchclient.dll,Patch patch.lotro.com:6015 --language DE --productcode LOTRO --highres")

      You're using QProcess wrongly. Executable and parameters are passed as two different parameters to start.
      See example here: https://doc.qt.io/qt-5/qprocess.html

      myProcess->start(program, arguments);
      

      Also, each parameter to executable has to be an entry in the parameter/argument list.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        deleted355
        wrote on last edited by
        #3

        Thanks. I didn't know that there is a specific right way to do it, so I just put what seamed clearest in the example. I have gone ahead and edited the question.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          deleted355
          wrote on last edited by
          #4

          I forgot to post here when I solved this. The issue was that rundll32 doesn't provide any output for the dll on Windows. I was testing through WINE which does provide output. The couple reports of the patching working and more reports of it not working was a separate issue with PyInstaller. Not having a setup for testing on actual Windows made this much more difficult than it should have been.

          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