Submodule was updated. Fix code

This commit is contained in:
de4dot 2012-12-19 18:14:47 +01:00
parent ab8e548340
commit 35849b0f9b
8 changed files with 13 additions and 13 deletions

View File

@ -40,7 +40,7 @@ namespace AssemblyData.methodsrewriter {
if (!fields.TryGetValue(fieldRef.Name.String, out list))
return null;
fieldRef = GenericArgsSubstitutor.create(fieldRef, fieldRef.DeclaringType.ToGenericInstSig());
fieldRef = GenericArgsSubstitutor.create(fieldRef, fieldRef.DeclaringType.TryGetGenericInstSig());
foreach (var field in list) {
if (ResolverUtils.compareFields(field, fieldRef))
@ -71,7 +71,7 @@ namespace AssemblyData.methodsrewriter {
if (!methods.TryGetValue(methodRef.Name.String, out list))
return null;
methodRef = GenericArgsSubstitutor.create(methodRef, methodRef.DeclaringType.ToGenericInstSig());
methodRef = GenericArgsSubstitutor.create(methodRef, methodRef.DeclaringType.TryGetGenericInstSig());
foreach (var method in list) {
if (ResolverUtils.compareMethods(method, methodRef))

View File

@ -190,7 +190,7 @@ namespace de4dot.blocks {
return null;
if (method is MethodDef)
return (MethodDef)method;
var git = method.DeclaringType.ToGenericInstSig();
var git = method.DeclaringType.TryGetGenericInstSig();
var dt = git == null ? method.DeclaringType : git.GenericType.TypeDefOrRef;
return getMethod(module, method, dt);
}

View File

@ -50,7 +50,7 @@ namespace de4dot.code {
var ts = typeRef as TypeSpec;
if (ts == null)
return typeRef;
var gis = ts.ToGenericInstSig();
var gis = ts.TryGetGenericInstSig();
if (gis == null || gis.GenericType == null)
return typeRef;
return gis.GenericType.TypeDefOrRef;

View File

@ -252,7 +252,7 @@ namespace de4dot.code.deobfuscators.Babel_NET {
var castclass = instrs[index++];
if (castclass.OpCode.Code != Code.Castclass)
continue;
var arrayType = (castclass.Operand as ITypeDefOrRef).ToSZArraySig();
var arrayType = (castclass.Operand as ITypeDefOrRef).TryGetSZArraySig();
if (arrayType == null)
continue;
if (arrayType.Next.ElementType.GetPrimitiveSize() == -1) {

View File

@ -513,7 +513,7 @@ namespace de4dot.code.deobfuscators {
continue;
IList<TypeSig> calledMethodArgs = DotNetUtils.getArgs(calledMethodDefOrRef);
calledMethodArgs = DotNetUtils.replaceGenericParameters(calledMethodDefOrRef.DeclaringType.ToGenericInstSig(), calledMethodSpec, calledMethodArgs);
calledMethodArgs = DotNetUtils.replaceGenericParameters(calledMethodDefOrRef.DeclaringType.TryGetGenericInstSig(), calledMethodSpec, calledMethodArgs);
for (int j = 0; j < pushedArgs.NumValidArgs; j++) {
var pushInstr = pushedArgs.getEnd(j);
if (pushInstr.OpCode.Code != Code.Ldfld && pushInstr.OpCode.Code != Code.Ldsfld)

View File

@ -236,7 +236,7 @@ namespace de4dot.code.renamer.asmmodules {
var ts = typeRef as TypeSpec;
if (ts == null)
return typeRef;
var gis = ts.ToGenericInstSig();
var gis = ts.TryGetGenericInstSig();
if (gis == null || gis.GenericType == null)
return typeRef;
return gis.GenericType.TypeDefOrRef;

View File

@ -494,7 +494,7 @@ namespace de4dot.code.renamer.asmmodules {
}
void initializeInterfaces(TypeInfo typeInfo) {
var git = typeInfo.typeRef.ToGenericInstSig();
var git = typeInfo.typeRef.TryGetGenericInstSig();
interfaceMethodInfos.initializeFrom(typeInfo.typeDef.interfaceMethodInfos, git);
foreach (var info in typeInfo.typeDef.allImplementedInterfaces.Keys) {
var newTypeInfo = new TypeInfo(info, git);
@ -540,7 +540,7 @@ namespace de4dot.code.renamer.asmmodules {
var ifaceMethod = methodInst.origMethodDef;
if (!ifaceMethod.isVirtual())
continue;
var ifaceMethodRef = GenericArgsSubstitutor.create(methodInst.methodRef, ifaceInfo.typeRef.ToGenericInstSig());
var ifaceMethodRef = GenericArgsSubstitutor.create(methodInst.methodRef, ifaceInfo.typeRef.TryGetGenericInstSig());
MMethodDef classMethod;
if (!methodsDict.TryGetValue(ifaceMethodRef, out classMethod))
continue;
@ -574,7 +574,7 @@ namespace de4dot.code.renamer.asmmodules {
var ifaceMethod = methodsList[0].origMethodDef;
if (!ifaceMethod.isVirtual())
continue;
var ifaceMethodRef = GenericArgsSubstitutor.create(ifaceMethod.MethodDef, ifaceInfo.typeRef.ToGenericInstSig());
var ifaceMethodRef = GenericArgsSubstitutor.create(ifaceMethod.MethodDef, ifaceInfo.typeRef.TryGetGenericInstSig());
MMethodDef classMethod;
if (!methodsDict.TryGetValue(ifaceMethodRef, out classMethod))
continue;
@ -588,7 +588,7 @@ namespace de4dot.code.renamer.asmmodules {
methodsDict.Clear();
var ifaceMethodsDict = new Dictionary<IMethodDefOrRef, MMethodDef>(MethodEqualityComparer.CompareDeclaringTypes);
foreach (var ifaceInfo in allImplementedInterfaces.Keys) {
var git = ifaceInfo.typeRef.ToGenericInstSig();
var git = ifaceInfo.typeRef.TryGetGenericInstSig();
foreach (var ifaceMethod in ifaceInfo.typeDef.methods.getValues()) {
IMethodDefOrRef ifaceMethodRef = ifaceMethod.MethodDef;
if (git != null)
@ -699,7 +699,7 @@ namespace de4dot.code.renamer.asmmodules {
void instantiateVirtualMembers(MethodNameGroups groups) {
if (!TypeDef.IsInterface) {
if (baseType != null)
virtualMethodInstances.initializeFrom(baseType.typeDef.virtualMethodInstances, baseType.typeRef.ToGenericInstSig());
virtualMethodInstances.initializeFrom(baseType.typeDef.virtualMethodInstances, baseType.typeRef.TryGetGenericInstSig());
// Figure out which methods we override in the base class
foreach (var methodDef in methods.getValues()) {

2
dot10

@ -1 +1 @@
Subproject commit 8be6ceeb862d85ce3ea18fbee5a04990f0f0556c
Subproject commit ef5ba01006a288eef4739dc7c9b39c24914777e5