de4dot-cex/de4dot.code/deobfuscators/ConfuserEx/x86/Instructions/X86XOR.cs
ViR Dash 23477ccb5f Implemented ConfuserEx deobfuscator
x86 cflow and x86 constant decryption
Backport of LINQ (LinqBridge)
Shift left/right emulation fixes in de4dot core
Block class extended to hold additional information
2017-02-13 11:14:22 +02:00

28 lines
1.0 KiB
C#

using System.Collections.Generic;
using de4dot.Bea;
namespace ConfuserDeobfuscator.Engine.Routines.Ex.x86.Instructions
{
class X86XOR : X86Instruction
{
public X86XOR(Disasm rawInstruction) : base()
{
Operands = new IX86Operand[2];
Operands[0] = GetOperand(rawInstruction.Argument1);
Operands[1] = GetOperand(rawInstruction.Argument2);
}
public override X86OpCode OpCode { get { return X86OpCode.XOR; } }
public override void Execute(Dictionary<string, int> registers, Stack<int> localStack)
{
if (Operands[1] is X86ImmediateOperand)
registers[((X86RegisterOperand)Operands[0]).Register.ToString()] ^=
((X86ImmediateOperand)Operands[1]).Immediate;
else
registers[((X86RegisterOperand)Operands[0]).Register.ToString()] ^=
registers[((X86RegisterOperand)Operands[1]).Register.ToString()];
}
}
}