Qt World Summit: Register Today!

[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", "patch.lotro.com:6015", 
                                          "--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 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.

  • Lifetime Qt Champion

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

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

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

Log in to reply