Ignore call if we can't get all args
This commit is contained in:
parent
9c83c22469
commit
39dbf5d9b2
|
@ -214,26 +214,29 @@ namespace de4dot {
|
||||||
if (callResult == null)
|
if (callResult == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (findArgs(callResult))
|
||||||
callResults.Add(callResult);
|
callResults.Add(callResult);
|
||||||
findArgs(callResult);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void findArgs(CallResult callResult) {
|
bool findArgs(CallResult callResult) {
|
||||||
var block = callResult.block;
|
var block = callResult.block;
|
||||||
var method = callResult.getMethodReference();
|
var method = callResult.getMethodReference();
|
||||||
int numArgs = method.Parameters.Count + (method.HasThis ? 1 : 0);
|
int numArgs = method.Parameters.Count + (method.HasThis ? 1 : 0);
|
||||||
var args = new object[numArgs];
|
var args = new object[numArgs];
|
||||||
|
|
||||||
int instrIndex = callResult.callEndIndex - 1;
|
int instrIndex = callResult.callEndIndex - 1;
|
||||||
for (int i = numArgs - 1; i >= 0; i--)
|
for (int i = numArgs - 1; i >= 0; i--) {
|
||||||
getArg(method, block, ref args[i], ref instrIndex);
|
if (!getArg(method, block, ref args[i], ref instrIndex))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
callResult.args = args;
|
callResult.args = args;
|
||||||
callResult.callStartIndex = instrIndex + 1;
|
callResult.callStartIndex = instrIndex + 1;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getArg(MethodReference method, Block block, ref object arg, ref int instrIndex) {
|
bool getArg(MethodReference method, Block block, ref object arg, ref int instrIndex) {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (instrIndex < 0)
|
if (instrIndex < 0)
|
||||||
throw new ApplicationException(string.Format("Could not find all arguments to method {0}", method));
|
throw new ApplicationException(string.Format("Could not find all arguments to method {0}", method));
|
||||||
|
@ -280,10 +283,13 @@ namespace de4dot {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new ApplicationException(string.Format("Could not find all arguments to method {0}, instr: {1}", method, instr));
|
Log.v("Could not find all arguments to method {0}, instr: {1}", method, instr);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void inlineReturnValues() {
|
void inlineReturnValues() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user