我想知道是否可以从函数中读取数据。
我知道我可以使用 detours 来挂钩函数并自由更改参数。
但这就是我对使用弯路的理解。
例如:
//cryptkeys
typedef int (WINAPI *pCryptKey)(int crypt1, int crypt2, int crypt3);
int WINAPI MyCryptKey(int crypt1, int crypt2, int crypt3);
pCryptKey MyCrypt2Key = (pCryptKey)(0x60FF50);
int WINAPI MyCryptKey(int crypt1, int crypt2, int crypt3)
{
cout << crypt1 << crypt2 << crypt3 << endl;
return MyCrypt2Key(999,135,2);
}
该代码绕过游戏中的加密密钥函数,并在调用它之前更改参数。因此,当它被调用时,参数已被更改。
我在想如果函数内部有数据而不是参数怎么办。
如何更改或显示它?
我应该重写整个函数吗?
我想要得到的是使用游戏本身来加密和解密数据包。
我已经挂钩了执行此操作的函数,但我所能做的就是更改参数。
游戏只是继续它的事情。
我在加密之前更改了数据包,因此发送了另一个数据包。但这只有在我尝试发送数据包并对其进行修改时才会发生。我想从字面上调用该函数,而无需等待游戏调用它,然后就可以修改值。
就像我将使用游戏输入我自己的未加密数据包并按加密以查看加密值,反之亦然。
解释或教程链接会很棒。
如果我像这样:
int WINAPI MyCryptKey(int crypt1, int crypt2, int crypt3)
{
//dont know whats supposed to be in here. But it should be alot of codes.
}
并将返回称为:
int cryptValue = MyCrypt2Key(999,135,2);
cout << cryptValue << endl; //to get the return?