Move method to DotNetUtils

This commit is contained in:
de4dot 2011-12-22 05:37:10 +01:00
parent 823d3b07a7
commit 7b71a565ec
2 changed files with 13 additions and 13 deletions

View File

@ -908,5 +908,17 @@ namespace de4dot.blocks {
MetadataToken = new MetadataToken(TokenType.Event, nextTokenRid--),
};
}
public static bool findLdcI4Constant(MethodDefinition method, int constant) {
if (method == null || method.Body == null)
return false;
foreach (var instr in method.Body.Instructions) {
if (instr.OpCode.Code != Code.Ldc_I4)
continue;
if (constant == (int)instr.Operand)
return true;
}
return false;
}
}
}

View File

@ -332,7 +332,7 @@ namespace de4dot.code.deobfuscators.dotNET_Reactor.v4 {
if (compileMethod == null)
return DeobfuscatorInfo.THE_NAME + " < 4.0";
DeobfuscatedFile.deobfuscate(compileMethod);
bool compileMethodHasConstant_0x70000000 = findConstant(compileMethod, 0x70000000); // 4.0-4.1
bool compileMethodHasConstant_0x70000000 = DotNetUtils.findLdcI4Constant(compileMethod, 0x70000000); // 4.0-4.1
DeobfuscatedFile.deobfuscate(methodsDecrypter.Method);
bool hasCorEnableProfilingString = findString(methodsDecrypter.Method, "Cor_Enable_Profiling"); // 4.1-4.4
@ -362,18 +362,6 @@ namespace de4dot.code.deobfuscators.dotNET_Reactor.v4 {
return false;
}
static bool findConstant(MethodDefinition method, int constant) {
if (method == null || method.Body == null)
return false;
foreach (var instr in method.Body.Instructions) {
if (instr.OpCode.Code != Code.Ldc_I4)
continue;
if (constant == (int)instr.Operand)
return true;
}
return false;
}
public override bool getDecryptedModule(ref byte[] newFileData, ref Dictionary<uint, DumpedMethod> dumpedMethods) {
fileData = ModuleBytes ?? DeobUtils.readModule(module);
peImage = new PeImage(fileData);