AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Coding MM:S Plugins & SM Extensions (https://forums.alliedmods.net/forumdisplay.php?f=75)
-   -   [CS:GO] Invalid arguments in hooked function (https://forums.alliedmods.net/showthread.php?t=333485)

kadet.89 07-15-2021 18:01

[CS:GO] Invalid arguments in hooked function
 
I'm trying to hook this function:
INetChannel::ProcessPacket( struct netpacket_s* packet, bool bHasHeader )

Here is my code:
PHP Code:

INetChannelpNetChan static_cast<INetChannel*>(engine->GetPlayerNetInfo(Index()));
if(
pNetChan)
{
        
processPacketHookId_ SH_ADD_HOOK_MEMFUNC(INetChannelProcessPacketpNetChanthis, &CPlayer::ProcessPackettrue);

}
void CPlayer::ProcessPacket(struct netpacket_spacketbool bHasHeader )
{


The hook works, but the arguments contain junk data. If I call packet->message the server crashes.
I found this source code in the SDK:
PHP Code:

void CNetChan::ProcessPacketnetpacket_t packetbool bHasHeader 

Here is how this function looks in ida:
PHP Code:

int __cdecl sub_28CBC0(int a1int a2char a3

This is how bf_read position is set in this function:
PHP Code:

bf_read &msg packet->message;    // handy shortcut
msg.Seek); 

The same in IDA:
PHP Code:

v51 a2 48;
sub_314FF0(a2 480);
v3 = *(_DWORD *)(a1 196); 

If I'm correct with my undrestending, it takes the second argument from the function, that is netpacket_s* packet, then it gets the buffer from the netpacket_s* (which is at offset 48 ).

In inetchannel.h second argument is bool and bf_read offset is 32
Can it be that INetChannel and netpacket_s are incorrect in the SDK, if yes, where can I get the correct header?

UPD, I placed 4 dummy integers at the begining of netpacket_s structure, and now I can access bf_read, however all the other variables are a mistery and the bool argument in the function is incorrect.

pixelcraft 10-23-2021 15:13

Re: [CS:GO] Invalid arguments in hooked function
 
apt degate fuck.bitchmitchell.!sh

Fuck her hard


All times are GMT -4. The time now is 03:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.