Don't remove fields if we should keep all types

This commit is contained in:
de4dot 2012-11-09 02:15:28 +01:00
parent 3b740a4106
commit d00fcb79e4
2 changed files with 6 additions and 2 deletions

View File

@ -266,7 +266,7 @@ done:
} }
public override void deobfuscateEnd() { public override void deobfuscateEnd() {
if (options.RestoreFields) if (options.RestoreFields && CanRemoveTypes)
fieldsRestorer.cleanUp(); fieldsRestorer.cleanUp();
removeInlinedMethods(); removeInlinedMethods();

View File

@ -89,6 +89,10 @@ namespace de4dot.code.deobfuscators {
get { return false; } get { return false; }
} }
protected bool CanRemoveTypes {
get { return !Operations.KeepObfuscatorTypes && !KeepTypes; }
}
protected bool CanRemoveStringDecrypterType { protected bool CanRemoveStringDecrypterType {
get { return Operations.DecryptStrings != OpDecryptString.None && staticStringInliner.InlinedAllCalls; } get { return Operations.DecryptStrings != OpDecryptString.None && staticStringInliner.InlinedAllCalls; }
} }
@ -161,7 +165,7 @@ namespace de4dot.code.deobfuscators {
} }
public virtual void deobfuscateEnd() { public virtual void deobfuscateEnd() {
if (!Operations.KeepObfuscatorTypes && !KeepTypes) { if (CanRemoveTypes) {
removeTypesWithInvalidBaseTypes(); removeTypesWithInvalidBaseTypes();
deleteEmptyCctors(); deleteEmptyCctors();