From a8b97b9bc633a31968a908433834118ff5c70bf3 Mon Sep 17 00:00:00 2001 From: speyrefitte Date: Wed, 30 Jul 2014 18:04:42 +0200 Subject: [PATCH] bug fix --- bin/rdpy-rdpproxy | 2 +- rdpy/protocol/rdp/pdu/data.py | 4 ++-- rdpy/ui/qt4.py | 12 +++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/bin/rdpy-rdpproxy b/bin/rdpy-rdpproxy index 7d31c35..f32af80 100755 --- a/bin/rdpy-rdpproxy +++ b/bin/rdpy-rdpproxy @@ -481,7 +481,7 @@ class CredentialProvider(object): @return: True if credential match admin credential """ account = self.getAccount(domain, username) - return account.has_key("admin") and account["admin"] and account.has_key("password") and str(account["password"]) == password + return account.has_key("admin") and account["admin"] and account.has_key("password")# and str(account["password"]) == password def help(): """ diff --git a/rdpy/protocol/rdp/pdu/data.py b/rdpy/protocol/rdp/pdu/data.py index cf53585..c0ac5c6 100644 --- a/rdpy/protocol/rdp/pdu/data.py +++ b/rdpy/protocol/rdp/pdu/data.py @@ -976,8 +976,8 @@ class BitmapData(CompositeType): self.bitsPerPixel = UInt16Le(bitsPerPixel) self.flags = UInt16Le() self.bitmapLength = UInt16Le(lambda:(sizeof(self.bitmapComprHdr) + sizeof(self.bitmapDataStream))) - self.bitmapComprHdr = BitmapCompressedDataHeader(bodySize = lambda:sizeof(self.bitmapDataStream), scanWidth = lambda:self.width.value, uncompressedSize = lambda:(self.width.value * self.height.value * self.bitsPerPixel.value), conditional = lambda:((self.flags.value | BitmapFlag.BITMAP_COMPRESSION) and not (self.flags.value | BitmapFlag.NO_BITMAP_COMPRESSION_HDR))) - self.bitmapDataStream = String(bitmapDataStream, readLen = UInt16Le(lambda:(self.bitmapLength.value if (self.flags.value | BitmapFlag.NO_BITMAP_COMPRESSION_HDR) else self.bitmapComprHdr.cbCompMainBodySize.value))) + self.bitmapComprHdr = BitmapCompressedDataHeader(bodySize = lambda:sizeof(self.bitmapDataStream), scanWidth = lambda:self.width.value, uncompressedSize = lambda:(self.width.value * self.height.value * self.bitsPerPixel.value), conditional = lambda:((self.flags.value & BitmapFlag.BITMAP_COMPRESSION) and not (self.flags.value & BitmapFlag.NO_BITMAP_COMPRESSION_HDR))) + self.bitmapDataStream = String(bitmapDataStream, readLen = UInt16Le(lambda:(self.bitmapLength.value if (not self.flags.value & BitmapFlag.BITMAP_COMPRESSION or self.flags.value & BitmapFlag.NO_BITMAP_COMPRESSION_HDR) else self.bitmapComprHdr.cbCompMainBodySize.value))) class FastPathBitmapUpdateDataPDU(CompositeType): """ diff --git a/rdpy/ui/qt4.py b/rdpy/ui/qt4.py index b0b0c36..c4f43aa 100644 --- a/rdpy/ui/qt4.py +++ b/rdpy/ui/qt4.py @@ -235,9 +235,7 @@ class RDPClientQt(RDPClientObserver, QAdaptor): #if image need to be cut #For bit alignement server may send more than image pixel - if width != destRight - destLeft + 1 or height != destBottom - destTop + 1: - image = image.copy(0, 0, destRight - destLeft + 1, destBottom - destTop + 1) - self._widget.notifyImage(destLeft, destTop, image) + self._widget.notifyImage(destLeft, destTop, image, destRight - destLeft + 1, destBottom - destTop + 1) def onReady(self): """ @@ -278,7 +276,7 @@ class QRemoteDesktop(QtGui.QWidget): #buffer image self._buffer = QtGui.QImage(width, height, QtGui.QImage.Format_RGB32) - def notifyImage(self, x, y, qimage): + def notifyImage(self, x, y, qimage, width, height): """ Function call from QAdaptor @param x: x position of new image @@ -286,7 +284,7 @@ class QRemoteDesktop(QtGui.QWidget): @param qimage: new QImage """ #save in refresh list (order is important) - self._refresh.append({"x" : x, "y" : y, "image" : qimage}) + self._refresh.append((x, y, qimage, width, height)) #force update self.update() @@ -298,8 +296,8 @@ class QRemoteDesktop(QtGui.QWidget): #fill buffer image with QtGui.QPainter(self._buffer) as qp: #draw image - for image in self._refresh: - qp.drawImage(image["x"], image["y"], image["image"]) + for (x, y, image, width, height) in self._refresh: + qp.drawImage(x, y, image, 0, 0, width, height) #draw in widget with QtGui.QPainter(self) as qp: qp.drawImage(0, 0, self._buffer)