mirror of
https://github.com/hakril/PythonForWindows
synced 2026-06-08 14:31:45 +00:00
Add __mul__ on Instruction + x64 on test_code
This commit is contained in:
@@ -85,7 +85,6 @@ class CodeTesteur(dbg.Debugger):
|
||||
exc_code = x.ExceptionRecord.ExceptionCode
|
||||
exc_addr = x.ExceptionRecord.ExceptionAddress
|
||||
if not self.init_breakpoint and exc_code == EXCEPTION_BREAKPOINT:
|
||||
print("Init breakpoint")
|
||||
self.init_breakpoint = True
|
||||
return
|
||||
ctx = self.current_thread.context
|
||||
@@ -161,6 +160,9 @@ if len(sys.argv) < 2:
|
||||
if sys.argv[1] == "-x64":
|
||||
sys.argv.remove("-x64")
|
||||
test_code_x64()
|
||||
elif sys.argv[1] == "--raw":
|
||||
sys.argv.remove("--raw")
|
||||
pass
|
||||
else:
|
||||
test_code_x86()
|
||||
|
||||
|
||||
@@ -735,6 +735,14 @@ class Instruction(object):
|
||||
prefix_opcode = b"".join(chr(p.PREFIX_VALUE) for p in self.prefix)
|
||||
return prefix_opcode + bytes(self.value.dump())
|
||||
|
||||
def __mul__(self, value):
|
||||
if not isinstance(value, (int, long)):
|
||||
return NotImplemented
|
||||
res = MultipleInstr()
|
||||
for i in range(value):
|
||||
res += self
|
||||
return res
|
||||
|
||||
|
||||
class DelayedJump(object):
|
||||
def __init__(self, type, label):
|
||||
|
||||
@@ -529,6 +529,20 @@ class Instruction(object):
|
||||
prefix_opcode = b"".join(chr(p.PREFIX_VALUE) for p in self.prefix)
|
||||
return prefix_opcode + bytes(self.value.dump())
|
||||
|
||||
#def __add__(self, other):
|
||||
# res = MultipleInstr()
|
||||
# res += self
|
||||
# res += other
|
||||
# return res
|
||||
|
||||
def __mul__(self, value):
|
||||
if not isinstance(value, (int, long)):
|
||||
return NotImplemented
|
||||
res = MultipleInstr()
|
||||
for i in range(value):
|
||||
res += self
|
||||
return res
|
||||
|
||||
|
||||
# Jump helpers
|
||||
class DelayedJump(object):
|
||||
|
||||
Reference in New Issue
Block a user