Dyn method decrypter now supports .NET 4.5 RTM compileMethod() (stdcall again)

This commit is contained in:
de4dot 2012-11-23 04:12:10 +01:00
parent 9263a3df3d
commit 41a6a62395

View File

@ -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() { DynamicMethodsDecrypter() {
if (UIntPtr.Size != 4) if (UIntPtr.Size != 4)
throw new ApplicationException("Only 32-bit dynamic methods decryption is supported"); throw new ApplicationException("Only 32-bit dynamic methods decryption is supported");
// .NET 4.5's compileMethod has thiscall calling convention // .NET 4.5 beta/preview/RC compileMethod has thiscall calling convention, but they
compileMethodIsThisCall = Environment.Version >= VersionNet45; // switched back to stdcall in .NET 4.5 RTM
compileMethodIsThisCall = Environment.Version >= VersionNet45DevPreview &&
Environment.Version < VersionNet45Rtm;
} }
[DllImport("kernel32", CharSet = CharSet.Ansi)] [DllImport("kernel32", CharSet = CharSet.Ansi)]