From cbb9976866f9231fd5ca6904bc5c8c6e8d3fbea9 Mon Sep 17 00:00:00 2001 From: citronneur Date: Sun, 29 Jun 2014 21:09:42 +0200 Subject: [PATCH] Add screen def --- bin/rdpy-rdpclient | 11 +++++++++-- rdpy/protocol/rdp/gcc.py | 2 +- rdpy/protocol/rdp/rdp.py | 20 +++++++++++++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/bin/rdpy-rdpclient b/bin/rdpy-rdpclient index cba4142..ed55916 100755 --- a/bin/rdpy-rdpclient +++ b/bin/rdpy-rdpclient @@ -36,6 +36,13 @@ class RDPClientQtFactory(rdp.ClientFactory): """ Factory create a RDP GUI client """ + def __init__(self, width, height): + """ + init client with correct definition + """ + rdp.ClientFactory.__init__(self, width, height) + self._w = None + def buildObserver(self, controller): """ Build RFB observer @@ -45,7 +52,7 @@ class RDPClientQtFactory(rdp.ClientFactory): client = RDPClientQt(controller) #create qt widget self._w = client.getWidget() - self._w.resize(1024, 800) + self._w.resize(self._width, self._height) self._w.setWindowTitle('rdpyclient-rdp') self._w.show() return client @@ -82,7 +89,7 @@ if __name__ == '__main__': qt4reactor.install() from twisted.internet import reactor - reactor.connectTCP(sys.argv[1], int(sys.argv[2]), RDPClientQtFactory()) + reactor.connectTCP(sys.argv[1], int(sys.argv[2]), RDPClientQtFactory(1024, 800)) reactor.runReturn() app.exec_() reactor.stop() \ No newline at end of file diff --git a/rdpy/protocol/rdp/gcc.py b/rdpy/protocol/rdp/gcc.py index 60513f0..6d4eaaa 100644 --- a/rdpy/protocol/rdp/gcc.py +++ b/rdpy/protocol/rdp/gcc.py @@ -209,7 +209,7 @@ class ClientCoreSettings(CompositeType): CompositeType.__init__(self) self.rdpVersion = Version.RDP_VERSION_5_PLUS self.desktopWidth = UInt16Le(1280) - self.desktopHeight = UInt16Le(1024) + self.desktopHeight = UInt16Le(800) self.colorDepth = ColorDepth.RNS_UD_COLOR_8BPP self.sasSequence = Sequence.RNS_UD_SAS_DEL self.kbdLayout = KeyboardLayout.FRENCH diff --git a/rdpy/protocol/rdp/rdp.py b/rdpy/protocol/rdp/rdp.py index 350ed52..696cb95 100644 --- a/rdpy/protocol/rdp/rdp.py +++ b/rdpy/protocol/rdp/rdp.py @@ -45,9 +45,17 @@ class RDPController(object): observer.onBitmapUpdate(rectangle.destLeft.value, rectangle.destTop.value, rectangle.destRight.value, rectangle.destBottom.value, rectangle.width.value, rectangle.height.value, rectangle.bitsPerPixel.value, (rectangle.flags & pdu.BitmapFlag.BITMAP_COMPRESSION).value, rectangle.bitmapDataStream.value) class ClientFactory(protocol.Factory): - ''' + """ Factory of Client RDP protocol - ''' + """ + def __init__(self, width = 1024, height = 800): + """ + @param width: width of screen + @param height: height of screen + """ + self._width = width + self._height = height + def buildProtocol(self, addr): ''' Function call from twisted and build rdp protocol stack @@ -55,7 +63,13 @@ class ClientFactory(protocol.Factory): ''' controller = RDPController(LayerMode.CLIENT) self.buildObserver(controller) - return tpkt.TPKT(tpdu.createClient(mcs.createClient(controller))); + mcsLayer = mcs.createClient(controller) + + #set screen definition in MCS layer + mcsLayer._clientSettings.core.desktopHeight.value = self._height + mcsLayer._clientSettings.core.desktopWidth.value = self._width + + return tpkt.TPKT(tpdu.createClient(mcsLayer)); def buildObserver(self, controller): '''