aboutsummaryrefslogtreecommitdiff
path: root/loader_wsock32_proxy
diff options
context:
space:
mode:
authorGeckoEidechse <gecko.eidechse+git@pm.me>2022-09-02 01:41:57 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-09-02 01:41:57 +0200
commit43c35721874f9f155ad71296671a149ce6db202c (patch)
treeb0d6528a64a47ea501672b539b178120db996968 /loader_wsock32_proxy
parentdf2d2f11598956ef42dad0f2fe09b8a04fbf7ce8 (diff)
parentd4ca096435aaba7a11a2a5606036316d9a0dbaaa (diff)
downloadNorthstarLauncher-43c35721874f9f155ad71296671a149ce6db202c.tar.gz
NorthstarLauncher-43c35721874f9f155ad71296671a149ce6db202c.zip
Merge remote-tracking branch 'origin/bobs-big-refactor-pr' into merged-main-into-refactor
Diffstat (limited to 'loader_wsock32_proxy')
-rw-r--r--loader_wsock32_proxy/dllmain.cpp59
-rw-r--r--loader_wsock32_proxy/pch.h4
2 files changed, 33 insertions, 30 deletions
diff --git a/loader_wsock32_proxy/dllmain.cpp b/loader_wsock32_proxy/dllmain.cpp
index e09cd183..7feb278d 100644
--- a/loader_wsock32_proxy/dllmain.cpp
+++ b/loader_wsock32_proxy/dllmain.cpp
@@ -10,8 +10,10 @@ HINSTANCE hL = 0;
bool GetExePathWide(wchar_t* dest, DWORD destSize)
{
- if (!dest) return NULL;
- if (destSize < MAX_PATH) return NULL;
+ if (!dest)
+ return NULL;
+ if (destSize < MAX_PATH)
+ return NULL;
DWORD length = GetModuleFileNameW(NULL, dest, destSize);
return length && PathRemoveFileSpecW(dest);
@@ -29,7 +31,11 @@ BOOL WINAPI DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
if (!GetExePathWide(exePath, 4096))
{
- MessageBoxA(GetForegroundWindow(), "Failed getting game directory.\nThe game cannot continue and has to exit.", "Northstar Wsock32 Proxy Error", 0);
+ MessageBoxA(
+ GetForegroundWindow(),
+ "Failed getting game directory.\nThe game cannot continue and has to exit.",
+ "Northstar Wsock32 Proxy Error",
+ 0);
return true;
}
@@ -59,7 +65,14 @@ BOOL WINAPI DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
{
if (!std::filesystem::exists(temp_dir))
{
- swprintf_s(buffer2, L"Failed copying wsock32.dll from system32 to \"%s\"\n\n%S\n\nFurthermore, we failed copying wsock32.dll into temporary directory at \"%s\"\n\n%S", buffer1, e1.what(), temp_dir.c_str(), e2.what());
+ swprintf_s(
+ buffer2,
+ L"Failed copying wsock32.dll from system32 to \"%s\"\n\n%S\n\nFurthermore, we failed copying wsock32.dll into "
+ L"temporary directory at \"%s\"\n\n%S",
+ buffer1,
+ e1.what(),
+ temp_dir.c_str(),
+ e2.what());
MessageBoxW(GetForegroundWindow(), buffer2, L"Northstar Wsock32 Proxy Error", 0);
return false;
}
@@ -68,7 +81,8 @@ BOOL WINAPI DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
}
}
hL = LoadLibraryExW(buffer1, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
- if (!hL) {
+ if (!hL)
+ {
LibraryLoadError(GetLastError(), L"wsock32.org.dll", buffer1);
return false;
}
@@ -104,73 +118,62 @@ extern "C"
FARPROC PA = NULL;
int RunASM();
- void PROXY_EnumProtocolsA()
+ void PROXY_EnumProtocolsA()
{
PA = p[1];
RunASM();
}
-
- void PROXY_EnumProtocolsW()
+ void PROXY_EnumProtocolsW()
{
PA = p[2];
RunASM();
}
-
- void PROXY_GetAddressByNameA()
+ void PROXY_GetAddressByNameA()
{
PA = p[4];
RunASM();
}
-
- void PROXY_GetAddressByNameW()
+ void PROXY_GetAddressByNameW()
{
PA = p[5];
RunASM();
}
-
- void PROXY_WEP()
+ void PROXY_WEP()
{
PA = p[17];
RunASM();
}
-
- void PROXY_WSARecvEx()
+ void PROXY_WSARecvEx()
{
PA = p[30];
RunASM();
}
-
- void PROXY___WSAFDIsSet()
+ void PROXY___WSAFDIsSet()
{
PA = p[36];
RunASM();
}
-
- void PROXY_getnetbyname()
+ void PROXY_getnetbyname()
{
PA = p[45];
RunASM();
}
-
- void PROXY_getsockopt()
+ void PROXY_getsockopt()
{
PA = p[52];
RunASM();
}
-
- void PROXY_inet_network()
+ void PROXY_inet_network()
{
PA = p[56];
RunASM();
}
-
- void PROXY_s_perror()
+ void PROXY_s_perror()
{
PA = p[67];
RunASM();
}
-
- void PROXY_setsockopt()
+ void PROXY_setsockopt()
{
PA = p[72];
RunASM();
diff --git a/loader_wsock32_proxy/pch.h b/loader_wsock32_proxy/pch.h
index 0103ff59..6e8873a1 100644
--- a/loader_wsock32_proxy/pch.h
+++ b/loader_wsock32_proxy/pch.h
@@ -7,10 +7,10 @@
#ifndef PCH_H
#define PCH_H
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
#include "include/MinHook.h"
-#endif //PCH_H
+#endif // PCH_H