Update code since dot10 was updated

This commit is contained in:
de4dot 2012-11-02 07:36:02 +01:00
parent 24c43d5a66
commit 70916173f3
10 changed files with 25 additions and 25 deletions

View File

@ -134,7 +134,7 @@ namespace AssemblyData.methodsrewriter {
if (ex.FilterStart == instr) {
}
if (ex.HandlerStart == instr) {
if (ex.HandlerType == ExceptionClause.Finally)
if (ex.HandlerType == ExceptionHandlerType.Finally)
ilg.BeginFinallyBlock();
else
ilg.BeginCatchBlock(Resolver.getRtType(ex.CatchType));
@ -317,11 +317,11 @@ namespace AssemblyData.methodsrewriter {
break;
case OperandType.InlineVar:
ilg.Emit(opcode, checked((short)((IVariable)instr.Operand).Number));
ilg.Emit(opcode, checked((short)((IVariable)instr.Operand).Index));
break;
case OperandType.ShortInlineVar:
ilg.Emit(opcode, checked((byte)((IVariable)instr.Operand).Number));
ilg.Emit(opcode, checked((byte)((IVariable)instr.Operand).Index));
break;
case OperandType.InlineSig: //TODO:

View File

@ -332,8 +332,8 @@ namespace AssemblyData.methodsrewriter {
}
static IList<TypeSig> getParameters(MethodDef method) {
var list = new List<TypeSig>(method.Parameters.Length + 1);
for (int i = 0; i < method.Parameters.Length; i++)
var list = new List<TypeSig>(method.Parameters.Count + 1);
for (int i = 0; i < method.Parameters.Count; i++)
list.Add(method.Parameters[i].Type);
return list;
}

View File

@ -46,10 +46,10 @@ namespace de4dot.blocks {
public int handlerStart;
public int handlerEnd;
public ITypeDefOrRef catchType;
public ExceptionClause handlerType;
public ExceptionHandlerType handlerType;
public ExceptionInfo(int tryStart, int tryEnd, int filterStart,
int handlerStart, int handlerEnd, ITypeDefOrRef catchType,
ExceptionClause handlerType) {
ExceptionHandlerType handlerType) {
if (tryStart > tryEnd || filterStart > handlerStart ||
tryStart < 0 || tryEnd < 0 || filterStart < 0 || handlerStart < 0 || handlerEnd < 0)
throw new ApplicationException("Invalid start/end/filter/handler indexes");

View File

@ -28,13 +28,13 @@ namespace de4dot.blocks {
// State for an ExceptionHandler instance
ITypeDefOrRef catchType;
ExceptionClause handlerType;
ExceptionHandlerType handlerType;
public ITypeDefOrRef CatchType {
get { return catchType; }
}
public ExceptionClause HandlerType {
public ExceptionHandlerType HandlerType {
get { return handlerType; }
}

View File

@ -163,7 +163,7 @@ namespace de4dot.blocks.cflow {
}
public Value getArg(Parameter arg) {
return getArg(arg.Number);
return getArg(arg.Index);
}
TypeSig getArgType(int index) {
@ -173,11 +173,11 @@ namespace de4dot.blocks.cflow {
}
public void setArg(Parameter arg, Value value) {
setArg(arg.Number, value);
setArg(arg.Index, value);
}
public void makeArgUnknown(Parameter arg) {
setArg(arg, getUnknownArg(arg.Number));
setArg(arg, getUnknownArg(arg.Index));
}
void setArg(int index, Value value) {
@ -194,15 +194,15 @@ namespace de4dot.blocks.cflow {
}
public Value getLocal(Local local) {
return getLocal(local.Number);
return getLocal(local.Index);
}
public void setLocal(Local local, Value value) {
setLocal(local.Number, value);
setLocal(local.Index, value);
}
public void makeLocalUnknown(Local local) {
setLocal(local.Number, getUnknownLocal(local.Number));
setLocal(local.Index, getUnknownLocal(local.Index));
}
void setLocal(int index, Value value) {
@ -247,7 +247,7 @@ namespace de4dot.blocks.cflow {
case Code.Starg:
case Code.Starg_S: emulate_Starg((Parameter)instr.Operand); break;
case Code.Stloc:
case Code.Stloc_S: emulate_Stloc(((Local)instr.Operand).Number); break;
case Code.Stloc_S: emulate_Stloc(((Local)instr.Operand).Index); break;
case Code.Stloc_0: emulate_Stloc(0); break;
case Code.Stloc_1: emulate_Stloc(1); break;
case Code.Stloc_2: emulate_Stloc(2); break;
@ -269,7 +269,7 @@ namespace de4dot.blocks.cflow {
case Code.Ldarga:
case Code.Ldarga_S: emulate_Ldarga((Parameter)instr.Operand); break;
case Code.Ldloca:
case Code.Ldloca_S: emulate_Ldloca(((Local)instr.Operand).Number); break;
case Code.Ldloca_S: emulate_Ldloca(((Local)instr.Operand).Index); break;
case Code.Dup: valueStack.copyTop(); break;
@ -837,7 +837,7 @@ namespace de4dot.blocks.cflow {
}
void emulate_Starg(Parameter arg) {
setArg(arg.Number, valueStack.pop());
setArg(arg.Index, valueStack.pop());
}
void emulate_Stloc(int index) {

View File

@ -165,7 +165,7 @@ namespace de4dot.blocks.cflow {
var methodArgs = methodToInline.Parameters;
var calledMethodArgs = DotNetUtils.getArgs(ctor);
if (methodArgs.Length + 1 - popLastArgs != calledMethodArgs.Count)
if (methodArgs.Count + 1 - popLastArgs != calledMethodArgs.Count)
return null;
for (int i = 1; i < calledMethodArgs.Count; i++) {
if (!isCompatibleType(i, calledMethodArgs[i], methodArgs[i - 1].Type))
@ -199,7 +199,7 @@ namespace de4dot.blocks.cflow {
var methodToInlineArgs = methodToInline.Parameters;
var methodArgs = DotNetUtils.getArgs(method);
bool hasImplicitThis = method.MethodSig.ImplicitThis;
if (methodToInlineArgs.Length - ignoreLastMethodToInlineArgs != methodArgs.Count)
if (methodToInlineArgs.Count - ignoreLastMethodToInlineArgs != methodArgs.Count)
return false;
for (int i = 0; i < methodArgs.Count; i++) {
var methodArg = methodArgs[i];

View File

@ -440,11 +440,11 @@ namespace de4dot.code {
continue;
if (argsStrings == null) {
if (method.Parameters.Length == 0)
if (method.Parameters.Count == 0)
continue;
}
else {
if (argsStrings.Length != method.Parameters.Length)
if (argsStrings.Length != method.Parameters.Count)
continue;
for (int i = 0; i < argsStrings.Length; i++) {
if (argsStrings[i] != method.Parameters[i].Type.FullName)

View File

@ -562,7 +562,7 @@ namespace de4dot.code.deobfuscators {
var body = method.CilBody;
if (body.InitLocals || body.MaxStack > 8)
return true;
if (body.LocalList.Length > 0)
if (body.LocalList.Count > 0)
return true;
if (body.ExceptionHandlers.Count > 0)
return true;

View File

@ -42,7 +42,7 @@ namespace de4dot.code.deobfuscators {
if (tryBlock.TryHandlerBlocks.Count != 1)
continue;
var catchBlock = tryBlock.TryHandlerBlocks[0];
if (catchBlock.HandlerType != ExceptionClause.Catch ||
if (catchBlock.HandlerType != ExceptionHandlerType.Catch ||
catchBlock.CatchType.FullName != "System.Exception") {
continue;
}

2
dot10

@ -1 +1 @@
Subproject commit 4030f90eb8d1a71793dfd1772efc7b5e5513dff4
Subproject commit 8ca97147ac3d379b023e0fc65c6ba997287a5f77