优化ProxyCall的规则,暂时不对mscorlib及GetEnumerator函数混淆

backup
walon 2025-04-29 10:18:42 +08:00
parent 440b0509c2
commit 61370fd939
1 changed files with 15 additions and 2 deletions

View File

@ -20,14 +20,27 @@ namespace Obfuz.DynamicProxy
ITypeDefOrRef declaringType = method.DeclaringType; ITypeDefOrRef declaringType = method.DeclaringType;
TypeDef typeDef = declaringType.ResolveTypeDef(); TypeDef typeDef = declaringType.ResolveTypeDef();
// doesn't proxy call if the method is a delegate // doesn't proxy call if the method is a delegate
if (typeDef != null && typeDef.IsDelegate) if (typeDef != null)
{
// need configurable
if (typeDef.Module.IsCoreLibraryModule == true)
{ {
return false; return false;
} }
if (typeDef.IsDelegate)
return false;
}
// doesn't proxy call if the method is a constructor
if (method.Name == ".ctor") if (method.Name == ".ctor")
{ {
return false; return false;
} }
// special handle
// don't proxy call for List<T>.Enumerator GetEnumerator()
if (method.Name == "GetEnumerator")
{
return false;
}
return true; return true;
} }
} }