Merge branch 'master' into confuser

This commit is contained in:
de4dot 2012-07-31 12:51:33 +02:00
commit 9db8fc86a7
3 changed files with 36 additions and 4 deletions

2
cecil

@ -1 +1 @@
Subproject commit 84123704ef5799168050faffc5e22f7d48d6e081
Subproject commit 2542717e7de612011471baa364c29b93a8ecd2bc

View File

@ -364,6 +364,8 @@ namespace de4dot.code.deobfuscators {
if (stack.Count < 2)
goto done;
info2 = stack.Pop();
if (info2.constant == 0)
goto done;
info1 = stack.Pop();
stack.Push(new ConstantInfo<int>(index, info1.constant / info2.constant));
break;
@ -372,6 +374,8 @@ namespace de4dot.code.deobfuscators {
if (stack.Count < 2)
goto done;
info2 = stack.Pop();
if (info2.constant == 0)
goto done;
info1 = stack.Pop();
stack.Push(new ConstantInfo<int>(index, (int)((uint)info1.constant / (uint)info2.constant)));
break;
@ -540,6 +544,8 @@ done:
if (stack.Count < 2)
goto done;
info2 = stack.Pop();
if (info2.constant == 0)
goto done;
info1 = stack.Pop();
stack.Push(new ConstantInfo<long>(index, info1.constant / info2.constant));
break;
@ -548,6 +554,8 @@ done:
if (stack.Count < 2)
goto done;
info2 = stack.Pop();
if (info2.constant == 0)
goto done;
info1 = stack.Pop();
stack.Push(new ConstantInfo<long>(index, (int)((uint)info1.constant / (uint)info2.constant)));
break;

View File

@ -151,8 +151,31 @@ namespace de4dot.code.deobfuscators.MaxtoCode {
}
}
class ResourceKey {
readonly EmbeddedResource resource;
public ResourceKey(EmbeddedResource resource) {
this.resource = resource;
}
public override int GetHashCode() {
return resource._GetHashCode();
}
public override bool Equals(object obj) {
var other = obj as ResourceKey;
if (other == null)
return false;
return resource._Equals(other.resource);
}
public override string ToString() {
return resource.Name;
}
}
void removeDuplicateEmbeddedResources() {
var resources = new Dictionary<uint, List<EmbeddedResource>>();
var resources = new Dictionary<ResourceKey, List<EmbeddedResource>>();
foreach (var tmp in module.Resources) {
var rsrc = tmp as EmbeddedResource;
if (rsrc == null)
@ -160,8 +183,9 @@ namespace de4dot.code.deobfuscators.MaxtoCode {
if (rsrc.Offset == null)
continue;
List<EmbeddedResource> list;
if (!resources.TryGetValue(rsrc.Offset.Value, out list))
resources[rsrc.Offset.Value] = list = new List<EmbeddedResource>();
var key = new ResourceKey(rsrc);
if (!resources.TryGetValue(key, out list))
resources[key] = list = new List<EmbeddedResource>();
list.Add(rsrc);
}