Skip to content

Commit 38aef8e

Browse files
committed
Fix py3 compat for some remote ctypes code
1 parent c666882 commit 38aef8e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

windows/remotectypes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ def value(self):
105105
res = []
106106
for i in itertools.count():
107107
x = self.target.read_memory(base + (i * 0x100), 0x100)
108-
if "\x00" in x:
109-
res.append(x.split("\x00", 1)[0])
108+
if b"\x00" in x:
109+
res.append(x.split(b"\x00", 1)[0])
110110
break
111111
res.append(x)
112-
return "".join(res)
112+
return b"".join(res)
113113

114114

115115
class RemoteWCharP(RemotePtr, ctypes.c_char_p):
@@ -362,7 +362,7 @@ def _handle_field_getattr(self, ftype, fosset, fsize):
362362
if issubclass(ftype, _ctypes.Array): # Arrays
363363
# if this is a string: just cast the read value to string
364364
if ftype._type_ == ctypes.c_char: # Use issubclass instead ?
365-
return s.split("\x00", 1)[0]
365+
return s.split(b"\x00", 1)[0]
366366
elif ftype._type_ == ctypes.c_wchar: # Use issubclass instead ?
367367
# Decode from utf16 -> size /=2 | put it in a wchar array | split at the first "\x00"
368368
return (ftype._type_ * (fsize / 2)).from_buffer_copy(s.decode('utf16'))[:].split("\x00", 1)[0] # Sorry..

0 commit comments

Comments
 (0)