Support VS2008
This commit is contained in:
parent
0c3d2a9c43
commit
ad6c6401b9
|
@ -24,6 +24,7 @@
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoStdLib>true</NoStdLib>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
<NoStdLib>true</NoStdLib>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
|
|
|
@ -362,7 +362,11 @@ namespace de4dot.blocks {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<MethodDefinition> findMethods(IEnumerable<MethodDefinition> methods, string returnType, string[] argsTypes, bool isStatic = true) {
|
public static IEnumerable<MethodDefinition> findMethods(IEnumerable<MethodDefinition> methods, string returnType, string[] argsTypes) {
|
||||||
|
return findMethods(methods, returnType, argsTypes, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<MethodDefinition> findMethods(IEnumerable<MethodDefinition> methods, string returnType, string[] argsTypes, bool isStatic) {
|
||||||
foreach (var method in methods) {
|
foreach (var method in methods) {
|
||||||
if (!method.HasBody || method.CallingConvention != MethodCallingConvention.Default)
|
if (!method.HasBody || method.CallingConvention != MethodCallingConvention.Default)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -31,7 +31,11 @@ namespace de4dot.blocks {
|
||||||
IGenericInstance gim;
|
IGenericInstance gim;
|
||||||
bool modified;
|
bool modified;
|
||||||
|
|
||||||
public static TypeReference make(TypeReference typeReference, GenericInstanceType git, IGenericInstance gim = null) {
|
public static TypeReference make(TypeReference typeReference, GenericInstanceType git) {
|
||||||
|
return make(typeReference, git, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TypeReference make(TypeReference typeReference, GenericInstanceType git, IGenericInstance gim) {
|
||||||
if (git == null && gim == null)
|
if (git == null && gim == null)
|
||||||
return typeReference;
|
return typeReference;
|
||||||
return new TypeReferenceInstance(typeReference, git, gim).makeInstance();
|
return new TypeReferenceInstance(typeReference, git, gim).makeInstance();
|
||||||
|
@ -88,7 +92,11 @@ namespace de4dot.blocks {
|
||||||
IGenericInstance gim;
|
IGenericInstance gim;
|
||||||
bool modified;
|
bool modified;
|
||||||
|
|
||||||
public MultiTypeRefInstance(GenericInstanceType git, IGenericInstance gim = null) {
|
public MultiTypeRefInstance(GenericInstanceType git)
|
||||||
|
: this(git, null) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiTypeRefInstance(GenericInstanceType git, IGenericInstance gim) {
|
||||||
this.git = git;
|
this.git = git;
|
||||||
this.gim = gim;
|
this.gim = gim;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +120,11 @@ namespace de4dot.blocks {
|
||||||
public class MethodReferenceInstance : MultiTypeRefInstance {
|
public class MethodReferenceInstance : MultiTypeRefInstance {
|
||||||
MethodReference methodReference;
|
MethodReference methodReference;
|
||||||
|
|
||||||
public static MethodReference make(MethodReference methodReference, GenericInstanceType git, IGenericInstance gim = null) {
|
public static MethodReference make(MethodReference methodReference, GenericInstanceType git) {
|
||||||
|
return make(methodReference, git, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MethodReference make(MethodReference methodReference, GenericInstanceType git, IGenericInstance gim) {
|
||||||
if (git == null && gim == null)
|
if (git == null && gim == null)
|
||||||
return methodReference;
|
return methodReference;
|
||||||
return new MethodReferenceInstance(methodReference, git, gim).makeInstance();
|
return new MethodReferenceInstance(methodReference, git, gim).makeInstance();
|
||||||
|
|
|
@ -815,7 +815,11 @@ namespace de4dot.blocks {
|
||||||
throw new ApplicationException(string.Format("Unknown MemberReference type: {0}", type));
|
throw new ApplicationException(string.Format("Unknown MemberReference type: {0}", type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool verifyType(TypeReference typeReference, string assembly, string type, string extra = "") {
|
public static bool verifyType(TypeReference typeReference, string assembly, string type) {
|
||||||
|
return verifyType(typeReference, assembly, type, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool verifyType(TypeReference typeReference, string assembly, string type, string extra) {
|
||||||
return typeReference != null &&
|
return typeReference != null &&
|
||||||
MemberReferenceHelper.getCanonicalizedTypeRefName(typeReference.GetElementType()) == "[" + assembly + "]" + type &&
|
MemberReferenceHelper.getCanonicalizedTypeRefName(typeReference.GetElementType()) == "[" + assembly + "]" + type &&
|
||||||
typeReference.FullName == type + extra;
|
typeReference.FullName == type + extra;
|
||||||
|
|
|
@ -71,7 +71,11 @@ namespace de4dot.blocks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Block> findBlocks(Func<Block, bool> blockChecker = null) {
|
List<Block> findBlocks() {
|
||||||
|
return findBlocks(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Block> findBlocks(Func<Block, bool> blockChecker) {
|
||||||
var blocks = new List<Block>();
|
var blocks = new List<Block>();
|
||||||
foreach (var bb in getBaseBlocks()) {
|
foreach (var bb in getBaseBlocks()) {
|
||||||
Block block = bb as Block;
|
Block block = bb as Block;
|
||||||
|
|
|
@ -80,7 +80,11 @@ namespace de4dot.blocks.cflow {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool inlineOtherMethod(int patchIndex, MethodDefinition methodToInline, Instruction instr, int instrIndex, int popLastArgs = 0) {
|
protected bool inlineOtherMethod(int patchIndex, MethodDefinition methodToInline, Instruction instr, int instrIndex) {
|
||||||
|
return inlineOtherMethod(patchIndex, methodToInline, instr, instrIndex, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool inlineOtherMethod(int patchIndex, MethodDefinition methodToInline, Instruction instr, int instrIndex, int popLastArgs) {
|
||||||
return patchMethod(methodToInline, tryInlineOtherMethod(patchIndex, methodToInline, instr, instrIndex, popLastArgs));
|
return patchMethod(methodToInline, tryInlineOtherMethod(patchIndex, methodToInline, instr, instrIndex, popLastArgs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +99,11 @@ namespace de4dot.blocks.cflow {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected InstructionPatcher tryInlineOtherMethod(int patchIndex, MethodDefinition methodToInline, Instruction instr, int instrIndex, int popLastArgs = 0) {
|
protected InstructionPatcher tryInlineOtherMethod(int patchIndex, MethodDefinition methodToInline, Instruction instr, int instrIndex) {
|
||||||
|
return tryInlineOtherMethod(patchIndex, methodToInline, instr, instrIndex, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected InstructionPatcher tryInlineOtherMethod(int patchIndex, MethodDefinition methodToInline, Instruction instr, int instrIndex, int popLastArgs) {
|
||||||
int loadIndex = 0;
|
int loadIndex = 0;
|
||||||
int methodArgsCount = DotNetUtils.getArgsCount(methodToInline);
|
int methodArgsCount = DotNetUtils.getArgsCount(methodToInline);
|
||||||
bool foundLdarga = false;
|
bool foundLdarga = false;
|
||||||
|
@ -183,7 +191,11 @@ namespace de4dot.blocks.cflow {
|
||||||
return instr != null && instr.OpCode.Code == Code.Ret;
|
return instr != null && instr.OpCode.Code == Code.Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool checkSameMethods(MethodReference method, MethodDefinition methodToInline, int ignoreLastMethodToInlineArgs = 0) {
|
protected bool checkSameMethods(MethodReference method, MethodDefinition methodToInline) {
|
||||||
|
return checkSameMethods(method, methodToInline, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool checkSameMethods(MethodReference method, MethodDefinition methodToInline, int ignoreLastMethodToInlineArgs) {
|
||||||
var methodToInlineArgs = DotNetUtils.getArgs(methodToInline);
|
var methodToInlineArgs = DotNetUtils.getArgs(methodToInline);
|
||||||
var methodArgs = DotNetUtils.getArgs(method);
|
var methodArgs = DotNetUtils.getArgs(method);
|
||||||
if (methodToInlineArgs.Count - ignoreLastMethodToInlineArgs != methodArgs.Count)
|
if (methodToInlineArgs.Count - ignoreLastMethodToInlineArgs != methodArgs.Count)
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoStdLib>true</NoStdLib>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
<NoStdLib>true</NoStdLib>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
|
|
|
@ -55,7 +55,11 @@ namespace de4dot.code {
|
||||||
public bool DefaultValue { get; set; }
|
public bool DefaultValue { get; set; }
|
||||||
public const char regexSeparatorChar = '&';
|
public const char regexSeparatorChar = '&';
|
||||||
|
|
||||||
public NameRegexes(string regex = "") {
|
public NameRegexes()
|
||||||
|
: this("") {
|
||||||
|
}
|
||||||
|
|
||||||
|
public NameRegexes(string regex) {
|
||||||
set(regex);
|
set(regex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,11 @@ namespace de4dot.code {
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public NoArgOption(string shortName, string longName, string description, Action action = null)
|
public NoArgOption(string shortName, string longName, string description)
|
||||||
|
: this(shortName, longName, description, null) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoArgOption(string shortName, string longName, string description, Action action)
|
||||||
: base(shortName, longName, description) {
|
: base(shortName, longName, description) {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,11 @@ using de4dot.blocks.cflow;
|
||||||
|
|
||||||
namespace de4dot.code.deobfuscators {
|
namespace de4dot.code.deobfuscators {
|
||||||
static class ArrayFinder {
|
static class ArrayFinder {
|
||||||
public static List<byte[]> getArrays(MethodDefinition method, TypeReference arrayElemntType = null) {
|
public static List<byte[]> getArrays(MethodDefinition method) {
|
||||||
|
return getArrays(method, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<byte[]> getArrays(MethodDefinition method, TypeReference arrayElemntType) {
|
||||||
var arrays = new List<byte[]>();
|
var arrays = new List<byte[]>();
|
||||||
var instrs = method.Body.Instructions;
|
var instrs = method.Body.Instructions;
|
||||||
for (int i = 0; i < instrs.Count; i++) {
|
for (int i = 0; i < instrs.Count; i++) {
|
||||||
|
|
|
@ -40,7 +40,11 @@ namespace de4dot.code.deobfuscators.Babel_NET {
|
||||||
return new BabelInflater(noHeader, magic.Value);
|
return new BabelInflater(noHeader, magic.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Inflater createNormal(bool noHeader, string errorMessage = null) {
|
static Inflater createNormal(bool noHeader) {
|
||||||
|
return createNormal(noHeader, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Inflater createNormal(bool noHeader, string errorMessage) {
|
||||||
if (errorMessage != null)
|
if (errorMessage != null)
|
||||||
Log.w("{0}", errorMessage);
|
Log.w("{0}", errorMessage);
|
||||||
return new Inflater(noHeader);
|
return new Inflater(noHeader);
|
||||||
|
|
|
@ -663,7 +663,11 @@ namespace de4dot.code.deobfuscators {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void removeProxyDelegates(ProxyCallFixerBase proxyCallFixer, bool removeCreators = true) {
|
protected void removeProxyDelegates(ProxyCallFixerBase proxyCallFixer) {
|
||||||
|
removeProxyDelegates(proxyCallFixer, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removeProxyDelegates(ProxyCallFixerBase proxyCallFixer, bool removeCreators) {
|
||||||
if (proxyCallFixer.Errors != 0) {
|
if (proxyCallFixer.Errors != 0) {
|
||||||
Log.v("Not removing proxy delegates and creator type since errors were detected.");
|
Log.v("Not removing proxy delegates and creator type since errors were detected.");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -23,7 +23,11 @@ namespace de4dot.code.deobfuscators {
|
||||||
public abstract class DeobfuscatorInfoBase : IDeobfuscatorInfo {
|
public abstract class DeobfuscatorInfoBase : IDeobfuscatorInfo {
|
||||||
protected NameRegexOption validNameRegex;
|
protected NameRegexOption validNameRegex;
|
||||||
|
|
||||||
public DeobfuscatorInfoBase(string nameRegex = null) {
|
public DeobfuscatorInfoBase()
|
||||||
|
: this(null) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeobfuscatorInfoBase(string nameRegex) {
|
||||||
validNameRegex = new NameRegexOption(null, makeArgName("name"), "Valid name regex pattern", nameRegex ?? DeobfuscatorBase.DEFAULT_VALID_NAME_REGEX);
|
validNameRegex = new NameRegexOption(null, makeArgName("name"), "Valid name regex pattern", nameRegex ?? DeobfuscatorBase.DEFAULT_VALID_NAME_REGEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
namespace de4dot.code.deobfuscators {
|
namespace de4dot.code.deobfuscators {
|
||||||
public interface IDeobfuscatedFile : ISimpleDeobfuscator {
|
public interface IDeobfuscatedFile : ISimpleDeobfuscator {
|
||||||
IDeobfuscatorContext DeobfuscatorContext { get; }
|
IDeobfuscatorContext DeobfuscatorContext { get; }
|
||||||
void createAssemblyFile(byte[] data, string assemblyName, string extension = null);
|
void createAssemblyFile(byte[] data, string assemblyName, string extension);
|
||||||
void stringDecryptersAdded();
|
void stringDecryptersAdded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,11 @@ namespace de4dot.code.deobfuscators.MPRESS {
|
||||||
public readonly string parameters;
|
public readonly string parameters;
|
||||||
public readonly string name;
|
public readonly string name;
|
||||||
|
|
||||||
public MethodInfo(string returnType, string parameters, string name = null) {
|
public MethodInfo(string returnType, string parameters)
|
||||||
|
: this(returnType, parameters, null) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public MethodInfo(string returnType, string parameters, string name) {
|
||||||
this.returnType = returnType;
|
this.returnType = returnType;
|
||||||
this.parameters = parameters;
|
this.parameters = parameters;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -336,7 +336,7 @@ namespace de4dot.code.deobfuscators.SmartAssembly {
|
||||||
void dumpEmbeddedAssemblies() {
|
void dumpEmbeddedAssemblies() {
|
||||||
assemblyResolver.resolveResources();
|
assemblyResolver.resolveResources();
|
||||||
foreach (var tuple in assemblyResolver.getDecryptedResources()) {
|
foreach (var tuple in assemblyResolver.getDecryptedResources()) {
|
||||||
DeobfuscatedFile.createAssemblyFile(tuple.Item2, tuple.Item1.simpleName);
|
DeobfuscatedFile.createAssemblyFile(tuple.Item2, tuple.Item1.simpleName, null);
|
||||||
addResourceToBeRemoved(tuple.Item1.resource, string.Format("Embedded assembly: {0}", tuple.Item1.assemblyName));
|
addResourceToBeRemoved(tuple.Item1.resource, string.Format("Embedded assembly: {0}", tuple.Item1.assemblyName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,11 @@ namespace de4dot.code.deobfuscators {
|
||||||
this.arg = arg;
|
this.arg = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(TypeReference type, bool wasNewobj = false) {
|
public void add(TypeReference type) {
|
||||||
|
add(type, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(TypeReference type, bool wasNewobj) {
|
||||||
if (wasNewobj) {
|
if (wasNewobj) {
|
||||||
if (!newobjTypes)
|
if (!newobjTypes)
|
||||||
clear();
|
clear();
|
||||||
|
|
|
@ -521,7 +521,7 @@ namespace de4dot.code.deobfuscators.dotNET_Reactor.v4 {
|
||||||
return;
|
return;
|
||||||
foreach (var info in assemblyResolver.getEmbeddedAssemblies(DeobfuscatedFile, this)) {
|
foreach (var info in assemblyResolver.getEmbeddedAssemblies(DeobfuscatedFile, this)) {
|
||||||
var simpleName = Utils.getAssemblySimpleName(info.name);
|
var simpleName = Utils.getAssemblySimpleName(info.name);
|
||||||
DeobfuscatedFile.createAssemblyFile(info.resource.GetResourceData(), simpleName);
|
DeobfuscatedFile.createAssemblyFile(info.resource.GetResourceData(), simpleName, null);
|
||||||
addResourceToBeRemoved(info.resource, string.Format("Embedded assembly: {0}", info.name));
|
addResourceToBeRemoved(info.resource, string.Format("Embedded assembly: {0}", info.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,11 @@ namespace de4dot.code.deobfuscators.dotNET_Reactor.v4 {
|
||||||
return DeobUtils.lookup(module, def, errorMessage);
|
return DeobUtils.lookup(module, def, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool couldBeResourceDecrypter(MethodDefinition method, IEnumerable<string> additionalTypes, bool checkResource = true) {
|
public bool couldBeResourceDecrypter(MethodDefinition method, IEnumerable<string> additionalTypes) {
|
||||||
|
return couldBeResourceDecrypter(method, additionalTypes, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool couldBeResourceDecrypter(MethodDefinition method, IEnumerable<string> additionalTypes, bool checkResource) {
|
||||||
if (!method.IsStatic)
|
if (!method.IsStatic)
|
||||||
return false;
|
return false;
|
||||||
if (method.Body == null)
|
if (method.Body == null)
|
||||||
|
|
|
@ -63,7 +63,11 @@ namespace de4dot.code.renamer {
|
||||||
class NameCreator : NameCreatorCounter {
|
class NameCreator : NameCreatorCounter {
|
||||||
string prefix;
|
string prefix;
|
||||||
|
|
||||||
public NameCreator(string prefix, int num = 0) {
|
public NameCreator(string prefix)
|
||||||
|
: this(prefix, 0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public NameCreator(string prefix, int num) {
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
this.num = num;
|
this.num = num;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +86,11 @@ namespace de4dot.code.renamer {
|
||||||
string prefix;
|
string prefix;
|
||||||
const string separator = "_";
|
const string separator = "_";
|
||||||
|
|
||||||
public NameCreator2(string prefix, int num = 0) {
|
public NameCreator2(string prefix)
|
||||||
|
: this(prefix, 0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public NameCreator2(string prefix, int num) {
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
this.num = num;
|
this.num = num;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +107,7 @@ namespace de4dot.code.renamer {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ITypeNameCreator {
|
interface ITypeNameCreator {
|
||||||
string create(TypeDefinition typeDefinition, string newBaseTypeName = null);
|
string create(TypeDefinition typeDefinition, string newBaseTypeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
class NameInfos {
|
class NameInfos {
|
||||||
|
@ -164,7 +172,7 @@ namespace de4dot.code.renamer {
|
||||||
return new NameCreator(prefix);
|
return new NameCreator(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string create(TypeDefinition typeDefinition, string newBaseTypeName = null) {
|
public string create(TypeDefinition typeDefinition, string newBaseTypeName) {
|
||||||
var nameCreator = getNameCreator(typeDefinition, newBaseTypeName);
|
var nameCreator = getNameCreator(typeDefinition, newBaseTypeName);
|
||||||
return existingNames.getName(typeDefinition.Name, nameCreator);
|
return existingNames.getName(typeDefinition.Name, nameCreator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -405,7 +405,11 @@ namespace de4dot.code.renamer {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepareRenameGenericParams(IEnumerable<GenericParamDef> genericParams, INameChecker checker, IEnumerable<GenericParamDef> otherGenericParams = null) {
|
void prepareRenameGenericParams(IEnumerable<GenericParamDef> genericParams, INameChecker checker) {
|
||||||
|
prepareRenameGenericParams(genericParams, checker, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
void prepareRenameGenericParams(IEnumerable<GenericParamDef> genericParams, INameChecker checker, IEnumerable<GenericParamDef> otherGenericParams) {
|
||||||
var usedNames = new Dictionary<string, bool>(StringComparer.Ordinal);
|
var usedNames = new Dictionary<string, bool>(StringComparer.Ordinal);
|
||||||
var nameCreator = new GenericParamNameCreator();
|
var nameCreator = new GenericParamNameCreator();
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,11 @@ namespace de4dot.cui {
|
||||||
saveAllFiles(allFiles);
|
saveAllFiles(allFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<IObfuscatedFile> loadAllFiles(bool onlyScan = false) {
|
IEnumerable<IObfuscatedFile> loadAllFiles() {
|
||||||
|
return loadAllFiles(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerable<IObfuscatedFile> loadAllFiles(bool onlyScan) {
|
||||||
var loader = new DotNetFileLoader(new DotNetFileLoader.Options {
|
var loader = new DotNetFileLoader(new DotNetFileLoader.Options {
|
||||||
PossibleFiles = options.Files,
|
PossibleFiles = options.Files,
|
||||||
SearchDirs = options.SearchDirs,
|
SearchDirs = options.SearchDirs,
|
||||||
|
@ -172,7 +176,7 @@ namespace de4dot.cui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool add(IObfuscatedFile file, bool skipUnknownObfuscator = false, bool isFromPossibleFiles = false) {
|
bool add(IObfuscatedFile file, bool skipUnknownObfuscator, bool isFromPossibleFiles) {
|
||||||
var key = Utils.getFullPath(file.Filename);
|
var key = Utils.getFullPath(file.Filename);
|
||||||
if (allFiles.ContainsKey(key)) {
|
if (allFiles.ContainsKey(key)) {
|
||||||
Log.w("Ingoring duplicate file: {0}", file.Filename);
|
Log.w("Ingoring duplicate file: {0}", file.Filename);
|
||||||
|
@ -301,7 +305,7 @@ namespace de4dot.cui {
|
||||||
}
|
}
|
||||||
|
|
||||||
var obfuscatedFile = new ObfuscatedFile(fileOptions, options.AssemblyClientFactory);
|
var obfuscatedFile = new ObfuscatedFile(fileOptions, options.AssemblyClientFactory);
|
||||||
if (add(obfuscatedFile, searchDir.SkipUnknownObfuscators))
|
if (add(obfuscatedFile, searchDir.SkipUnknownObfuscators, false))
|
||||||
return obfuscatedFile;
|
return obfuscatedFile;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,11 @@ namespace de4dot.cui {
|
||||||
return hasEnv("windir") && !hasEnv("PROMPT");
|
return hasEnv("windir") && !hasEnv("PROMPT");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void printStackTrace(Exception ex, Log.LogLevel logLevel = Log.LogLevel.error) {
|
public static void printStackTrace(Exception ex) {
|
||||||
|
printStackTrace(ex, Log.LogLevel.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void printStackTrace(Exception ex, Log.LogLevel logLevel) {
|
||||||
var line = new string('-', 78);
|
var line = new string('-', 78);
|
||||||
Log.log(logLevel, "\n\n");
|
Log.log(logLevel, "\n\n");
|
||||||
Log.log(logLevel, line);
|
Log.log(logLevel, line);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user