add support for swapping the server itself since its hardcoded in MSN7. Also change URL to vm9

This commit is contained in:
Elijah 2024-05-28 12:16:48 -04:00
parent 29110c6b15
commit 0e2dd14c96
2 changed files with 28 additions and 3 deletions

View file

@ -2,26 +2,44 @@
#include "dllmain.h"
#include "pch.h"
#pragma comment (lib, "wininet.lib")
#pragma comment (lib, "Ws2_32.lib")
const char* PASSPORTNEXUS_HOST = "home.elijahr.dev";
const char* PASSPORTNEXUS_HOST = "vm9.computernewb.com";
HINTERNET(WINAPI * Real_InternetConnectA) (HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext) = InternetConnectA;
HINTERNET(WINAPI * Real_InternetConnectW) (HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContect) = InternetConnectW;
hostent * (WSAAPI * Real_gethostbyname) (const char *name) = gethostbyname;
INT(WSAAPI * Real_getaddrinfo) (PCSTR pNodeName, PCSTR pServiceName, const ADDRINFOA *pHints, PADDRINFOA *ppResult) = getaddrinfo;
HINTERNET WINAPI Patched_InternetConnectA(HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext) {
if (strcmp(lpszServerName, "nexus.passport.com") == 0) {
if (strcmp(lpszServerName, "nexus.passport.com") == 0 || strcmp(lpszServerName, "messenger.hotmail.com") == 0) {
return Real_InternetConnectA(hInternet, PASSPORTNEXUS_HOST, nServerPort, lpszUserName, lpszPassword, dwService, dwFlags, dwContext);
}
return Real_InternetConnectA(hInternet, lpszServerName, nServerPort, lpszUserName, lpszPassword, dwService, dwFlags, dwContext);
}
HINTERNET WINAPI Patched_InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext) {
if (lstrcmpW(lpszServerName, L"nexus.passport.com") == 0) {
if (lstrcmpW(lpszServerName, L"nexus.passport.com") == 0 || lstrcmpW(lpszServerName, L"messenger.hotmail.com") == 0) {
return Real_InternetConnectW(hInternet, CA2CT(PASSPORTNEXUS_HOST), nServerPort, lpszUserName, lpszPassword, dwService, dwFlags, dwContext);
}
return Real_InternetConnectW(hInternet, lpszServerName, nServerPort, lpszUserName, lpszPassword, dwService, dwFlags, dwContext);
}
hostent *WSAAPI Patched_gethostbyname(const char* name) {
if (strcmp(name, "messenger.hotmail.com") == 0) {
name = PASSPORTNEXUS_HOST;
}
return Real_gethostbyname(name);
}
INT WSAAPI Patched_getaddrinfo(PCSTR pNodeName, PCSTR pServiceName, const ADDRINFOA *pHints, PADDRINFOA *ppResult) {
if (pNodeName != NULL && strcmp(pNodeName, "messenger.hotmail.com") == 0) {
pNodeName = PASSPORTNEXUS_HOST;
}
return Real_getaddrinfo(pNodeName, pServiceName, pHints, ppResult);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
@ -36,6 +54,9 @@ BOOL APIENTRY DllMain( HMODULE hModule,
DetourAttach(&(PVOID&)Real_InternetConnectA, Patched_InternetConnectA);
DetourAttach(&(PVOID&)Real_InternetConnectW, Patched_InternetConnectW);
// we dont need this yet
//DetourAttach(&(PVOID&)Real_gethostbyname, Patched_gethostbyname);
DetourAttach(&(PVOID&)Real_getaddrinfo, Patched_getaddrinfo);
DetourTransactionCommit();
break;
@ -46,6 +67,8 @@ BOOL APIENTRY DllMain( HMODULE hModule,
DetourDetach(&(PVOID&)Real_InternetConnectA, Patched_InternetConnectA);
DetourDetach(&(PVOID&)Real_InternetConnectW, Patched_InternetConnectW);
//DetourDetach(&(PVOID&)Real_gethostbyname, Patched_gethostbyname);
DetourDetach(&(PVOID&)Real_getaddrinfo, Patched_getaddrinfo);
DetourTransactionCommit();
break;

View file

@ -4,3 +4,5 @@
// Windows Header Files
#include <windows.h>
#include <wininet.h>
#include <WinSock2.h>
#include <ws2tcpip.h>