1

I'm trying to figure out how I can read a param. I got the hook working, only thing is that whenever I do this, it crashes:

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 definition:

UINT64 *getPlayerPtr(int Id);
Talococh
  • 17
  • 6

1 Answers1

0

This code should print all parameters values:

 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);
    }

It it doesn't work means that the hooked function isn't in Deviare Database. If that's the situation you should create a custom database: http://forum.nektra.com/forum/viewtopic.php?f=9&t=7130

Paul Exchange
  • 2,637
  • 3
  • 26
  • 33