Preserve tokens if VM code couldn't be restored
This commit is contained in:
parent
e8a9c0675a
commit
6ce3b44de6
|
@ -271,8 +271,12 @@ namespace de4dot.code.deobfuscators.Agile_NET {
|
|||
}
|
||||
|
||||
if (options.RestoreVmCode) {
|
||||
csvm.restore();
|
||||
addResourceToBeRemoved(csvm.Resource, "CSVM data resource");
|
||||
if (csvm.restore())
|
||||
addResourceToBeRemoved(csvm.Resource, "CSVM data resource");
|
||||
else {
|
||||
Logger.e("Couldn't restore VM methods");
|
||||
preserveTokensAndTypes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,13 +78,17 @@ namespace de4dot.code.deobfuscators.Agile_NET.vm {
|
|||
return DotNetUtils.getResource(module, "_CSVM") as EmbeddedResource;
|
||||
}
|
||||
|
||||
public void restore() {
|
||||
public bool restore() {
|
||||
if (!Detected)
|
||||
return;
|
||||
return true;
|
||||
|
||||
int oldIndent = Logger.Instance.IndentLevel;
|
||||
try {
|
||||
restore2();
|
||||
return true;
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
Logger.Instance.IndentLevel = oldIndent;
|
||||
|
|
Loading…
Reference in New Issue
Block a user