0

我正在尝试使用 QProcess 为 The Lord of The Rings Online 启动补丁 dll 并获取输出,但它仅适用于 Linux(我通过使用 QProcess 的 wine 进行此操作)。

我已经尝试了很多但没有成功,并得出结论,问题可能是 rundll32 将修补程序作为 QProcess 未跟踪的单独进程启动。但这甚至都没有真正成立,因为至少在我的测试中(其他人说它有时会起作用)的补丁还没有发生。

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_())

应该有类似的输出

Connecting to patch.lotro.com:6015

Checking files...
files to patch: 0 bytes to download: 0
Patching files:

File patching complete

,但什么都没有。实际代码在这里

4

1 回答 1

0

问题是 rundll32 没有为 Windows 上的 dll 提供任何输出。我正在通过提供输出的 WINE 进行测试。PyInstaller 有两个关于修补工作的报告和更多关于它不工作的报告是一个单独的问题。没有在实际 Windows 上进行测试的设置使得这比原本应该做的要困难得多。

于 2020-07-24T20:10:13.450 回答