From be9c95a7598e71a58ec260f9436e568171e8fa1e Mon Sep 17 00:00:00 2001 From: de4dot Date: Tue, 31 Jul 2012 07:30:21 +0200 Subject: [PATCH] Support Confuser 1.3 r55346's latest proxy methods code --- de4dot.code/deobfuscators/Confuser/ProxyCallFixerV1.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/de4dot.code/deobfuscators/Confuser/ProxyCallFixerV1.cs b/de4dot.code/deobfuscators/Confuser/ProxyCallFixerV1.cs index 01230b1a..3b57d481 100644 --- a/de4dot.code/deobfuscators/Confuser/ProxyCallFixerV1.cs +++ b/de4dot.code/deobfuscators/Confuser/ProxyCallFixerV1.cs @@ -199,7 +199,9 @@ namespace de4dot.code.deobfuscators.Confuser { void getCallInfo_v10_r48717(DelegateInitInfo info, ProxyCreatorInfo creatorInfo, out MethodReference calledMethod, out OpCode callOpcode) { int offs = creatorInfo.proxyCreatorType == ProxyCreatorType.CallOrCallvirt ? 2 : 1; uint token = BitConverter.ToUInt32(Encoding.Unicode.GetBytes(info.field.Name.ToCharArray(), offs, 2), 0); - if (info.field.Name[0] == (char)1) + // 1.3 r55346 now correctly uses method reference tokens and finally fixed the old + // bug of using methoddef tokens to reference external methods. + if (info.field.Name[0] == (char)1 || ((token >> 24) != 0x06)) calledMethod = (MethodReference)module.LookupToken((int)token); else { var asmRef = module.AssemblyReferences[info.field.Name[0] - 2]; @@ -213,7 +215,7 @@ namespace de4dot.code.deobfuscators.Confuser { } // A method token is not a stable value so this method can fail to return the correct method! - // There's nothing I can do about that. It's an obfuscator bug. + // There's nothing I can do about that. It's an obfuscator bug. It was fixed in 1.3 r55346. MethodReference createMethodReference(AssemblyNameReference asmRef, uint methodToken) { var asm = AssemblyResolver.Instance.Resolve(asmRef); if (asm == null)