make de4dot.code interface fully public
This commit is contained in:
parent
2eb27bfc54
commit
a3e0445f0a
|
@ -24,7 +24,7 @@ using System.Threading;
|
|||
using AssemblyData;
|
||||
|
||||
namespace de4dot.code.AssemblyClient {
|
||||
sealed class AssemblyClient : IAssemblyClient {
|
||||
public sealed class AssemblyClient : IAssemblyClient {
|
||||
const int WAIT_TIME_BEFORE_CONNECTING = 1000;
|
||||
const int MAX_CONNECT_WAIT_TIME_MS = 2000;
|
||||
IAssemblyServerLoader loader;
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace de4dot.code.AssemblyClient {
|
|||
this.serverVersion = ServerClrVersion.CLR_ANY_ANYCPU;
|
||||
}
|
||||
|
||||
internal NewProcessAssemblyClientFactory(ServerClrVersion serverVersion) {
|
||||
public NewProcessAssemblyClientFactory(ServerClrVersion serverVersion) {
|
||||
this.serverVersion = serverVersion;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace de4dot.code.AssemblyClient {
|
|||
return new AssemblyClient(new NewProcessAssemblyServerLoader(serviceType, serverVersion));
|
||||
}
|
||||
|
||||
internal static ServerClrVersion GetServerClrVersion(ModuleDef module) {
|
||||
public static ServerClrVersion GetServerClrVersion(ModuleDef module) {
|
||||
switch (module.GetPointerSize()) {
|
||||
default:
|
||||
case 4:
|
||||
|
|
|
@ -21,7 +21,7 @@ using System;
|
|||
using AssemblyData;
|
||||
|
||||
namespace de4dot.code.AssemblyClient {
|
||||
interface IAssemblyServerLoader : IDisposable {
|
||||
public interface IAssemblyServerLoader : IDisposable {
|
||||
void LoadServer();
|
||||
IAssemblyService CreateService();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ using System;
|
|||
using AssemblyData;
|
||||
|
||||
namespace de4dot.code.AssemblyClient {
|
||||
enum ServerClrVersion {
|
||||
public enum ServerClrVersion {
|
||||
CLR_ANY_ANYCPU,
|
||||
CLR_ANY_x86,
|
||||
CLR_ANY_x64,
|
||||
|
@ -31,7 +31,7 @@ namespace de4dot.code.AssemblyClient {
|
|||
CLR_v40_x64,
|
||||
}
|
||||
|
||||
abstract class IpcAssemblyServerLoader : IAssemblyServerLoader {
|
||||
public abstract class IpcAssemblyServerLoader : IAssemblyServerLoader {
|
||||
readonly string assemblyServerFilename;
|
||||
protected string ipcName;
|
||||
protected string ipcUri;
|
||||
|
|
|
@ -23,7 +23,7 @@ using AssemblyData;
|
|||
|
||||
namespace de4dot.code.AssemblyClient {
|
||||
// Starts the server in a new app domain.
|
||||
sealed class NewAppDomainAssemblyServerLoader : IpcAssemblyServerLoader {
|
||||
public sealed class NewAppDomainAssemblyServerLoader : IpcAssemblyServerLoader {
|
||||
AppDomain appDomain;
|
||||
Thread thread;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ using AssemblyData;
|
|||
|
||||
namespace de4dot.code.AssemblyClient {
|
||||
// Starts the server in a new process
|
||||
class NewProcessAssemblyServerLoader : IpcAssemblyServerLoader {
|
||||
public class NewProcessAssemblyServerLoader : IpcAssemblyServerLoader {
|
||||
Process process;
|
||||
|
||||
public NewProcessAssemblyServerLoader(AssemblyServiceType serviceType)
|
||||
|
|
|
@ -22,7 +22,7 @@ using AssemblyData;
|
|||
|
||||
namespace de4dot.code.AssemblyClient {
|
||||
// Starts the server in the current app domain.
|
||||
class SameAppDomainAssemblyServerLoader : IAssemblyServerLoader {
|
||||
public class SameAppDomainAssemblyServerLoader : IAssemblyServerLoader {
|
||||
IAssemblyService service;
|
||||
AssemblyServiceType serviceType;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ using dnlib.DotNet.Writer;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code {
|
||||
class AssemblyModule {
|
||||
public class AssemblyModule {
|
||||
string filename;
|
||||
ModuleDefMD module;
|
||||
ModuleContext moduleContext;
|
||||
|
|
|
@ -25,7 +25,7 @@ using dnlib.DotNet;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code {
|
||||
class DumpedMethodsRestorer : IRowReader<RawMethodRow>, IColumnReader, IMethodDecrypter {
|
||||
public class DumpedMethodsRestorer : IRowReader<RawMethodRow>, IColumnReader, IMethodDecrypter {
|
||||
ModuleDefMD module;
|
||||
DumpedMethods dumpedMethods;
|
||||
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
|
||||
namespace System.Runtime.ExceptionServices {
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
||||
class HandleProcessCorruptedStateExceptionsAttribute : Attribute {
|
||||
public class HandleProcessCorruptedStateExceptionsAttribute : Attribute {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code {
|
||||
class MethodPrinter {
|
||||
public class MethodPrinter {
|
||||
LoggerEvent loggerEvent;
|
||||
IList<Instruction> allInstructions;
|
||||
IList<ExceptionHandler> allExceptionHandlers;
|
||||
|
|
|
@ -25,7 +25,7 @@ using de4dot.blocks;
|
|||
|
||||
namespace de4dot.code {
|
||||
// A simple class that statically detects the values of some local variables
|
||||
class VariableValues {
|
||||
public class VariableValues {
|
||||
IList<Block> allBlocks;
|
||||
IList<Local> locals;
|
||||
Dictionary<Local, Variable> variableToValue = new Dictionary<Local, Variable>();
|
||||
|
@ -140,7 +140,7 @@ namespace de4dot.code {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class MethodReturnValueInliner {
|
||||
public abstract class MethodReturnValueInliner {
|
||||
protected List<CallResult> callResults;
|
||||
List<Block> allBlocks;
|
||||
MethodDef theMethod;
|
||||
|
|
|
@ -22,7 +22,7 @@ using dnlib.DotNet.MD;
|
|||
using dnlib.DotNet.Writer;
|
||||
|
||||
namespace de4dot.code {
|
||||
class PrintNewTokens : IModuleWriterListener {
|
||||
public class PrintNewTokens : IModuleWriterListener {
|
||||
readonly ModuleDef module;
|
||||
readonly IModuleWriterListener otherListener;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ using de4dot.code.AssemblyClient;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code {
|
||||
abstract class StringInlinerBase : MethodReturnValueInliner {
|
||||
public abstract class StringInlinerBase : MethodReturnValueInliner {
|
||||
protected override void InlineReturnValues(IList<CallResult> callResults) {
|
||||
foreach (var callResult in callResults) {
|
||||
var block = callResult.block;
|
||||
|
@ -62,7 +62,7 @@ namespace de4dot.code {
|
|||
}
|
||||
}
|
||||
|
||||
class DynamicStringInliner : StringInlinerBase {
|
||||
public class DynamicStringInliner : StringInlinerBase {
|
||||
IAssemblyClient assemblyClient;
|
||||
Dictionary<int, int> methodTokenToId = new Dictionary<int, int>();
|
||||
|
||||
|
@ -127,7 +127,7 @@ namespace de4dot.code {
|
|||
}
|
||||
}
|
||||
|
||||
class StaticStringInliner : StringInlinerBase {
|
||||
public class StaticStringInliner : StringInlinerBase {
|
||||
MethodDefAndDeclaringTypeDict<Func<MethodDef, MethodSpec, object[], string>> stringDecrypters = new MethodDefAndDeclaringTypeDict<Func<MethodDef, MethodSpec, object[], string>>();
|
||||
|
||||
public override bool HasHandlers {
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace de4dot.code {
|
|||
public delegate void Action<T1, T2>(T1 arg1, T2 arg2);
|
||||
public delegate void Action<T1, T2, T3>(T1 arg1, T2 arg2, T3 arg3);
|
||||
|
||||
class Tuple<T1, T2> {
|
||||
public class Tuple<T1, T2> {
|
||||
public T1 Item1 { get; set; }
|
||||
public T2 Item2 { get; set; }
|
||||
public override bool Equals(object obj) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
namespace de4dot.code {
|
||||
static class Win32Path {
|
||||
public static class Win32Path {
|
||||
public static string GetFileName(string path) {
|
||||
if (path == null)
|
||||
return null;
|
||||
|
|
|
@ -24,7 +24,7 @@ using de4dot.blocks;
|
|||
using de4dot.blocks.cflow;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
static class ArrayFinder {
|
||||
public static class ArrayFinder {
|
||||
public static List<byte[]> GetArrays(MethodDef method) {
|
||||
return GetArrays(method, null);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
using System;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class Blowfish {
|
||||
public class Blowfish {
|
||||
static readonly uint[] Pboxes = new uint[18] {
|
||||
0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
|
||||
0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
struct CRC32 {
|
||||
public struct CRC32 {
|
||||
static readonly uint[] table = new uint[256] {
|
||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
|
||||
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class ConstantsReader {
|
||||
public class ConstantsReader {
|
||||
protected IInstructions instructions;
|
||||
protected IList<Local> locals;
|
||||
protected Dictionary<Local, int> localsValuesInt32 = new Dictionary<Local, int>();
|
||||
|
|
|
@ -28,7 +28,7 @@ using ICSharpCode.SharpZipLib.Zip.Compression;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
static class DeobUtils {
|
||||
public static class DeobUtils {
|
||||
public static void DecryptAndAddResources(ModuleDef module, string encryptedName, Func<byte[]> decryptResource) {
|
||||
Logger.v("Decrypting resources, name: {0}", Utils.ToCsharpString(encryptedName));
|
||||
var decryptedResourceData = decryptResource();
|
||||
|
|
|
@ -27,7 +27,7 @@ using de4dot.blocks;
|
|||
using de4dot.blocks.cflow;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
abstract class DeobfuscatorBase : IDeobfuscator, IModuleWriterListener {
|
||||
public abstract class DeobfuscatorBase : IDeobfuscator, IModuleWriterListener {
|
||||
public const string DEFAULT_VALID_NAME_REGEX = @"^[a-zA-Z_<{$][a-zA-Z_0-9<>{}$.`-]*$";
|
||||
public const string DEFAULT_ASIAN_VALID_NAME_REGEX = @"^[\u2E80-\u9FFFa-zA-Z_<{$][\u2E80-\u9FFFa-zA-Z_0-9<>{}$.`-]*$";
|
||||
|
||||
|
@ -61,7 +61,8 @@ namespace de4dot.code.deobfuscators {
|
|||
set { moduleBytes = value; }
|
||||
}
|
||||
|
||||
internal class OptionsBase : IDeobfuscatorOptions {
|
||||
public class OptionsBase : IDeobfuscatorOptions
|
||||
{
|
||||
public bool RenameResourcesInCode { get; set; }
|
||||
public NameRegexes ValidNameRegex { get; set; }
|
||||
public bool DecryptStrings { get; set; }
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class ExceptionLoggerRemover {
|
||||
public class ExceptionLoggerRemover {
|
||||
MethodDefAndDeclaringTypeDict<bool> exceptionLoggerMethods = new MethodDefAndDeclaringTypeDict<bool>();
|
||||
|
||||
public int NumRemovedExceptionLoggers { get; set; }
|
||||
|
|
|
@ -26,7 +26,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class InitializedDataCreator {
|
||||
public class InitializedDataCreator {
|
||||
ModuleDef module;
|
||||
Dictionary<long, TypeDef> sizeToArrayType = new Dictionary<long, TypeDef>();
|
||||
TypeDef ourType;
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
static class InlinedMethodsFinder {
|
||||
public static class InlinedMethodsFinder {
|
||||
public static List<MethodDef> Find(ModuleDef module) {
|
||||
// Not all garbage methods are inlined, possibly because we remove some code that calls
|
||||
// the garbage method before the methods inliner has a chance to inline it. Try to find
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class MemberRefBuilder {
|
||||
public class MemberRefBuilder {
|
||||
ModuleDefMD module;
|
||||
Dictionary<TypeSig, TypeSig> createdTypes = new Dictionary<TypeSig, TypeSig>(TypeEqualityComparer.Instance);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.IO;
|
|||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
[Serializable]
|
||||
class InvalidMethodBody : Exception {
|
||||
public class InvalidMethodBody : Exception {
|
||||
public InvalidMethodBody() {
|
||||
}
|
||||
|
||||
|
@ -32,14 +32,14 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
class MethodBodyHeader {
|
||||
public class MethodBodyHeader {
|
||||
public ushort flags;
|
||||
public ushort maxStack;
|
||||
public uint codeSize;
|
||||
public uint localVarSigTok;
|
||||
}
|
||||
|
||||
static class MethodBodyParser {
|
||||
public static class MethodBodyParser {
|
||||
public static MethodBodyHeader ParseMethodBody(IBinaryReader reader, out byte[] code, out byte[] extraSections) {
|
||||
try {
|
||||
return ParseMethodBody2(reader, out code, out extraSections);
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class MethodCallRestorerBase {
|
||||
public class MethodCallRestorerBase {
|
||||
protected MemberRefBuilder builder;
|
||||
protected ModuleDefMD module;
|
||||
MethodDefAndDeclaringTypeDict<NewMethodInfo> oldToNewMethod = new MethodDefAndDeclaringTypeDict<NewMethodInfo>();
|
||||
|
|
|
@ -22,7 +22,7 @@ using dnlib.DotNet;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class MethodCollection {
|
||||
public class MethodCollection {
|
||||
TypeDefDict<bool> types = new TypeDefDict<bool>();
|
||||
MethodDefAndDeclaringTypeDict<bool> methods = new MethodDefAndDeclaringTypeDict<bool>();
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class PushedArgs {
|
||||
public class PushedArgs {
|
||||
List<Instruction> args;
|
||||
int nextIndex;
|
||||
|
||||
|
@ -74,7 +74,7 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
static class MethodStack {
|
||||
public static class MethodStack {
|
||||
// May not return all args. The args are returned in reverse order.
|
||||
public static PushedArgs GetPushedArgInstructions(IList<Instruction> instructions, int index) {
|
||||
try {
|
||||
|
|
|
@ -26,7 +26,7 @@ using de4dot.blocks;
|
|||
using de4dot.mdecrypt;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
static class MethodsDecrypter {
|
||||
public static class MethodsDecrypter {
|
||||
public static DumpedMethods Decrypt(ModuleDef module, byte[] moduleCctorBytes) {
|
||||
return Decrypt(NewProcessAssemblyClientFactory.GetServerClrVersion(module), module.Location, moduleCctorBytes);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ using dnlib.DotNet.MD;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
sealed class MyPEImage : IDisposable {
|
||||
public sealed class MyPEImage : IDisposable {
|
||||
IPEImage peImage;
|
||||
byte[] peImageData;
|
||||
IImageStream peStream;
|
||||
|
|
|
@ -21,7 +21,7 @@ using System;
|
|||
using System.IO;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class NullStream : Stream {
|
||||
public class NullStream : Stream {
|
||||
long offset = 0;
|
||||
long length = 0;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace de4dot.code.deobfuscators {
|
|||
OpDecryptString DecryptStrings { get; }
|
||||
}
|
||||
|
||||
class Operations : IOperations {
|
||||
public class Operations : IOperations {
|
||||
public bool KeepObfuscatorTypes { get; set; }
|
||||
public MetaDataFlags MetaDataFlags { get; set; }
|
||||
public RenamerFlags RenamerFlags { get; set; }
|
||||
|
|
|
@ -24,7 +24,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
abstract class ProxyCallFixerBase {
|
||||
public abstract class ProxyCallFixerBase {
|
||||
protected ModuleDefMD module;
|
||||
protected List<MethodDef> delegateCreatorMethods = new List<MethodDef>();
|
||||
protected Dictionary<TypeDef, bool> delegateTypesDict = new Dictionary<TypeDef, bool>();
|
||||
|
@ -187,7 +187,7 @@ namespace de4dot.code.deobfuscators {
|
|||
// ldsfld delegate_instance
|
||||
// ...push args...
|
||||
// call Invoke
|
||||
abstract class ProxyCallFixer1 : ProxyCallFixerBase {
|
||||
public abstract class ProxyCallFixer1 : ProxyCallFixerBase {
|
||||
FieldDefAndDeclaringTypeDict<DelegateInfo> fieldToDelegateInfo = new FieldDefAndDeclaringTypeDict<DelegateInfo>();
|
||||
|
||||
protected ProxyCallFixer1(ModuleDefMD module)
|
||||
|
@ -375,7 +375,7 @@ namespace de4dot.code.deobfuscators {
|
|||
// Invoke() on a delegate instance, eg.:
|
||||
// ...push args...
|
||||
// call static method
|
||||
abstract class ProxyCallFixer2 : ProxyCallFixerBase {
|
||||
public abstract class ProxyCallFixer2 : ProxyCallFixerBase {
|
||||
MethodDefAndDeclaringTypeDict<DelegateInfo> proxyMethodToDelegateInfo = new MethodDefAndDeclaringTypeDict<DelegateInfo>();
|
||||
|
||||
protected ProxyCallFixer2(ModuleDefMD module)
|
||||
|
@ -497,7 +497,7 @@ namespace de4dot.code.deobfuscators {
|
|||
// ...push args...
|
||||
// ldsfld delegate instance
|
||||
// call static method
|
||||
abstract class ProxyCallFixer3 : ProxyCallFixer1 {
|
||||
public abstract class ProxyCallFixer3 : ProxyCallFixer1 {
|
||||
protected ProxyCallFixer3(ModuleDefMD module)
|
||||
: base(module) {
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
using System;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class QuickLZBase {
|
||||
public class QuickLZBase {
|
||||
protected static uint Read32(byte[] data, int index) {
|
||||
return BitConverter.ToUInt32(data, index);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
class QuickLZ : QuickLZBase {
|
||||
public class QuickLZ : QuickLZBase {
|
||||
static int DEFAULT_QCLZ_SIG = 0x5A4C4351; // "QCLZ"
|
||||
|
||||
public static bool IsCompressed(byte[] data) {
|
||||
|
|
|
@ -22,7 +22,7 @@ using System.Text;
|
|||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
static class RandomNameChecker {
|
||||
public static class RandomNameChecker {
|
||||
static Regex noUpper = new Regex(@"^[^A-Z]+$");
|
||||
static Regex allUpper = new Regex(@"^[A-Z]+$");
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet;
|
|||
using dnlib.DotNet.Emit;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class StringCounts {
|
||||
public class StringCounts {
|
||||
Dictionary<string, int> strings = new Dictionary<string, int>(StringComparer.Ordinal);
|
||||
|
||||
public IEnumerable<string> Strings {
|
||||
|
@ -65,7 +65,7 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
class FieldTypes : StringCounts {
|
||||
public class FieldTypes : StringCounts {
|
||||
public FieldTypes(TypeDef type) {
|
||||
Initialize(type.Fields);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
class LocalTypes : StringCounts {
|
||||
public class LocalTypes : StringCounts {
|
||||
public LocalTypes(MethodDef method) {
|
||||
if (method != null && method.Body != null)
|
||||
Initialize(method.Body.Variables);
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace de4dot.code.deobfuscators {
|
|||
// Restore the type of all fields / parameters that have had their type turned into object.
|
||||
// This thing requires a lot more code than I have time to do now (similar to symbol renaming)
|
||||
// so it will be a basic implementation only.
|
||||
abstract class TypesRestorerBase {
|
||||
public abstract class TypesRestorerBase {
|
||||
ModuleDef module;
|
||||
List<MethodDef> allMethods;
|
||||
Dictionary<Parameter, TypeInfo<Parameter>> argInfos = new Dictionary<Parameter, TypeInfo<Parameter>>();
|
||||
|
@ -639,7 +639,7 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
class TypesRestorer : TypesRestorerBase {
|
||||
public class TypesRestorer : TypesRestorerBase {
|
||||
public TypesRestorer(ModuleDef module)
|
||||
: base(module) {
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class UnpackedFile {
|
||||
public class UnpackedFile {
|
||||
public string filename;
|
||||
public byte[] data;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
class UnusedMethodsFinder {
|
||||
public class UnusedMethodsFinder {
|
||||
ModuleDef module;
|
||||
MethodCollection removedMethods;
|
||||
Dictionary<MethodDef, bool> possiblyUnusedMethods = new Dictionary<MethodDef, bool>();
|
||||
|
|
|
@ -24,7 +24,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.deobfuscators {
|
||||
abstract class ValueInlinerBase<TValue> : MethodReturnValueInliner {
|
||||
public abstract class ValueInlinerBase<TValue> : MethodReturnValueInliner {
|
||||
MethodDefAndDeclaringTypeDict<Func<MethodDef, MethodSpec, object[], object>> decrypterMethods = new MethodDefAndDeclaringTypeDict<Func<MethodDef, MethodSpec, object[], object>>();
|
||||
bool removeUnbox = false;
|
||||
|
||||
|
@ -91,7 +91,7 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
class BooleanValueInliner : ValueInlinerBase<bool> {
|
||||
public class BooleanValueInliner : ValueInlinerBase<bool> {
|
||||
protected override void InlineReturnValues(IList<CallResult> callResults) {
|
||||
foreach (var callResult in callResults) {
|
||||
var block = callResult.block;
|
||||
|
@ -104,7 +104,7 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
class Int32ValueInliner : ValueInlinerBase<int> {
|
||||
public class Int32ValueInliner : ValueInlinerBase<int> {
|
||||
protected override void InlineReturnValues(IList<CallResult> callResults) {
|
||||
foreach (var callResult in callResults) {
|
||||
var block = callResult.block;
|
||||
|
@ -117,7 +117,7 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
class Int64ValueInliner : ValueInlinerBase<long> {
|
||||
public class Int64ValueInliner : ValueInlinerBase<long> {
|
||||
protected override void InlineReturnValues(IList<CallResult> callResults) {
|
||||
foreach (var callResult in callResults) {
|
||||
var block = callResult.block;
|
||||
|
@ -130,7 +130,7 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
class SingleValueInliner : ValueInlinerBase<float> {
|
||||
public class SingleValueInliner : ValueInlinerBase<float> {
|
||||
protected override void InlineReturnValues(IList<CallResult> callResults) {
|
||||
foreach (var callResult in callResults) {
|
||||
var block = callResult.block;
|
||||
|
@ -143,7 +143,7 @@ namespace de4dot.code.deobfuscators {
|
|||
}
|
||||
}
|
||||
|
||||
class DoubleValueInliner : ValueInlinerBase<double> {
|
||||
public class DoubleValueInliner : ValueInlinerBase<double> {
|
||||
protected override void InlineReturnValues(IList<CallResult> callResults) {
|
||||
foreach (var callResult in callResults) {
|
||||
var block = callResult.block;
|
||||
|
|
|
@ -22,7 +22,7 @@ using System.Collections.Generic;
|
|||
using de4dot.code.renamer.asmmodules;
|
||||
|
||||
namespace de4dot.code.renamer {
|
||||
class DerivedFrom {
|
||||
public class DerivedFrom {
|
||||
Dictionary<string, bool> classNames = new Dictionary<string, bool>(StringComparer.Ordinal);
|
||||
Dictionary<MTypeDef, bool> results = new Dictionary<MTypeDef, bool>();
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ using System.Collections.Generic;
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer {
|
||||
class ExistingNames {
|
||||
public class ExistingNames {
|
||||
Dictionary<string, bool> allNames = new Dictionary<string, bool>(StringComparer.Ordinal);
|
||||
|
||||
public void Add(string name) {
|
||||
|
|
|
@ -21,7 +21,7 @@ using System.Collections.Generic;
|
|||
using de4dot.code.renamer.asmmodules;
|
||||
|
||||
namespace de4dot.code.renamer {
|
||||
class MemberInfo {
|
||||
public class MemberInfo {
|
||||
protected Ref memberRef;
|
||||
public string oldFullName;
|
||||
public string oldName;
|
||||
|
@ -50,31 +50,31 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
class GenericParamInfo : MemberInfo {
|
||||
public class GenericParamInfo : MemberInfo {
|
||||
public GenericParamInfo(MGenericParamDef genericParamDef)
|
||||
: base(genericParamDef) {
|
||||
}
|
||||
}
|
||||
|
||||
class PropertyInfo : MemberInfo {
|
||||
public class PropertyInfo : MemberInfo {
|
||||
public PropertyInfo(MPropertyDef propertyDef)
|
||||
: base(propertyDef) {
|
||||
}
|
||||
}
|
||||
|
||||
class EventInfo : MemberInfo {
|
||||
public class EventInfo : MemberInfo {
|
||||
public EventInfo(MEventDef eventDef)
|
||||
: base(eventDef) {
|
||||
}
|
||||
}
|
||||
|
||||
class FieldInfo : MemberInfo {
|
||||
public class FieldInfo : MemberInfo {
|
||||
public FieldInfo(MFieldDef fieldDef)
|
||||
: base(fieldDef) {
|
||||
}
|
||||
}
|
||||
|
||||
class MethodInfo : MemberInfo {
|
||||
public class MethodInfo : MemberInfo {
|
||||
public MMethodDef MethodDef {
|
||||
get { return (MMethodDef)memberRef; }
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
class ParamInfo {
|
||||
public class ParamInfo {
|
||||
MParamDef paramDef;
|
||||
public string oldName;
|
||||
public string newName;
|
||||
|
@ -100,7 +100,7 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
class MemberInfos {
|
||||
public class MemberInfos {
|
||||
Dictionary<MTypeDef, TypeInfo> allTypeInfos = new Dictionary<MTypeDef, TypeInfo>();
|
||||
Dictionary<MPropertyDef, PropertyInfo> allPropertyInfos = new Dictionary<MPropertyDef, PropertyInfo>();
|
||||
Dictionary<MEventDef, EventInfo> allEventInfos = new Dictionary<MEventDef, EventInfo>();
|
||||
|
|
|
@ -22,11 +22,11 @@ using dnlib.DotNet;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.renamer {
|
||||
interface INameCreator {
|
||||
public interface INameCreator {
|
||||
string Create();
|
||||
}
|
||||
|
||||
class OneNameCreator : INameCreator {
|
||||
public class OneNameCreator : INameCreator {
|
||||
string name;
|
||||
|
||||
public OneNameCreator(string name) {
|
||||
|
@ -38,7 +38,7 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class NameCreatorCounter : INameCreator {
|
||||
public abstract class NameCreatorCounter : INameCreator {
|
||||
protected int num;
|
||||
|
||||
public abstract string Create();
|
||||
|
@ -50,7 +50,7 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
class GenericParamNameCreator : NameCreatorCounter {
|
||||
public class GenericParamNameCreator : NameCreatorCounter {
|
||||
static string[] names = new string[] { "T", "U", "V", "W", "X", "Y", "Z" };
|
||||
|
||||
public override string Create() {
|
||||
|
@ -60,7 +60,7 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
class NameCreator : NameCreatorCounter {
|
||||
public class NameCreator : NameCreatorCounter {
|
||||
string prefix;
|
||||
|
||||
public NameCreator(string prefix)
|
||||
|
@ -82,7 +82,7 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
|
||||
// Like NameCreator but don't add the counter the first time
|
||||
class NameCreator2 : NameCreatorCounter {
|
||||
public class NameCreator2 : NameCreatorCounter {
|
||||
string prefix;
|
||||
const string separator = "_";
|
||||
|
||||
|
@ -106,11 +106,11 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
interface ITypeNameCreator {
|
||||
public interface ITypeNameCreator {
|
||||
string Create(TypeDef typeDef, string newBaseTypeName);
|
||||
}
|
||||
|
||||
class NameInfos {
|
||||
public class NameInfos {
|
||||
IList<NameInfo> nameInfos = new List<NameInfo>();
|
||||
|
||||
class NameInfo {
|
||||
|
@ -136,7 +136,7 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
class TypeNameCreator : ITypeNameCreator {
|
||||
public class TypeNameCreator : ITypeNameCreator {
|
||||
ExistingNames existingNames;
|
||||
NameCreator createUnknownTypeName;
|
||||
NameCreator createEnumName;
|
||||
|
@ -205,7 +205,7 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
class GlobalTypeNameCreator : TypeNameCreator {
|
||||
public class GlobalTypeNameCreator : TypeNameCreator {
|
||||
public GlobalTypeNameCreator(ExistingNames existingNames)
|
||||
: base(existingNames) {
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ using de4dot.blocks;
|
|||
using de4dot.code.resources;
|
||||
|
||||
namespace de4dot.code.renamer {
|
||||
class ResourceKeysRenamer {
|
||||
public class ResourceKeysRenamer {
|
||||
const int RESOURCE_KEY_MAX_LEN = 50;
|
||||
const string DEFAULT_KEY_NAME = "Key";
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ using de4dot.blocks;
|
|||
using de4dot.code.renamer.asmmodules;
|
||||
|
||||
namespace de4dot.code.renamer {
|
||||
class ResourceRenamer {
|
||||
public class ResourceRenamer {
|
||||
Module module;
|
||||
Dictionary<string, Resource> nameToResource;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ using de4dot.code.renamer.asmmodules;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.renamer {
|
||||
class TypeInfo : MemberInfo {
|
||||
public class TypeInfo : MemberInfo {
|
||||
public string oldNamespace;
|
||||
public string newNamespace;
|
||||
public VariableNameState variableNameState = VariableNameState.Create();
|
||||
|
|
|
@ -22,7 +22,7 @@ using System.Collections.Generic;
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer {
|
||||
abstract class TypeNames {
|
||||
public abstract class TypeNames {
|
||||
protected Dictionary<string, NameCreator> typeNames = new Dictionary<string, NameCreator>(StringComparer.Ordinal);
|
||||
protected NameCreator genericParamNameCreator = new NameCreator("gparam_");
|
||||
protected NameCreator fnPtrNameCreator = new NameCreator("fnptr_");
|
||||
|
@ -135,7 +135,7 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
class VariableNameCreator : TypeNames {
|
||||
public class VariableNameCreator : TypeNames {
|
||||
static Dictionary<string, string> ourFullNameToShortName;
|
||||
static Dictionary<string, string> ourFullNameToShortNamePrefix;
|
||||
static VariableNameCreator() {
|
||||
|
@ -201,7 +201,7 @@ namespace de4dot.code.renamer {
|
|||
}
|
||||
}
|
||||
|
||||
class PropertyNameCreator : TypeNames {
|
||||
public class PropertyNameCreator : TypeNames {
|
||||
static Dictionary<string, string> ourFullNameToShortName = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
static Dictionary<string, string> ourFullNameToShortNamePrefix = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ using System.Collections.Generic;
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer {
|
||||
class TypeRenamerState {
|
||||
public class TypeRenamerState {
|
||||
ExistingNames existingNames;
|
||||
Dictionary<string, string> namespaceToNewName;
|
||||
NameCreator createNamespaceName;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer {
|
||||
class VariableNameState {
|
||||
public class VariableNameState {
|
||||
ExistingNames existingVariableNames;
|
||||
ExistingNames existingMethodNames;
|
||||
ExistingNames existingPropertyNames;
|
||||
|
|
|
@ -21,7 +21,7 @@ using System.Collections.Generic;
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
class MEventDef : Ref {
|
||||
public class MEventDef : Ref {
|
||||
public MMethodDef AddMethod { get; set; }
|
||||
public MMethodDef RemoveMethod { get; set; }
|
||||
public MMethodDef RaiseMethod { get; set; }
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
class MFieldDef : Ref {
|
||||
public class MFieldDef : Ref {
|
||||
public FieldDef FieldDef {
|
||||
get { return (FieldDef)memberRef; }
|
||||
}
|
||||
|
|
|
@ -21,7 +21,8 @@ using System.Collections.Generic;
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
class MGenericParamDef : Ref {
|
||||
public class MGenericParamDef : Ref
|
||||
{
|
||||
public GenericParam GenericParam {
|
||||
get { return (GenericParam)memberRef; }
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
interface IResolver {
|
||||
public interface IResolver
|
||||
{
|
||||
MTypeDef ResolveType(ITypeDefOrRef typeRef);
|
||||
MMethodDef ResolveMethod(IMethodDefOrRef methodRef);
|
||||
MFieldDef ResolveField(MemberRef fieldRef);
|
||||
|
|
|
@ -24,7 +24,7 @@ using dnlib.DotNet.Emit;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
enum ObjectType {
|
||||
public enum ObjectType {
|
||||
Unknown,
|
||||
EventDef,
|
||||
FieldDef,
|
||||
|
@ -40,7 +40,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
ExportedType,
|
||||
}
|
||||
|
||||
class MemberRefFinder {
|
||||
public class MemberRefFinder {
|
||||
public Dictionary<CustomAttribute, bool> customAttributes = new Dictionary<CustomAttribute, bool>();
|
||||
public Dictionary<EventDef, bool> eventDefs = new Dictionary<EventDef, bool>();
|
||||
public Dictionary<FieldDef, bool> fieldDefs = new Dictionary<FieldDef, bool>();
|
||||
|
|
|
@ -21,7 +21,7 @@ using System.Collections.Generic;
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
class MMethodDef : Ref {
|
||||
public class MMethodDef : Ref {
|
||||
IList<MGenericParamDef> genericParams;
|
||||
IList<MParamDef> paramDefs = new List<MParamDef>();
|
||||
MParamDef returnParamDef;
|
||||
|
|
|
@ -21,7 +21,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
class MethodNameGroup {
|
||||
public class MethodNameGroup {
|
||||
List<MMethodDef> methods = new List<MMethodDef>();
|
||||
|
||||
public List<MMethodDef> Methods {
|
||||
|
@ -101,7 +101,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class MethodNameGroups {
|
||||
public class MethodNameGroups {
|
||||
Dictionary<MMethodDef, MethodNameGroup> methodGroups = new Dictionary<MMethodDef, MethodNameGroup>();
|
||||
|
||||
public void Same(MMethodDef a, MMethodDef b) {
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
class Module : IResolver {
|
||||
public class Module : IResolver {
|
||||
IObfuscatedFile obfuscatedFile;
|
||||
TypeDefDict types = new TypeDefDict();
|
||||
MemberRefFinder memberRefFinder;
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
class Modules : IResolver {
|
||||
public class Modules : IResolver {
|
||||
bool initializeCalled = false;
|
||||
IDeobfuscatorContext deobfuscatorContext;
|
||||
List<Module> modules = new List<Module>();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
class MParamDef {
|
||||
public class MParamDef {
|
||||
public Parameter ParameterDef { get; set; }
|
||||
public int Index { get; private set; }
|
||||
public bool IsReturnParameter {
|
||||
|
|
|
@ -21,7 +21,7 @@ using System.Collections.Generic;
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
class MPropertyDef : Ref {
|
||||
public class MPropertyDef : Ref {
|
||||
public MMethodDef GetMethod { get; set; }
|
||||
public MMethodDef SetMethod { get; set; }
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
abstract class Ref {
|
||||
public abstract class Ref {
|
||||
public readonly IMemberRef memberRef;
|
||||
public int Index { get; set; }
|
||||
public MTypeDef Owner { get; set; }
|
||||
|
|
|
@ -21,7 +21,7 @@ using System.Collections.Generic;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
static class DictHelper {
|
||||
public static class DictHelper {
|
||||
public static IEnumerable<T> GetSorted<T>(IEnumerable<T> values) where T : Ref {
|
||||
var list = new List<T>(values);
|
||||
list.Sort((a, b) => a.Index.CompareTo(b.Index));
|
||||
|
@ -29,7 +29,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class TypeDefDict : TypeDefDict<MTypeDef> {
|
||||
public class TypeDefDict : TypeDefDict<MTypeDef> {
|
||||
public IEnumerable<MTypeDef> GetSorted() {
|
||||
return DictHelper.GetSorted(GetValues());
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class FieldDefDict : FieldDefDict<MFieldDef> {
|
||||
public class FieldDefDict : FieldDefDict<MFieldDef> {
|
||||
public IEnumerable<MFieldDef> GetSorted() {
|
||||
return DictHelper.GetSorted(GetValues());
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class MethodDefDict : MethodDefDict<MMethodDef> {
|
||||
public class MethodDefDict : MethodDefDict<MMethodDef> {
|
||||
public IEnumerable<MMethodDef> GetSorted() {
|
||||
return DictHelper.GetSorted(GetValues());
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class PropertyDefDict : PropertyDefDict<MPropertyDef> {
|
||||
public class PropertyDefDict : PropertyDefDict<MPropertyDef> {
|
||||
public IEnumerable<MPropertyDef> GetSorted() {
|
||||
return DictHelper.GetSorted(GetValues());
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class EventDefDict : EventDefDict<MEventDef> {
|
||||
public class EventDefDict : EventDefDict<MEventDef> {
|
||||
public IEnumerable<MEventDef> GetSorted() {
|
||||
return DictHelper.GetSorted(GetValues());
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ using dnlib.DotNet;
|
|||
using de4dot.blocks;
|
||||
|
||||
namespace de4dot.code.renamer.asmmodules {
|
||||
class TypeInfo {
|
||||
public class TypeInfo {
|
||||
public ITypeDefOrRef typeRef;
|
||||
public MTypeDef typeDef;
|
||||
public TypeInfo(ITypeDefOrRef typeRef, MTypeDef typeDef) {
|
||||
|
@ -54,7 +54,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class MethodDefKey {
|
||||
public class MethodDefKey {
|
||||
public readonly MMethodDef methodDef;
|
||||
|
||||
public MethodDefKey(MMethodDef methodDef) {
|
||||
|
@ -73,7 +73,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class MethodInst {
|
||||
public class MethodInst {
|
||||
public MMethodDef origMethodDef;
|
||||
public IMethodDefOrRef methodRef;
|
||||
|
||||
|
@ -87,7 +87,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class MethodInstances {
|
||||
public class MethodInstances {
|
||||
Dictionary<IMethodDefOrRef, List<MethodInst>> methodInstances = new Dictionary<IMethodDefOrRef, List<MethodInst>>(MethodEqualityComparer.DontCompareDeclaringTypes);
|
||||
|
||||
public void InitializeFrom(MethodInstances other, GenericInstSig git) {
|
||||
|
@ -119,7 +119,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
|
||||
// Keeps track of which methods of an interface that have been implemented
|
||||
class InterfaceMethodInfo {
|
||||
public class InterfaceMethodInfo {
|
||||
TypeInfo iface;
|
||||
Dictionary<MethodDefKey, MMethodDef> ifaceMethodToClassMethod = new Dictionary<MethodDefKey, MMethodDef>();
|
||||
|
||||
|
@ -175,7 +175,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class InterfaceMethodInfos {
|
||||
public class InterfaceMethodInfos {
|
||||
Dictionary<ITypeDefOrRef, InterfaceMethodInfo> interfaceMethods = new Dictionary<ITypeDefOrRef, InterfaceMethodInfo>(TypeEqualityComparer.Instance);
|
||||
|
||||
public IEnumerable<InterfaceMethodInfo> AllInfos {
|
||||
|
@ -223,7 +223,7 @@ namespace de4dot.code.renamer.asmmodules {
|
|||
}
|
||||
}
|
||||
|
||||
class MTypeDef : Ref {
|
||||
public class MTypeDef : Ref {
|
||||
EventDefDict events = new EventDefDict();
|
||||
FieldDefDict fields = new FieldDefDict();
|
||||
MethodDefDict methods = new MethodDefDict();
|
||||
|
|
|
@ -22,7 +22,7 @@ using System.IO;
|
|||
using System.Runtime.Serialization;
|
||||
|
||||
namespace de4dot.code.resources {
|
||||
class BuiltInResourceData : IResourceData {
|
||||
public class BuiltInResourceData : IResourceData {
|
||||
readonly ResourceTypeCode code;
|
||||
readonly object data;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ using System.IO;
|
|||
using System.Runtime.Serialization;
|
||||
|
||||
namespace de4dot.code.resources {
|
||||
interface IResourceData {
|
||||
public interface IResourceData {
|
||||
ResourceTypeCode Code { get; }
|
||||
void WriteData(BinaryWriter writer, IFormatter formatter);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ using System.Runtime.Serialization.Formatters.Binary;
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.resources {
|
||||
class ResourceDataCreator {
|
||||
public class ResourceDataCreator {
|
||||
readonly ModuleDef module;
|
||||
readonly ModuleDefMD moduleMD;
|
||||
readonly Dictionary<string, UserResourceType> dict = new Dictionary<string, UserResourceType>(StringComparer.Ordinal);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
namespace de4dot.code.resources {
|
||||
class ResourceElement {
|
||||
public class ResourceElement {
|
||||
public string Name { get; set; }
|
||||
public IResourceData ResourceData { get; set; }
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace de4dot.code.resources {
|
||||
class ResourceElementSet {
|
||||
public class ResourceElementSet {
|
||||
Dictionary<string, ResourceElement> dict = new Dictionary<string, ResourceElement>(StringComparer.Ordinal);
|
||||
|
||||
public int Count {
|
||||
|
|
|
@ -27,13 +27,13 @@ using dnlib.IO;
|
|||
|
||||
namespace de4dot.code.resources {
|
||||
[Serializable]
|
||||
class ResourceReaderException : Exception {
|
||||
public class ResourceReaderException : Exception {
|
||||
public ResourceReaderException(string msg)
|
||||
: base(msg) {
|
||||
}
|
||||
}
|
||||
|
||||
struct ResourceReader {
|
||||
public struct ResourceReader {
|
||||
IBinaryReader reader;
|
||||
ResourceDataCreator resourceDataCreator;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
namespace de4dot.code.resources {
|
||||
enum ResourceTypeCode {
|
||||
public enum ResourceTypeCode {
|
||||
Null,
|
||||
String,
|
||||
Boolean,
|
||||
|
|
|
@ -26,7 +26,7 @@ using System.Text;
|
|||
using dnlib.DotNet;
|
||||
|
||||
namespace de4dot.code.resources {
|
||||
class ResourceWriter {
|
||||
public class ResourceWriter {
|
||||
ModuleDefMD module;
|
||||
BinaryWriter writer;
|
||||
ResourceElementSet resources;
|
||||
|
|
|
@ -22,7 +22,7 @@ using System.IO;
|
|||
using System.Runtime.Serialization;
|
||||
|
||||
namespace de4dot.code.resources {
|
||||
abstract class UserResourceData : IResourceData {
|
||||
public abstract class UserResourceData : IResourceData {
|
||||
readonly UserResourceType type;
|
||||
|
||||
public string TypeName {
|
||||
|
@ -40,7 +40,7 @@ namespace de4dot.code.resources {
|
|||
public abstract void WriteData(BinaryWriter writer, IFormatter formatter);
|
||||
}
|
||||
|
||||
class CharArrayResourceData : UserResourceData {
|
||||
public class CharArrayResourceData : UserResourceData {
|
||||
public static readonly string ReflectionTypeName = "System.Char[],mscorlib";
|
||||
char[] data;
|
||||
|
||||
|
@ -58,7 +58,7 @@ namespace de4dot.code.resources {
|
|||
}
|
||||
}
|
||||
|
||||
class IconResourceData : UserResourceData {
|
||||
public class IconResourceData : UserResourceData {
|
||||
public static readonly string ReflectionTypeName = "System.Drawing.Icon,System.Drawing";
|
||||
Icon icon;
|
||||
|
||||
|
@ -76,7 +76,7 @@ namespace de4dot.code.resources {
|
|||
}
|
||||
}
|
||||
|
||||
class ImageResourceData : UserResourceData {
|
||||
public class ImageResourceData : UserResourceData {
|
||||
public static readonly string ReflectionTypeName = "System.Drawing.Bitmap,System.Drawing";
|
||||
Bitmap bitmap;
|
||||
|
||||
|
@ -94,7 +94,7 @@ namespace de4dot.code.resources {
|
|||
}
|
||||
}
|
||||
|
||||
class BinaryResourceData : UserResourceData {
|
||||
public class BinaryResourceData : UserResourceData {
|
||||
byte[] data;
|
||||
|
||||
public BinaryResourceData(UserResourceType type, byte[] data)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
namespace de4dot.code.resources {
|
||||
class UserResourceType {
|
||||
public class UserResourceType {
|
||||
readonly string name;
|
||||
readonly ResourceTypeCode code;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user