def _read_remote_string(self, address, as_unicode=True):
"""Reads a string from Winamp's memory address space."""
if not self.wa_hproc:
#print("Trying to read Winamp's memory without having found any instance!")
return None
buflen = 1024
if as_unicode:
buffer = ctypes.create_unicode_buffer(buflen)
else:
buffer = ctypes.create_string_buffer(buflen)
bytes_read = ctypes.c_size_t(0)
if not ctypes.windll.kernel32.ReadProcessMemory(
self.wa_hproc, address, buffer, buflen, ctypes.byref(bytes_read)):
winerr = ctypes.GetLastError()
#print(
# "Failed to read memory from Winamp's memory space:",
# ctypes.FormatError(winerr))
return None
return buffer.value
评论列表
文章目录