Exemplo n.º 1
0
    def platformReadMemory(self, address, size):
        map = self.getMemoryMap(address)
        if map is None:
            raise Exception("ERROR: platformReadMemory says no map for 0x%.8x" % address)
        offset = address - map[0]  # Base address
        mapbytes = self.s_mem.get(map[0], None)
        if mapbytes is None:
            raise vtrace.PlatformException("ERROR: Memory map at 0x%.8x is not backed!" % map[0])
        if len(mapbytes) == 0:
            raise vtrace.PlatformException("ERROR: Memory Map at 0x%.8x is backed by ''" % map[0])

        ret = mapbytes[offset:offset+size]
        rlen = len(ret)
        # We may have a cross-map read, just recurse for the rest
        if rlen != size:
            ret += self.platformReadMemory(address+rlen, size-rlen)
        return ret
Exemplo n.º 2
0
def raiseWin32Error(name):
    raise vtrace.PlatformException("Win32 Error %s failed: %s" %
                                   (name, kernel32.GetLastError()))