[c++]recv chat packet problem

03/22/2016 19:36 KaMeR1337#1
hi, anyone here have got recv chat text ?

i have detoured recv function and everything works except chat text

Code:
int WINAPI RecvHook(int size, char* pDestBuf)
{
      TPacketHeader* header = reinterpret_cast<TPacketHeader*>((unsigned char*)*pDestBuf);
      if (header==4)
      {
		TPacketGCChat* kChat = reinterpret_cast<TPacketGCChat*>(pDestBuf);
                char buf[1024 + 1];
                uChatSize = kChat->size - sizeof(kChat);
		buf[uChatSize]='\0';
                strncpy(buf, pDestBuf + sizeof(TPacketGCChat), uChatSize);
                cout << buf << endl;
      }
      return oldRecv(size, pDestBuf);
}
i recieve crap instead of text. i know text is after TPacketGCChat but nothing works as i want
03/22/2016 21:22 Remix v72#2
you know youre using pDestBuf as length and uChatSize as source in the strncpy function?
03/22/2016 21:30 KaMeR1337#3
Quote:
Originally Posted by Remix v72 View Post
you know youre using pDestBuf as length and uChatSize as source in the strncpy function?
last param of strncpy is length not source
04/27/2016 15:39 KaMeR1337#4
bump
05/12/2016 22:49 KaMeR1337#5
solved. closed