Ejemplo n.º 1
0
 def test_dynamic_pointer_littleendian_64bit_deref():
     ptype.setbyteorder(config.byteorder.littleendian)
     t = dynamic.pointer(dynamic.block(4), pint.uint64_t)
     x = t(source=ptype.provider.string(
         '\x08\x00\x00\x00\x00\x00\x00\x00\x41\x41\x41\x41')).l
     if x.l.d.getoffset() == 8:
         raise Success
Ejemplo n.º 2
0
    def test_dynamic_pointer_littleendian_deref():
        ptype.setbyteorder(config.byteorder.littleendian)

        s = ptype.provider.string('\x04\x00\x00\x00\x44\x43\x42\x41')
        t = dynamic.pointer(dynamic.block(4))
        x = t(source=s)
        if x.l.d.getoffset() == 4:
            raise Success
Ejemplo n.º 3
0
    def test_dynamic_pointer_littleendian_1():
        ptype.setbyteorder(config.byteorder.littleendian)
        s = ptype.provider.string(string2)

        t = dynamic.pointer(dynamic.block(0))
        x = t(source=s).l
        if x.d.getoffset() == 0x41424344 and x.serialize() == string2:
            raise Success
Ejemplo n.º 4
0
    def test_dynamic_pointer_bigendian():
        ptype.setbyteorder(config.byteorder.bigendian)

        s = ptype.provider.string(string1)
        p = dynamic.pointer(dynamic.block(0))
        x = p(source=s).l
        if x.d.getoffset() == 0x41424344 and x.serialize() == string1:
            raise Success
Ejemplo n.º 5
0
    def test_dynamic_pointer_littleendian_deref():
        ptype.setbyteorder(config.byteorder.littleendian)

        s = ptype.provider.string('\x04\x00\x00\x00\x44\x43\x42\x41')
        t = dynamic.pointer(dynamic.block(4))
        x = t(source=s)
        if x.l.d.getoffset() == 4:
            raise Success
Ejemplo n.º 6
0
    def test_dynamic_pointer_littleendian_1():
        ptype.setbyteorder(config.byteorder.littleendian)
        s = ptype.provider.string(string2)

        t = dynamic.pointer(dynamic.block(0))
        x = t(source=s).l
        if x.d.getoffset() == 0x41424344 and x.serialize() == string2:
            raise Success
Ejemplo n.º 7
0
    def test_dynamic_pointer_bigendian():
        ptype.setbyteorder(config.byteorder.bigendian)

        s = ptype.provider.string(string1)
        p = dynamic.pointer(dynamic.block(0))
        x = p(source=s).l
        if x.d.getoffset() == 0x41424344 and x.serialize() == string1:
            raise Success
Ejemplo n.º 8
0
 def test_dynamic_pointer_littleendian_2():
     ptype.setbyteorder(config.byteorder.littleendian)
     string = '\x26\xf8\x1a\x77'
     s = ptype.provider.string(string)
     
     t = dynamic.pointer(dynamic.block(0))
     x = t(source=s).l
     if x.d.getoffset() == 0x771af826 and x.serialize() ==  string:
         raise Success
Ejemplo n.º 9
0
    def test_dynamic_pointer_littleendian_2():
        ptype.setbyteorder(config.byteorder.littleendian)
        string = '\x26\xf8\x1a\x77'
        s = ptype.provider.string(string)

        t = dynamic.pointer(dynamic.block(0))
        x = t(source=s).l
        if x.d.getoffset() == 0x771af826 and x.serialize() == string:
            raise Success
Ejemplo n.º 10
0
 def test_dynamic_pointer_littleendian_64bit_deref():
     ptype.setbyteorder(config.byteorder.littleendian)
     t = dynamic.pointer(dynamic.block(4), type=pint.uint64_t)
     x = t(source=ptype.provider.string('\x08\x00\x00\x00\x00\x00\x00\x00\x41\x41\x41\x41')).l
     if x.l.d.getoffset() == 8:
         raise Success