mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-02-23 16:12:30 +00:00
support disassembling bytes from memoryview
This commit is contained in:
parent
af57fb3a01
commit
3f75a02950
@ -1099,7 +1099,7 @@ class Cs(object):
|
||||
print(code)'''
|
||||
# Pass a bytearray by reference
|
||||
size = len(code)
|
||||
if isinstance(code, bytearray):
|
||||
if isinstance(code, (bytearray, memoryview)):
|
||||
code = ctypes.byref(ctypes.c_char.from_buffer(code))
|
||||
res = _cs.cs_disasm(self.csh, code, size, offset, count, ctypes.byref(all_insn))
|
||||
if res > 0:
|
||||
@ -1127,7 +1127,7 @@ class Cs(object):
|
||||
all_insn = ctypes.POINTER(_cs_insn)()
|
||||
size = len(code)
|
||||
# Pass a bytearray by reference
|
||||
if isinstance(code, bytearray):
|
||||
if isinstance(code, (bytearray, memoryview) ):
|
||||
code = ctypes.byref(ctypes.c_char.from_buffer(code))
|
||||
res = _cs.cs_disasm(self.csh, code, size, offset, count, ctypes.byref(all_insn))
|
||||
if res > 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user