本文整理汇总了C#中dnlib.DotNet.Emit.Instruction类的典型用法代码示例。如果您正苦于以下问题:C# Instruction类的具体用法?C# Instruction怎么用?C# Instruction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Instruction类属于dnlib.DotNet.Emit命名空间,在下文中一共展示了Instruction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Clear
public void Clear()
{
instructions = new List<Instruction>();
branchOrRet = new List<Instruction>();
afterInstr = null;
fakeBranches = new List<Instruction>();
}
开发者ID:M3rcurio,项目名称:denvlib,代码行数:7,代码来源:ControlFlowTask.cs
示例2: EmulateUntil
public void EmulateUntil(Instruction instruction, CilBody body, Instruction starter)
{
Snapshots.Add(new Snapshot(new Stack<StackEntry>(Stack), new Dictionary<int, LocalEntry>(_locals),
instruction, _methodBody, null));
_instructionPointer = starter.GetInstructionIndex(body.Instructions) - 1;
Trace(() => _methodBody.Instructions[_instructionPointer] != instruction);
}
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:ILEmulator.cs
示例3: FollowsPattern
public static bool FollowsPattern(
this Instruction instr,
CilBody body,
out Instruction ender,
List<Predicate<Instruction>> preds,
int minPatternSize,
out int patternSize)
{
var curInstr = instr;
ender = null;
var correct = 0;
patternSize = 0;
while (curInstr.Next(body) != null && preds.Any(p => p(curInstr.Next(body))))
{
curInstr = curInstr.Next(body);
correct++;
}
if (correct >= minPatternSize)
{
patternSize = correct + 1;
ender = curInstr;
return true;
}
return false;
}
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:25,代码来源:InstructionExt.cs
示例4: getInstruction
static Instruction getInstruction(IList<Instruction> instrs, Instruction source, int displ)
{
int sourceIndex = instrs.IndexOf(source);
if (sourceIndex < 0)
throw new ApplicationException("Could not find source instruction");
return instrs[sourceIndex + displ];
}
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:CsvmToCilMethodConverter.cs
示例5: OnAfterLoadArg
protected override Instruction OnAfterLoadArg(MethodDef methodToInline, Instruction instr, ref int instrIndex) {
if (instr.OpCode.Code != Code.Box)
return instr;
if (methodToInline.MethodSig.GetGenParamCount() == 0)
return instr;
return DotNetUtils.GetInstruction(methodToInline.Body.Instructions, ref instrIndex);
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:7,代码来源:DsMethodCallInliner.cs
示例6: MarkAsBranchTarget
void MarkAsBranchTarget(Instruction instr) {
if (instr == null)
return;
int index = instrToIndex[instr];
GetBranchTargetList(index); // Just create the list
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:7,代码来源:InstructionListParser.cs
示例7: Emulate
public bool Emulate(Instruction instr) {
switch (instr.OpCode.Code) {
case Code.Br:
case Code.Br_S: return Emulate_Br();
case Code.Beq:
case Code.Beq_S: return Emulate_Beq();
case Code.Bge:
case Code.Bge_S: return Emulate_Bge();
case Code.Bge_Un:
case Code.Bge_Un_S: return Emulate_Bge_Un();
case Code.Bgt:
case Code.Bgt_S: return Emulate_Bgt();
case Code.Bgt_Un:
case Code.Bgt_Un_S: return Emulate_Bgt_Un();
case Code.Ble:
case Code.Ble_S: return Emulate_Ble();
case Code.Ble_Un:
case Code.Ble_Un_S: return Emulate_Ble_Un();
case Code.Blt:
case Code.Blt_S: return Emulate_Blt();
case Code.Blt_Un:
case Code.Blt_Un_S: return Emulate_Blt_Un();
case Code.Bne_Un:
case Code.Bne_Un_S: return Emulate_Bne_Un();
case Code.Brfalse:
case Code.Brfalse_S:return Emulate_Brfalse();
case Code.Brtrue:
case Code.Brtrue_S: return Emulate_Brtrue();
case Code.Switch: return Emulate_Switch();
default:
return false;
}
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:34,代码来源:BranchEmulator.cs
示例8: EmitDecode
public Instruction[] EmitDecode(MethodDef init, RPContext ctx, Instruction[] arg) {
Tuple<Expression, Func<int, int>> key = GetKey(ctx, init);
var invCompiled = new List<Instruction>();
new CodeGen(arg, ctx.Method, invCompiled).GenerateCIL(key.Item1);
init.Body.MaxStack += (ushort)ctx.Depth;
return invCompiled.ToArray();
}
开发者ID:EmilZhou,项目名称:ConfuserEx,代码行数:8,代码来源:ExpressionEncoding.cs
示例9: ReadInlineTok
protected override ITokenOperand ReadInlineTok(Instruction instr) {
switch (reader.ReadByte()) {
case 0: return imageReader.ReadTypeSig().ToTypeDefOrRef();
case 1: return imageReader.ReadFieldRef();
case 2: return imageReader.ReadMethodRef();
default: throw new ApplicationException("Unknown token type");
}
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:8,代码来源:MethodBodyReader.cs
示例10: EmitDecode
public Instruction[] EmitDecode(MethodDef init, RPContext ctx, Instruction[] arg) {
Tuple<MethodDef, Func<int, int>> key = GetKey(ctx, init);
var repl = new List<Instruction>();
repl.AddRange(arg);
repl.Add(Instruction.Create(OpCodes.Call, key.Item1));
return repl.ToArray();
}
开发者ID:EmilZhou,项目名称:ConfuserEx,代码行数:8,代码来源:x86Encoding.cs
示例11: getExInfo
ExInfo getExInfo(Instruction instruction)
{
if (instruction == null)
return lastExInfo;
ExInfo exInfo;
if (!exInfos.TryGetValue(instruction, out exInfo))
exInfos[instruction] = exInfo = new ExInfo();
return exInfo;
}
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:9,代码来源:MethodPrinter.cs
示例12: checkInvokeCall
static bool checkInvokeCall(Instruction instr, string returnType, string parameters)
{
var method = instr.Operand as MethodDef;
if (method == null)
return false;
if (method.Name != "Invoke")
return false;
return DotNetUtils.isMethod(method, returnType, parameters);
}
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:9,代码来源:TamperDetection.cs
示例13: GetInstructionSize
protected static int GetInstructionSize(Instruction instr)
{
var opcode = instr.OpCode;
if (opcode == null)
return 5; // Load store/field
var op = instr.Operand as SwitchTargetDisplOperand;
if (op == null)
return instr.GetSize();
return instr.OpCode.Size + (op.TargetDisplacements.Length + 1) * 4;
}
开发者ID:kakkerlakgly,项目名称:de4dot,代码行数:10,代码来源:CsvmToCilMethodConverterBase.cs
示例14: GetOffset
/// <summary>
/// Gets the offset of an instruction
/// </summary>
/// <param name="instr">The instruction</param>
/// <returns>The offset or <c>0</c> if <paramref name="instr"/> is <c>null</c> or not
/// present in the list of all instructions.</returns>
protected uint GetOffset(Instruction instr) {
if (instr == null) {
Error("Instruction is null");
return 0;
}
uint offset;
if (offsets.TryGetValue(instr, out offset))
return offset;
Error("Found some other method's instruction or a removed instruction. You probably removed an instruction that is the target of a branch instruction or an instruction that's the first/last instruction in an exception handler.");
return 0;
}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:17,代码来源:MethodBodyWriterBase.cs
示例15: InlineLoadMethod
protected bool InlineLoadMethod(int patchIndex, MethodDef methodToInline, Instruction loadInstr, int instrIndex) {
if (!IsReturn(methodToInline, instrIndex))
return false;
int methodArgsCount = DotNetUtils.GetArgsCount(methodToInline);
for (int i = 0; i < methodArgsCount; i++)
block.Insert(patchIndex++, OpCodes.Pop.ToInstruction());
block.Instructions[patchIndex] = new Instr(loadInstr.Clone());
return true;
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:11,代码来源:MethodCallInlinerBase.cs
示例16: ReplaceFormText
private bool ReplaceFormText(Instruction currentInstruction, string replacementText)
{
if (currentInstruction.Operand == null)
return false;
if (currentInstruction.Operand.ToString() != "ReplaceMe1")
return false;
currentInstruction.Operand = replacementText;
return true;
}
开发者ID:Virility,项目名称:SplashCreator,代码行数:11,代码来源:ImageSplashTechnique.cs
示例17: ToString
/// <summary>
/// Converts an instruction to a string
/// </summary>
/// <param name="instr">The instruction</param>
/// <returns>The result</returns>
public static string ToString(Instruction instr) {
if (instr == null)
return string.Empty;
var sb = new StringBuilder();
sb.Append(string.Format("IL_{0:X4}: ", instr.Offset));
sb.Append(instr.OpCode.Name);
AddOperandString(sb, instr, " ");
return sb.ToString();
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:17,代码来源:InstructionPrinter.cs
示例18: GetInstructionsBetween
public static IEnumerable<Instruction> GetInstructionsBetween(this CilBody body,
Instruction init, Instruction ender)
{
var curInstr = init;
while (curInstr.Next(body) != null && curInstr.Next(body) != ender)
{
yield return curInstr;
curInstr = curInstr.Next(body);
}
yield return curInstr;
yield return curInstr.Next(body);
}
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:12,代码来源:CilBodyExt.cs
示例19: EmitDecode
public Instruction[] EmitDecode(MethodDef init, RPContext ctx, Instruction[] arg) {
Tuple<int, int> key = GetKey(ctx.Random, init);
var ret = new List<Instruction>();
if (ctx.Random.NextBoolean()) {
ret.Add(Instruction.Create(OpCodes.Ldc_I4, key.Item1));
ret.AddRange(arg);
}
else {
ret.AddRange(arg);
ret.Add(Instruction.Create(OpCodes.Ldc_I4, key.Item1));
}
ret.Add(Instruction.Create(OpCodes.Mul));
return ret.ToArray();
}
开发者ID:EmilZhou,项目名称:ConfuserEx,代码行数:14,代码来源:NormalEncoding.cs
示例20: FindNodes
/// <summary>
/// Removes all nodes from start to end (exclusive) from this ControlStructure and moves them to the target structure.
/// </summary>
static HashSet<ControlFlowNode> FindNodes(ControlStructure current, Instruction startInst, Instruction endInst)
{
HashSet<ControlFlowNode> result = new HashSet<ControlFlowNode>();
if (startInst == null || endInst == null)
return result;
uint start = startInst.Offset;
uint end = endInst.Offset;
foreach (var node in current.Nodes.ToArray()) {
if (node.Start != null && start <= node.Start.Value.Offset && node.Start.Value.Offset < end) {
result.Add(node);
}
}
return result;
}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:17,代码来源:ControlStructureDetector.cs
注:本文中的dnlib.DotNet.Emit.Instruction类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论