(self, lpBaseAddress, nSize)
return data
Reads the memory of the process.

        @see: L{read}

        @type  lpBaseAddress: int
        @param lpBaseAddress: Memory address to begin reading.

        @type  nSize: int
        @param nSize: Number of bytes to read.

        @rtype:  str
        @return: Bytes read from the process memory.
            Returns an empty string on error.
Reads the memory of the process.
Reads the memory of the process .
def peek(self, lpBaseAddress, nSize):
        """
        Reads the memory of the process.

        @see: L{read}

        @type  lpBaseAddress: int
        @param lpBaseAddress: Memory address to begin reading.

        @type  nSize: int
        @param nSize: Number of bytes to read.

        @rtype:  str
        @return: Bytes read from the process memory.
            Returns an empty string on error.
        """
        # XXX TODO
        # + Maybe change page permissions before trying to read?
        # + Maybe use mquery instead of get_memory_map?
        #   (less syscalls if we break out of the loop earlier)
        data = ''
        if nSize > 0:
            try:
                hProcess = self.get_handle( win32.PROCESS_VM_READ |
                                            win32.PROCESS_QUERY_INFORMATION )
                for mbi in self.get_memory_map(lpBaseAddress,
                                               lpBaseAddress + nSize):
                    if not mbi.is_readable():
                        nSize = mbi.BaseAddress - lpBaseAddress
                        break
                if nSize > 0:
                    data = win32.ReadProcessMemory(
                                    hProcess, lpBaseAddress, nSize)
            except WindowsError:
                e = sys.exc_info()[1]
                msg = "Error reading process %d address %s: %s"
                msg %= (self.get_pid(),
                        HexDump.address(lpBaseAddress),
                        e.strerror)
                warnings.warn(msg)
        return data
def peek ( self , lpBaseAddress , nSize ) : # XXX TODO # + Maybe change page permissions before trying to read? # + Maybe use mquery instead of get_memory_map? #   (less syscalls if we break out of the loop earlier) data = '' if nSize > 0 : try : hProcess = self . get_handle ( win32 . PROCESS_VM_READ | win32 . PROCESS_QUERY_INFORMATION ) for mbi in self . get_memory_map ( lpBaseAddress , lpBaseAddress + nSize ) : if not mbi . is_readable ( ) : nSize = mbi . BaseAddress - lpBaseAddress break if nSize > 0 : data = win32 . ReadProcessMemory ( hProcess , lpBaseAddress , nSize ) except WindowsError : e = sys . exc_info ( ) [ 1 ] msg = "Error reading process %d address %s: %s" msg %= ( self . get_pid ( ) , HexDump . address ( lpBaseAddress ) , e . strerror ) warnings . warn ( msg ) return data