예제 #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
예제 #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
예제 #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
예제 #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
예제 #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
예제 #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
예제 #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
예제 #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
예제 #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
예제 #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
예제 #11
0
 class test(dynamic.union):
     root = dynamic.array(pint.uint8_t, 4)
     _fields_ = [
         (dynamic.block(4), 'block'),
         (pint.uint32_t, 'int'),
     ]