Don't remove proxy delegate types and creator type if errors were detected
This commit is contained in:
parent
d7c42185a8
commit
4a26534ad0
|
@ -489,6 +489,10 @@ namespace de4dot.deobfuscators {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void removeProxyDelegates(ProxyDelegateFinderBase proxyDelegateFinder) {
|
protected void removeProxyDelegates(ProxyDelegateFinderBase proxyDelegateFinder) {
|
||||||
|
if (proxyDelegateFinder.Errors != 0) {
|
||||||
|
Log.v("Not removing proxy delegates and creator type since errors were detected.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
addTypesToBeRemoved(proxyDelegateFinder.DelegateTypes, "Proxy delegate type");
|
addTypesToBeRemoved(proxyDelegateFinder.DelegateTypes, "Proxy delegate type");
|
||||||
if (proxyDelegateFinder.RemovedDelegateCreatorCalls > 0)
|
if (proxyDelegateFinder.RemovedDelegateCreatorCalls > 0)
|
||||||
addTypesToBeRemoved(proxyDelegateFinder.DelegateCreatorTypes, "Proxy delegate creator type");
|
addTypesToBeRemoved(proxyDelegateFinder.DelegateCreatorTypes, "Proxy delegate creator type");
|
||||||
|
|
|
@ -30,6 +30,11 @@ namespace de4dot.deobfuscators {
|
||||||
Dictionary<TypeDefinition, bool> delegateTypesDict = new Dictionary<TypeDefinition, bool>();
|
Dictionary<TypeDefinition, bool> delegateTypesDict = new Dictionary<TypeDefinition, bool>();
|
||||||
Dictionary<FieldReferenceAndDeclaringTypeKey, DelegateInfo> fieldToDelegateInfo = new Dictionary<FieldReferenceAndDeclaringTypeKey, DelegateInfo>();
|
Dictionary<FieldReferenceAndDeclaringTypeKey, DelegateInfo> fieldToDelegateInfo = new Dictionary<FieldReferenceAndDeclaringTypeKey, DelegateInfo>();
|
||||||
Dictionary<MethodDefinition, FieldDefinition> proxyMethodToField = new Dictionary<MethodDefinition, FieldDefinition>();
|
Dictionary<MethodDefinition, FieldDefinition> proxyMethodToField = new Dictionary<MethodDefinition, FieldDefinition>();
|
||||||
|
int errors = 0;
|
||||||
|
|
||||||
|
public int Errors {
|
||||||
|
get { return errors; }
|
||||||
|
}
|
||||||
|
|
||||||
class DelegateInfo {
|
class DelegateInfo {
|
||||||
public MethodReference methodRef; // Method we should call
|
public MethodReference methodRef; // Method we should call
|
||||||
|
@ -182,6 +187,7 @@ namespace de4dot.deobfuscators {
|
||||||
add(removeInfos, callInfo.Block, callInfo.Index, di);
|
add(removeInfos, callInfo.Block, callInfo.Index, di);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
errors++;
|
||||||
Log.w("Could not fix proxy call. Method: {0} ({1:X8}), Proxy type: {2} ({3:X8})",
|
Log.w("Could not fix proxy call. Method: {0} ({1:X8}), Proxy type: {2} ({3:X8})",
|
||||||
blocks.Method, blocks.Method.MetadataToken.ToInt32(),
|
blocks.Method, blocks.Method.MetadataToken.ToInt32(),
|
||||||
di.field.DeclaringType, di.field.DeclaringType.MetadataToken.ToInt32());
|
di.field.DeclaringType, di.field.DeclaringType.MetadataToken.ToInt32());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user