Skip to content

Commit

Permalink
Small cleanup & add more opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaTy committed Feb 27, 2021
1 parent 857ce09 commit 7e45793
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
4 changes: 4 additions & 0 deletions LibDotNetParser/CILApi/IL/OpCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ namespace LibDotNetParser.CILApi.IL
/// </summary>
public static class OpCodes
{
public const int Add_Ovf = 0xD6;
public const int Add_Ovf_Un = 0xD7;
public const int And = 0x5F;

/// <summary>
/// No Operating
/// </summary>
Expand Down
31 changes: 26 additions & 5 deletions LibDotNetParser/CILApi/IlDecompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,37 @@ public ILInstruction[] Decompile()
byte newObj4 = code[i + 4]; //token type. 10 = TypeRef

var numb = BitConverter.ToInt32(new byte[] { newObj, newObj2, newObj3, 0 }, 0);
uint tabel;
uint row;

DecodeMemberRefParent(newObj, out tabel, out row);

i += 4;

inr.Add(new ILInstruction()
{
OpCode = opCode,
OpCodeName = "newobj"
OpCodeName = "newobj (WIP)"
});
}
else if (opCode == OpCodes.Add_Ovf)
{
inr.Add(new ILInstruction()
{
OpCode = opCode,
OpCodeName = "and.ovf"
});
}
else if (opCode == OpCodes.Add_Ovf_Un)
{
inr.Add(new ILInstruction()
{
OpCode = opCode,
OpCodeName = "add.ovf.un"
});
}
else if (opCode == OpCodes.And)
{
inr.Add(new ILInstruction()
{
OpCode = opCode,
OpCodeName = "and"
});
}
else
Expand Down
2 changes: 0 additions & 2 deletions LibDotNetParser/PEParaser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ private void Init(byte[] data)
//#GUID Stream
else if (hdr.Name.Length == 5)
r.BaseStream.Position += 2;

Console.WriteLine("Stream: " + hdr.Name + " Size: " + hdr.Size + " Offset: " + hdr.Offset);
Streams.Add(hdr);
}

Expand Down

0 comments on commit 7e45793

Please sign in to comment.