Make sure MD header version isn't 1.1 (reset it to 2.0 if so)

This commit is contained in:
de4dot 2012-12-20 01:45:50 +01:00
parent a7fdbd4206
commit ba54b607eb

View File

@ -194,6 +194,7 @@ namespace de4dot.code.deobfuscators {
}
restoreBaseType();
fixMDHeaderVersion();
}
static bool isTypeWithInvalidBaseType(TypeDef moduleType, TypeDef type) {
@ -212,6 +213,13 @@ namespace de4dot.code.deobfuscators {
}
}
void fixMDHeaderVersion() {
// Version 1.1 supports generics but it's a little different. Most tools
// will have a problem reading the MD tables, so switch to the standard v2.0.
if (module.TablesHeaderVersion == 0x0101)
module.TablesHeaderVersion = 0x0200;
}
void removeTypesWithInvalidBaseTypes() {
var moduleType = DotNetUtils.getModuleType(module);
foreach (var type in module.GetTypes()) {