Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions de4dot.code/ObfuscatedFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,10 @@
}

public void DeobfuscateEnd() {
foreach (var m in inlineCandidate) {
m.Value.DeclaringType?.Remove(m.Value);
if (options.ControlFlowDeobfuscation) {
foreach (var m in inlineCandidate) {
m.Value.DeclaringType?.Remove(m.Value);
}
}

DeobfuscateCleanUp();
Expand Down Expand Up @@ -643,13 +645,14 @@
return;

var rewritten = false;
for (var i = 0; i < method.Body.Instructions.Count; i++) {
var instr = method.Body.Instructions[i];
foreach (var instr in method.Body.Instructions) {
if (instr.OpCode == OpCodes.Call) {
var targetMethod = (IMethod?)instr.Operand;

Check warning on line 650 in de4dot.code/ObfuscatedFile.cs

View workflow job for this annotation

GitHub Actions / Build Linux artifacts & package .deb

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
if (targetMethod is null) continue;
if (inlineCandidate.TryGetValue(targetMethod.ResolveMethodDef()?.FullName ?? targetMethod.FullName, out var methodToInline)) {
instr.Operand = methodToInline.Body.Instructions[methodToInline.Parameters.Count].Operand;
var realCall = methodToInline.Body.Instructions[methodToInline.Parameters.Count];
instr.OpCode = realCall.OpCode;
instr.Operand = realCall.Operand;
rewritten = true;
}
}
Expand Down
Loading