most GDI orders
This commit is contained in:
@@ -77,7 +77,6 @@ class ProxyServer(rdp.RDPServerObserver):
|
|||||||
def onSelectMachine(self, index):
|
def onSelectMachine(self, index):
|
||||||
"""
|
"""
|
||||||
@summary: Callback of view.List in Select server view
|
@summary: Callback of view.List in Select server view
|
||||||
@param: machine str name of machine selected
|
|
||||||
@param: index in list
|
@param: index in list
|
||||||
"""
|
"""
|
||||||
ip, port = self._machines[index]
|
ip, port = self._machines[index]
|
||||||
|
|||||||
@@ -590,6 +590,22 @@ class UInt16Le(SimpleType):
|
|||||||
"""
|
"""
|
||||||
SimpleType.__init__(self, "<H", 2, False, value, conditional = conditional, optional = optional, constant = constant)
|
SimpleType.__init__(self, "<H", 2, False, value, conditional = conditional, optional = optional, constant = constant)
|
||||||
|
|
||||||
|
class SInt16Le(SimpleType):
|
||||||
|
"""
|
||||||
|
@summary: signed short
|
||||||
|
with Little endian representation in stream
|
||||||
|
"""
|
||||||
|
def __init__(self, value = 0, conditional = lambda:True, optional = False, constant = False):
|
||||||
|
"""
|
||||||
|
@param value: python value wrap
|
||||||
|
@param conditional : Callable object
|
||||||
|
Read and Write operation depend on return of this function
|
||||||
|
@param optional: If there is no enough byte in current stream
|
||||||
|
And optional is True, read type is ignored
|
||||||
|
@param constant: Check if object value doesn't change after read operation
|
||||||
|
"""
|
||||||
|
SimpleType.__init__(self, "<h", 2, True, value, conditional = conditional, optional = optional, constant = constant)
|
||||||
|
|
||||||
class UInt32Be(SimpleType):
|
class UInt32Be(SimpleType):
|
||||||
"""
|
"""
|
||||||
@summary: unsigned int
|
@summary: unsigned int
|
||||||
|
|||||||
@@ -21,25 +21,109 @@
|
|||||||
GDI order structure
|
GDI order structure
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from rdpy.network.type import CompositeType, UInt8
|
from rdpy.base import log
|
||||||
|
from rdpy.base.error import InvalidExpectedDataException
|
||||||
|
from rdpy.network.type import CompositeType, UInt8, String, FactoryType, SInt8, SInt16Le
|
||||||
|
|
||||||
class ControlFlag(object):
|
class ControlFlag(object):
|
||||||
TS_STANDARD = 0x01
|
|
||||||
TS_SECONDARY = 0x02
|
|
||||||
|
|
||||||
class DrawingOrder(CompositeType):
|
|
||||||
"""
|
"""
|
||||||
GDI drawing orders
|
@summary: Class order of drawing order
|
||||||
@see: http://msdn.microsoft.com/en-us/library/cc241574.aspx
|
|
||||||
"""
|
|
||||||
def __init__(self):
|
|
||||||
CompositeType.__init__(self)
|
|
||||||
self.controlFlags = UInt8()
|
|
||||||
|
|
||||||
class PrimaryDrawingOrder(CompositeType):
|
|
||||||
"""
|
|
||||||
GDI Primary drawing order
|
|
||||||
@see: http://msdn.microsoft.com/en-us/library/cc241586.aspx
|
@see: http://msdn.microsoft.com/en-us/library/cc241586.aspx
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
TS_STANDARD = 0x01
|
||||||
CompositeType.__init__(self)
|
TS_SECONDARY = 0x02
|
||||||
|
TS_BOUNDS = 0x04
|
||||||
|
TS_TYPE_CHANGE = 0x08
|
||||||
|
TS_DELTA_COORDINATES = 0x10
|
||||||
|
TS_ZERO_BOUNDS_DELTAS = 0x20
|
||||||
|
TS_ZERO_FIELD_BYTE_BIT0 = 0x40
|
||||||
|
TS_ZERO_FIELD_BYTE_BIT1 = 0x80
|
||||||
|
|
||||||
|
class OrderType(object):
|
||||||
|
"""
|
||||||
|
@summary: Primary order type
|
||||||
|
@see: http://msdn.microsoft.com/en-us/library/cc241586.aspx
|
||||||
|
"""
|
||||||
|
TS_ENC_DSTBLT_ORDER = 0x00
|
||||||
|
TS_ENC_PATBLT_ORDER = 0x01
|
||||||
|
TS_ENC_SCRBLT_ORDER = 0x02
|
||||||
|
TS_ENC_DRAWNINEGRID_ORDER = 0x07
|
||||||
|
TS_ENC_MULTI_DRAWNINEGRID_ORDER = 0x08
|
||||||
|
TS_ENC_LINETO_ORDER = 0x09
|
||||||
|
TS_ENC_OPAQUERECT_ORDER = 0x0A
|
||||||
|
TS_ENC_SAVEBITMAP_ORDER = 0x0B
|
||||||
|
TS_ENC_MEMBLT_ORDER = 0x0D
|
||||||
|
TS_ENC_MEM3BLT_ORDER = 0x0E
|
||||||
|
TS_ENC_MULTIDSTBLT_ORDER = 0x0F
|
||||||
|
TS_ENC_MULTIPATBLT_ORDER = 0x10
|
||||||
|
TS_ENC_MULTISCRBLT_ORDER = 0x11
|
||||||
|
TS_ENC_MULTIOPAQUERECT_ORDER = 0x12
|
||||||
|
TS_ENC_FAST_INDEX_ORDER = 0x13
|
||||||
|
TS_ENC_POLYGON_SC_ORDER = 0x14
|
||||||
|
TS_ENC_POLYGON_CB_ORDER = 0x15
|
||||||
|
TS_ENC_POLYLINE_ORDER = 0x16
|
||||||
|
TS_ENC_FAST_GLYPH_ORDER = 0x18
|
||||||
|
TS_ENC_ELLIPSE_SC_ORDER = 0x19
|
||||||
|
TS_ENC_ELLIPSE_CB_ORDER = 0x1A
|
||||||
|
TS_ENC_INDEX_ORDER = 0x1B
|
||||||
|
|
||||||
|
class CoordField(CompositeType):
|
||||||
|
"""
|
||||||
|
@summary: used to describe a value in the range -32768 to 32767
|
||||||
|
@see: http://msdn.microsoft.com/en-us/library/cc241577.aspx
|
||||||
|
"""
|
||||||
|
def __init__(self, isDelta, conditional = lambda:True):
|
||||||
|
"""
|
||||||
|
@param isDelta: callable object to know if coord field is in delta mode
|
||||||
|
@param conditional: conditional read or write type
|
||||||
|
"""
|
||||||
|
CompositeType.__init__(self, conditional = conditional)
|
||||||
|
self.delta = SInt8(conditional = isDelta)
|
||||||
|
self.coordinate = SInt16Le(conditional = isDelta)
|
||||||
|
|
||||||
|
class PrimaryDrawingOrder(CompositeType):
|
||||||
|
"""
|
||||||
|
@summary: GDI Primary drawing order
|
||||||
|
@see: http://msdn.microsoft.com/en-us/library/cc241586.aspx
|
||||||
|
"""
|
||||||
|
def __init__(self, order = None):
|
||||||
|
CompositeType.__init__(self)
|
||||||
|
self.controlFlags = UInt8()
|
||||||
|
self.orderType = UInt8()
|
||||||
|
|
||||||
|
def OrderFactory():
|
||||||
|
"""
|
||||||
|
Closure for capability factory
|
||||||
|
"""
|
||||||
|
for c in [DstBltOrder]:
|
||||||
|
if self.orderType.value == c._ORDER_TYPE_:
|
||||||
|
return c(self.controlFlags)
|
||||||
|
log.debug("unknown Order type : %s"%hex(self.orderType.value))
|
||||||
|
#read entire packet
|
||||||
|
return String()
|
||||||
|
|
||||||
|
if order is None:
|
||||||
|
order = FactoryType(OrderFactory)
|
||||||
|
elif not "_ORDER_TYPE_" in order.__class__.__dict__:
|
||||||
|
raise InvalidExpectedDataException("Try to send an invalid order block")
|
||||||
|
|
||||||
|
class DstBltOrder(CompositeType):
|
||||||
|
"""
|
||||||
|
@summary: The DstBlt Primary Drawing Order is used to paint
|
||||||
|
a rectangle by using a destination-only raster operation.
|
||||||
|
@see: http://msdn.microsoft.com/en-us/library/cc241587.aspx
|
||||||
|
"""
|
||||||
|
#order type
|
||||||
|
_ORDER_TYPE_ = 0x00
|
||||||
|
#negotiation index
|
||||||
|
_NEGOTIATE_ = 0x00
|
||||||
|
|
||||||
|
def __init__(self, controlFlag):
|
||||||
|
CompositeType.__init__(self)
|
||||||
|
#only one field
|
||||||
|
self.fieldFlag = UInt8(conditional = lambda:(controlFlag.value & ControlFlag.TS_ZERO_FIELD_BYTE_BIT0 == 0 and controlFlag.value & ControlFlag.TS_ZERO_FIELD_BYTE_BIT1 == 0))
|
||||||
|
self.nLeftRect = CoordField(lambda:not controlFlag.value & ControlFlag.TS_DELTA_COORDINATES == 0)
|
||||||
|
self.nTopRect = CoordField(lambda:not controlFlag.value & ControlFlag.TS_DELTA_COORDINATES == 0)
|
||||||
|
self.nWidth = CoordField(lambda:not controlFlag.value & ControlFlag.TS_DELTA_COORDINATES == 0)
|
||||||
|
self.nHeight = CoordField(lambda:not controlFlag.value & ControlFlag.TS_DELTA_COORDINATES == 0)
|
||||||
|
self.bRop = CoordField(lambda:not controlFlag.value & ControlFlag.TS_DELTA_COORDINATES == 0)
|
||||||
Reference in New Issue
Block a user