1. 修复CallObfus混淆了Enum.HasFlag和GetHashCode函数后,Unity 2021的il2cpp生成cpp代码时发生内部异常的问题
2. 修复CallObfus混淆了MethodBase.GetCurrentMethod导致返回了错误函数的严重bugdev
parent
72d0b292c5
commit
62deffa10d
|
@ -275,26 +275,47 @@ namespace Obfuz.ObfusPasses.CallObfus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private readonly HashSet<string> _specialTypeFullNames = new HashSet<string>
|
||||||
|
{
|
||||||
|
"System.Enum",
|
||||||
|
"System.Delegate",
|
||||||
|
"System.MulticastDelegate",
|
||||||
|
"Obfuz.EncryptionService`1",
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly HashSet<string> _specialMethodNames = new HashSet<string>
|
||||||
|
{
|
||||||
|
"GetEnumerator", // List<T>.Enumerator.GetEnumerator()
|
||||||
|
".ctor", // constructor
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly HashSet<string> _specialMethodFullNames = new HashSet<string>
|
||||||
|
{
|
||||||
|
"System.Reflection.MethodBase.GetCurrentMethod",
|
||||||
|
"System.Reflection.Assembly.GetCallingAssembly",
|
||||||
|
"System.Reflection.Assembly.GetExecutingAssembly",
|
||||||
|
"System.Reflection.Assembly.GetEntryAssembly",
|
||||||
|
};
|
||||||
|
|
||||||
private bool IsSpecialNotObfuscatedMethod(TypeDef typeDef, IMethod method)
|
private bool IsSpecialNotObfuscatedMethod(TypeDef typeDef, IMethod method)
|
||||||
{
|
{
|
||||||
if (typeDef.IsDelegate || typeDef.IsEnum)
|
if (typeDef.IsDelegate || typeDef.IsEnum)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
string fullName = typeDef.FullName;
|
||||||
|
if (_specialTypeFullNames.Contains(fullName))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
string methodName = method.Name;
|
string methodName = method.Name;
|
||||||
|
if (_specialMethodNames.Contains(methodName))
|
||||||
// doesn't proxy call if the method is a constructor
|
|
||||||
if (methodName == ".ctor")
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeDef.Name == "EncryptionService`1")
|
string methodFullName = $"{fullName}.{methodName}";
|
||||||
{
|
if (_specialMethodFullNames.Contains(methodFullName))
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// special handle
|
|
||||||
// don't proxy call for List<T>.Enumerator GetEnumerator()
|
|
||||||
if (methodName == "GetEnumerator")
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue