From 41a6a623952f7af07a8b80961fe1ac1e3a553120 Mon Sep 17 00:00:00 2001 From: de4dot Date: Fri, 23 Nov 2012 04:12:10 +0100 Subject: [PATCH] Dyn method decrypter now supports .NET 4.5 RTM compileMethod() (stdcall again) --- de4dot.mdecrypt/DynamicMethodsDecrypter.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/de4dot.mdecrypt/DynamicMethodsDecrypter.cs b/de4dot.mdecrypt/DynamicMethodsDecrypter.cs index 42cbe4c7..9ec96de9 100644 --- a/de4dot.mdecrypt/DynamicMethodsDecrypter.cs +++ b/de4dot.mdecrypt/DynamicMethodsDecrypter.cs @@ -107,13 +107,16 @@ namespace de4dot.mdecrypt { } } - static Version VersionNet45 = new Version(4, 0, 30319, 17020); + static Version VersionNet45DevPreview = new Version(4, 0, 30319, 17020); + static Version VersionNet45Rtm = new Version(4, 0, 30319, 17929); DynamicMethodsDecrypter() { if (UIntPtr.Size != 4) throw new ApplicationException("Only 32-bit dynamic methods decryption is supported"); - // .NET 4.5's compileMethod has thiscall calling convention - compileMethodIsThisCall = Environment.Version >= VersionNet45; + // .NET 4.5 beta/preview/RC compileMethod has thiscall calling convention, but they + // switched back to stdcall in .NET 4.5 RTM + compileMethodIsThisCall = Environment.Version >= VersionNet45DevPreview && + Environment.Version < VersionNet45Rtm; } [DllImport("kernel32", CharSet = CharSet.Ansi)]