2020-04-02 23:46:27 +02:00
|
|
|
|
|
|
|
/* vim: set filetype=c ts=8 noexpandtab: */
|
|
|
|
|
|
|
|
#include "common.h"
|
2020-04-05 16:19:05 +02:00
|
|
|
#include "bitstream.h"
|
2020-04-02 23:46:27 +02:00
|
|
|
#include "rakpeer.h"
|
2020-04-04 05:10:14 +02:00
|
|
|
#include "processnetworkpacket.h"
|
2020-04-02 23:46:27 +02:00
|
|
|
#include "uncompress.h"
|
2020-04-05 16:19:05 +02:00
|
|
|
#include "rangelist_deserialize.h"
|
2020-04-02 23:46:27 +02:00
|
|
|
#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);
|
2020-04-02 23:46:27 +02:00
|
|
|
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);
|
2020-04-02 23:46:27 +02:00
|
|
|
}
|