I have use wsock32.dll proxy dll for blocking unwanted packets on Half-Life server
All ok, but i want to announce on gamers console about it. How better realize it ?
Code:
#define ANNOUNCE "\xff\xff\xff\xfflSERVER PROTECTED !!!";
typedef int (FAR PASCAL*lpfn_recvfrom)(IN SOCKET s, OUT char FAR * buf, IN int len, IN int flags, OUT struct sockaddr FAR *from, IN OUT int FAR * fromlen);
lpfn_recvfrom orig_recvfrom;
int FAR PASCAL sys_recvfrom(IN SOCKET s, OUT char FAR * buf, IN int len, IN int flags, OUT struct sockaddr FAR *from, IN OUT int FAR * fromlen)
{
int returnCode = (*orig_recvfrom)(s, buf, len, flags, from, fromlen);
// Here i have code for hunting unwanted packets
// I want:
// if (packet==blablabla) sendtouserconsole ANNOUNCE
return(returnCode);
}
Can i call winsock
sendto function for announce players and how ?
Code:
typedef int (FAR PASCAL*lpfn_sendto)(IN SOCKET s, const char FAR * buf, int len, int flags, const struct sockaddr FAR *to, int tolen);
lpfn_sendto orig_sendto;
int FAR PASCAL sys_sendto(IN SOCKET s, IN const char FAR * buf, IN int len, IN int flags, IN const struct sockaddr FAR *to, IN int tolen)
{
int sendCode = (*orig_sendto)(s, buf, len, flags, to, tolen);
return(sendCode);
}