Add HasHandlers property to base class

This commit is contained in:
de4dot 2012-01-14 12:34:42 +01:00
parent f19be8019e
commit 5f6841e317
5 changed files with 12 additions and 7 deletions

View File

@ -163,6 +163,8 @@ namespace de4dot.code {
}
}
public abstract bool HasHandlers { get; }
protected MethodDefinition Method {
get { return blocks.Method; }
}
@ -173,6 +175,8 @@ namespace de4dot.code {
protected abstract CallResult createCallResult(MethodReference method, Block block, int callInstrIndex);
public int decrypt(Blocks theBlocks) {
if (!HasHandlers)
return 0;
try {
blocks = theBlocks;
callResults = new List<CallResult>();

View File

@ -74,6 +74,10 @@ namespace de4dot.code {
}
}
public override bool HasHandlers {
get { return methodTokenToId.Count != 0; }
}
public DynamicStringDecrypter(IAssemblyClient assemblyClient) {
this.assemblyClient = assemblyClient;
}
@ -128,7 +132,7 @@ namespace de4dot.code {
class StaticStringDecrypter : StringDecrypter {
MethodDefinitionAndDeclaringTypeDict<Func<MethodDefinition, object[], string>> stringDecrypters = new MethodDefinitionAndDeclaringTypeDict<Func<MethodDefinition, object[], string>>();
public bool HasHandlers {
public override bool HasHandlers {
get { return stringDecrypters.Count != 0; }
}

View File

@ -153,8 +153,7 @@ namespace de4dot.code.deobfuscators {
}
public virtual void deobfuscateStrings(Blocks blocks) {
if (staticStringDecrypter.HasHandlers)
staticStringDecrypter.decrypt(blocks);
staticStringDecrypter.decrypt(blocks);
}
public virtual bool deobfuscateOther(Blocks blocks) {

View File

@ -35,7 +35,7 @@ namespace de4dot.code.deobfuscators {
}
}
public bool HasHandlers {
public override bool HasHandlers {
get { return decrypterMethods.Count != 0; }
}

View File

@ -518,9 +518,7 @@ namespace de4dot.code.deobfuscators.dotNET_Reactor.v4 {
}
public override bool deobfuscateOther(Blocks blocks) {
if (booleanValueInliner.HasHandlers)
return booleanValueInliner.decrypt(blocks) > 0;
return false;
return booleanValueInliner.decrypt(blocks) > 0;
}
public override void deobfuscateMethodEnd(Blocks blocks) {