1
0
mirror of https://gitea.tendokyu.moe/Dniel97/segatools.git synced 2024-11-15 01:27:36 +01:00

Merge pull request 'fix(netenv): Print IP addresses properly' (#4) from beerpsi/segatools:fix/print-ip-addresses-properly into develop

Reviewed-on: https://gitea.tendokyu.moe/Dniel97/segatools/pulls/4
This commit is contained in:
Dniel97 2024-01-08 18:26:51 +00:00
commit a8bd98706f

View File

@ -1,5 +1,4 @@
#include <windows.h>
#include <wincrypt.h>
#include <iphlpapi.h>
#include <stddef.h>
@ -372,9 +371,12 @@ static uint32_t WINAPI hook_GetBestRoute(
return ERROR_INVALID_PARAMETER;
}
dprintf("Netenv: GetBestRoute ip4 %x -> ip4 %x\n",
(int) _byteswap_ulong(src_ip),
(int) _byteswap_ulong(dest_ip));
uint32_t src_addr = _byteswap_ulong(src_ip);
uint32_t dest_addr = _byteswap_ulong(dest_ip);
dprintf("Netenv: GetBestRoute ip4 %u.%u.%u.%u -> ip4 %u.%u.%u.%u\n",
(src_addr >> 24) & 0xff, (src_addr >> 16) & 0xff, (src_addr >> 8) & 0xff, src_addr & 0xff,
(dest_addr >> 24) & 0xff, (dest_addr >> 16) & 0xff, (dest_addr >> 8) & 0xff, dest_addr & 0xff);
memset(route, 0, sizeof(*route));
@ -469,8 +471,10 @@ static uint32_t WINAPI hook_IcmpSendEcho2(
return 0;
}
dprintf("Netenv: Virtualized ICMP Ping to ip4 %x\n",
(int) _byteswap_ulong(DestinationAddress));
uint32_t addr = _byteswap_ulong(DestinationAddress);
dprintf("Netenv: Virtualized ICMP Ping to ip4 %u.%u.%u.%u\n",
(addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
pong = (ICMP_ECHO_REPLY *) ReplyBuffer;
memset(pong, 0, sizeof(*pong));