Deviare v2 C#Hook API调用并读取参数

时间:2016-02-13 03:01:48

标签: c# deviare

我试图找出如何阅读一个参数。我得到了钩子工作,唯一的事情是,每当我这样做,它崩溃:

private void onFuncCall(NktHook hook, NktProcess process, NktHookCallInfo hookCallInfo)
    var paramsEnum = hookCallInfo.Params();
    if (hook.FunctionName.Equals("getPlayerPtr"))
    {
        INktParam p;
        p = paramsEnum.First();
        Debug.WriteLine(p.Value);//This line cause a crash
        return;
    }
}

getPlayerPtr定义:

UINT64 *getPlayerPtr(int Id);

1 个答案:

答案 0 :(得分:0)

此代码应打印所有参数值:

 private void OnFunctionCalled(NktHook hook, NktProcess process, NktHookCallInfo hookCallInfo)
    {
        Output(hook.FunctionName + "( ");
        bool first = true;
        foreach (INktParam param in hookCallInfo.Params())
        {
            if (first)
                first = false;
            else
            {
                Output(", ");
            }
            Output(param.Name + " = " + param.Value.ToString());
        }
        Output(" )" + Environment.NewLine);
    }

它不起作用意味着钩子函数不在Deviare数据库中。如果是这种情况,您应该创建一个自定义数据库: http://forum.nektra.com/forum/viewtopic.php?f=9&t=7130