0

我正在尝试替换字符串以调用函数,但将字符串作为参数发送(该函数将返回一些内容)

Result.Append(b.ToString("AnyString"));

我正在尝试替换为这样的东西:

Result.Append(b.ToString(Class1.Function1("AnyString")));

使用 dnlib

我有的 :

...
...
foreach (var method in type.Methods)
    {
        if (!method.HasBody)
            continue;
        if (method == decryptMethod)
            continue;

        method.Body.KeepOldMaxStack = true;

        for (var i = 0; i < method.Body.Instructions.Count; i++)
        {
            if (method.Body.Instructions[i].OpCode != OpCodes.Ldstr) continue;
            var oldString = method.Body.Instructions[i].Operand.ToString(); //Original String
            method.Body.Instructions[i].Operand = Algorithm.Aes256.EncryptString(oldString); //i encrypt the string here
            method.Body.Instructions.Insert(i + 1, new Instruction(OpCodes.Call, decryptMethod)); //what do i use for decryptMethod?
        }

        method.Body.SimplifyBranches();
        method.Body.OptimizeBranches();
    }
4

0 回答 0