Support more types of args
This commit is contained in:
parent
e29a8ea692
commit
a1daee56f8
|
@ -200,13 +200,16 @@ namespace de4dot.code {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getLocalVariableValue(VariableDefinition variable, out object value) {
|
bool getLocalVariableValue(VariableDefinition variable, out object value) {
|
||||||
if (variableValues == null)
|
if (variableValues == null)
|
||||||
variableValues = new VariableValues(blocks.Locals, allBlocks);
|
variableValues = new VariableValues(blocks.Locals, allBlocks);
|
||||||
var val = variableValues.getValue(variable);
|
var val = variableValues.getValue(variable);
|
||||||
if (!val.isValid())
|
if (!val.isValid()) {
|
||||||
throw new ApplicationException("Could not get value of local variable");
|
value = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
value = val.Value;
|
value = val.Value;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void findAllCallResults() {
|
void findAllCallResults() {
|
||||||
|
@ -320,17 +323,29 @@ namespace de4dot.code {
|
||||||
getLocalVariableValue(Instr.getLocalVar(blocks.Locals, instr), out arg);
|
getLocalVariableValue(Instr.getLocalVar(blocks.Locals, instr), out arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Code.Ldfld:
|
||||||
case Code.Ldsfld:
|
case Code.Ldsfld:
|
||||||
arg = instr.Operand;
|
arg = instr.Operand;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Log.w("Could not find all arguments to method {0} ({1:X8}), instr: {2}",
|
int pushes, pops;
|
||||||
Utils.removeNewlines(method),
|
DotNetUtils.calculateStackUsage(instr.Instruction, false, out pushes, out pops);
|
||||||
method.MetadataToken.ToInt32(),
|
if (pushes != 1) {
|
||||||
instr);
|
Log.w("Could not find all arguments to method {0} ({1:X8}), instr: {2}",
|
||||||
errors++;
|
Utils.removeNewlines(method),
|
||||||
return false;
|
method.MetadataToken.ToInt32(),
|
||||||
|
instr);
|
||||||
|
errors++;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < pops; i++) {
|
||||||
|
if (!getArg(method, block, ref arg, ref instrIndex))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
arg = null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user