diff --git a/MSNRedirector/dllmain.cpp b/MSNRedirector/dllmain.cpp index 1cb09cf..11e3059 100644 --- a/MSNRedirector/dllmain.cpp +++ b/MSNRedirector/dllmain.cpp @@ -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; diff --git a/MSNRedirector/framework.h b/MSNRedirector/framework.h index 025c8b4..afb2311 100644 --- a/MSNRedirector/framework.h +++ b/MSNRedirector/framework.h @@ -4,3 +4,5 @@ // Windows Header Files #include #include +#include +#include \ No newline at end of file