Raised This Month: $12 Target: $400
 3% 

[CS:GO] Invalid arguments in hooked function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 07-15-2021 , 18:01   [CS:GO] Invalid arguments in hooked function
Reply With Quote #1

I'm trying to hook this function:
INetChannel:rocessPacket( 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.

Last edited by kadet.89; 07-15-2021 at 19:02.
kadet.89 is offline
Send a message via Skype™ to kadet.89
pixelcraft
Junior Member
Join Date: Nov 2013
Old 10-23-2021 , 15:13   Re: [CS:GO] Invalid arguments in hooked function
Reply With Quote #2

apt degate fuck.bitchmitchell.!sh

Fuck her hard
pixelcraft is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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