@@ -418,7 +418,7 @@ def __init__(self, minidump_file, trace=False):
418418 self .regs = Registers (self ._uc , self ._x64 )
419419 self .args = Arguments (self ._uc , self .regs , self ._x64 )
420420 self ._allocate_base = None
421- self ._allocate_size = 0x10000
421+ self ._allocate_size = 1024 * 1024 * 10 # NOTE: 10 megs
422422 self ._allocate_ptr = None
423423 self ._setup_emulator ()
424424 self .exit_code = None
@@ -819,11 +819,16 @@ def _hook_syscall(uc: Uc, dp: Dumpulator):
819819 argspec = inspect .getfullargspec (cb )
820820 args = []
821821
822+ def syscall_arg (index ):
823+ if index == 0 and dp .ptr_size () == 8 :
824+ return dp .regs .r10
825+ return dp .args [index ]
826+
822827 print (f"syscall: { name } (" )
823828 for i in range (0 , argcount ):
824829 argname = argspec .args [1 + i ]
825830 argtype = argspec .annotations [argname ]
826- argvalue = dp . args [ i ]
831+ argvalue = syscall_arg ( i )
827832 if issubclass (argtype , PVOID ):
828833 argvalue = argtype (argvalue , dp )
829834 else :
@@ -840,6 +845,7 @@ def _hook_syscall(uc: Uc, dp: Dumpulator):
840845 status = cb (dp , * args )
841846 print (f"status = { status :x} " )
842847 dp .regs .cax = status
848+ dp .regs .ccx = dp .regs .cip + 2
843849 except Exception as exc :
844850 sys .stderr = sys .stdout
845851 traceback .print_exception (type (exc ), exc , exc .__traceback__ )
0 commit comments