-
-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate new analysis engine over to use ICED
- Loading branch information
Sam
committed
Sep 11, 2020
1 parent
38fab4d
commit babbd93
Showing
43 changed files
with
434 additions
and
148 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using Cpp2IL.Analysis.ResultModels; | ||
using SharpDisasm; | ||
using Iced.Intel; | ||
|
||
namespace Cpp2IL.Analysis.Actions | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using Cpp2IL.Analysis.ResultModels; | ||
using SharpDisasm; | ||
using Iced.Intel; | ||
|
||
namespace Cpp2IL.Analysis.Actions | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using Cpp2IL.Analysis.ResultModels; | ||
using SharpDisasm; | ||
using Iced.Intel; | ||
|
||
namespace Cpp2IL.Analysis.Actions | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using Cpp2IL.Analysis.ResultModels; | ||
using SharpDisasm; | ||
using Iced.Intel; | ||
|
||
namespace Cpp2IL.Analysis.Actions | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Cpp2IL.Analysis.ResultModels; | ||
using Iced.Intel; | ||
using Mono.Cecil; | ||
|
||
namespace Cpp2IL.Analysis.Actions | ||
{ | ||
public class CallManagedFunctionInRegAction : BaseAction | ||
{ | ||
private MethodDefinition _targetMethod; | ||
private LocalDefinition? _instanceCalledOn; | ||
|
||
public CallManagedFunctionInRegAction(MethodAnalysis context, Instruction instruction) : base(context, instruction) | ||
{ | ||
var regName = Utils.GetRegisterNameNew(instruction.MemoryBase); | ||
var operand = context.GetConstantInReg(regName); | ||
_targetMethod = (MethodDefinition) operand.Value; | ||
|
||
if (!_targetMethod.IsStatic) | ||
{ | ||
_instanceCalledOn = context.GetLocalInReg("rcx"); | ||
if (_instanceCalledOn == null) | ||
{ | ||
var cons = context.GetConstantInReg("rcx"); | ||
if (cons?.Value is NewSafeCastResult castResult) | ||
_instanceCalledOn = castResult.original; | ||
} | ||
} | ||
} | ||
|
||
public override Mono.Cecil.Cil.Instruction[] ToILInstructions() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override string? ToPsuedoCode() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override string ToTextSummary() | ||
{ | ||
return $"[!] Calls method {_targetMethod.FullName} from a register, on instance {_instanceCalledOn} if applicable\n"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using Cpp2IL.Analysis.ResultModels; | ||
using SharpDisasm; | ||
using Iced.Intel; | ||
|
||
namespace Cpp2IL.Analysis.Actions | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using Cpp2IL.Analysis.ResultModels; | ||
using SharpDisasm; | ||
using Iced.Intel; | ||
|
||
namespace Cpp2IL.Analysis.Actions | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using Cpp2IL.Analysis.ResultModels; | ||
using SharpDisasm; | ||
using Iced.Intel; | ||
|
||
namespace Cpp2IL.Analysis.Actions | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using Cpp2IL.Analysis.ResultModels; | ||
using SharpDisasm; | ||
using Iced.Intel; | ||
|
||
namespace Cpp2IL.Analysis.Actions | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.