Example #1
0
    def test_from_stream(self):
        ae = self.assertEqual

        stream = ByteIStream(bytes([x for x in range(17)]))
        uuid1 = GUIDToUUID.from_stream(stream, byte_order=LITTLE_ENDIAN)
        uuid2 = GUIDToUUID.from_stream(stream, 1, byte_order=LITTLE_ENDIAN)

        stream.seek(0, SEEK_SET)
        uuid3 = GUIDToUUID.from_stream(stream, byte_order=BIG_ENDIAN)
        uuid4 = GUIDToUUID.from_stream(stream, 1, byte_order=BIG_ENDIAN)

        ae(uuid1, UUID(bytes_le=bytes([x for x in range(16)])))
        ae(uuid2, UUID(bytes_le=bytes([x for x in range(1, 17)])))
        ae(uuid3, UUID(bytes=bytes([x for x in range(16)])))
        ae(uuid4, UUID(bytes=bytes([x for x in range(1, 17)])))
Example #2
0
    def test_from_stream(self):
        ae = self.assertEqual

        stream = ByteIStream(bytes([x for x in range(17)]))
        uuid1 = GUIDToUUID.from_stream(stream, byte_order=LITTLE_ENDIAN)
        uuid2 = GUIDToUUID.from_stream(stream, 1, byte_order=LITTLE_ENDIAN)

        stream.seek(0, SEEK_SET)
        uuid3 = GUIDToUUID.from_stream(stream, byte_order=BIG_ENDIAN)
        uuid4 = GUIDToUUID.from_stream(stream, 1, byte_order=BIG_ENDIAN)

        ae(uuid1, UUID(bytes_le=bytes([x for x in range(16)])))
        ae(uuid2, UUID(bytes_le=bytes([x for x in range(1, 17)])))
        ae(uuid3, UUID(bytes=bytes([x for x in range(16)])))
        ae(uuid4, UUID(bytes=bytes([x for x in range(1, 17)])))
Example #3
0
    def test_from_stream(self):
        ae = self.assertEqual

        data = bytes([x for x in range(28)])
        stream = ByteIStream(data)
        kfp1 = KnownFolderProps.from_stream(stream)
        kfp2 = KnownFolderProps.from_stream(stream, 0)

        ae(kfp1.size, 0x03020100)
        ae(kfp2.size, 0x03020100)

        ae(kfp1.sig, 0x07060504)
        ae(kfp2.sig, 0x07060504)

        kf_id = GUIDToUUID.from_stream(ByteIStream(data[8:24]))
        ae(kfp1.kf_id, kf_id)
        ae(kfp2.kf_id, kf_id)

        ae(kfp1.offset, 0x1B1A1918)
        ae(kfp2.offset, 0x1B1A1918)
Example #4
0
    def test_from_stream(self):
        ae = self.assertEqual

        data = bytes([x for x in range(28)])
        stream = ByteIStream(data)
        kfp1 = KnownFolderProps.from_stream(stream)
        kfp2 = KnownFolderProps.from_stream(stream, 0)

        ae(kfp1.size, 0x03020100)
        ae(kfp2.size, 0x03020100)

        ae(kfp1.sig, 0x07060504)
        ae(kfp2.sig, 0x07060504)

        kf_id = GUIDToUUID.from_stream(ByteIStream(data[8:24]))
        ae(kfp1.kf_id, kf_id)
        ae(kfp2.kf_id, kf_id)

        ae(kfp1.offset, 0x1B1A1918)
        ae(kfp2.offset, 0x1B1A1918)