Important: Please read the Qt Code of Conduct -

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

  • 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.


    from qtpy import QtCore, QtWidgets
    import sys
    class PatchWindow(QtWidgets.QMainWindow):
        def __init__(self):
            self.setFixedSize(720, 400)
            self.txtLog = QtWidgets.QTextBrowser(self)
            self.process = QtCore.QProcess()
        def readOutput(self):
            line = self.process.readAllStandardOutput()
            line = str(line, encoding="utf8", errors="replace")
        def readErrors(self):
            line = self.process.readAllStandardError()
            line = str(line, encoding="utf8", errors="replace")
        def processFinished(self, exitCode, exitStatus):
            self.txtLog.append("Process Finished")
        def startProcess(self):
            self.process.start("rundll32", ["patchclient.dll,Patch", "", 
                                          "--language DE", "--productcode LOTRO", "--highres"])
            self.txtLog.append("Process Started")
    app = QtWidgets.QApplication(sys.argv)
    PatchWindow = PatchWindow()

    There should be output similar to:

    Connecting to
    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.

  • Qt Champions 2019

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

    self.process.start("rundll32 patchclient.dll,Patch --language DE --productcode LOTRO --highres")

    You're using QProcess wrongly. Executable and parameters are passed as two different parameters to start.
    See example here:

    myProcess->start(program, arguments);

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

  • 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.

Log in to reply