samp-re/nethandler.c

32 lines
857 B
C
Raw Normal View History

/* vim: set filetype=c ts=8 noexpandtab: */
#include "common.h"
2020-04-05 16:19:05 +02:00
#include "bitstream.h"
#include "rakpeer.h"
2020-04-04 05:10:14 +02:00
#include "processnetworkpacket.h"
#include "uncompress.h"
2020-04-05 16:19:05 +02:00
#include "rangelist_deserialize.h"
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void simple_redir_call(void *address, void *newtarget)
{
DWORD oldvp;
VirtualProtect(address, 4, PAGE_EXECUTE_READWRITE, &oldvp);
*(int*) address = (int) newtarget - ((int) address + 4);
}
void nethandler_init()
{
simple_redir_call(UNCOMPRESS_TARGET, uncompress_main);
2020-04-04 05:10:14 +02:00
simple_redir_call(RP_PARSE_NETWORK_PACKET, ProcessNetworkPacket);
simple_redir_call(RP_PARSE_CONNECTION_REQ,
RakPeer__ParseConnectionRequestPacket);
2020-04-05 16:19:05 +02:00
//simple_redir_call((void*) 0x45F951, RangeList__Deserialize_hooked);
simple_redir_call((void*) 0x45E2EF, Hooked_BitStream__ReadCompressed);
}