From b0ee9e987f3cf1b1977f5ace5696dcbb1e9b19f6 Mon Sep 17 00:00:00 2001 From: de4dot Date: Mon, 21 Apr 2014 15:24:24 +0200 Subject: [PATCH] Add another InstructionEmulator.Initialize() method --- de4dot.blocks/cflow/InstructionEmulator.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/de4dot.blocks/cflow/InstructionEmulator.cs b/de4dot.blocks/cflow/InstructionEmulator.cs index f42bdff6..519b0896 100644 --- a/de4dot.blocks/cflow/InstructionEmulator.cs +++ b/de4dot.blocks/cflow/InstructionEmulator.cs @@ -52,8 +52,12 @@ namespace de4dot.blocks.cflow { } public void Initialize(MethodDef method, bool emulateFromFirstInstruction) { - this.parameterDefs = method.Parameters; - this.localDefs = method.Body.Variables; + Initialize(method, method.Parameters, method.Body.Variables, method.Body.InitLocals, emulateFromFirstInstruction); + } + + public void Initialize(MethodDef method, IList methodParameters, IList methodLocals, bool initLocals, bool emulateFromFirstInstruction) { + this.parameterDefs = methodParameters; + this.localDefs = methodLocals; valueStack.Initialize(); protectedStackValues.Clear(); @@ -75,7 +79,7 @@ namespace de4dot.blocks.cflow { args.Clear(); args.AddRange(cached_args); locals.Clear(); - locals.AddRange(method.Body.InitLocals && emulateFromFirstInstruction ? cached_zeroed_locals : cached_locals); + locals.AddRange(initLocals && emulateFromFirstInstruction ? cached_zeroed_locals : cached_locals); } public void SetProtected(Value value) {