aboutsummaryrefslogtreecommitdiff
path: root/loader_wsock32_proxy
diff options
context:
space:
mode:
authorBobTheBob9 <for.oliver.kirkham@gmail.com>2022-08-16 01:12:59 +0100
committerBobTheBob9 <for.oliver.kirkham@gmail.com>2022-08-16 01:12:59 +0100
commit082f3893215797268d7ac8c1000ebe371f276af7 (patch)
treeb5cc677a49635a9244559e235d4915c064c9f6c4 /loader_wsock32_proxy
parentb30a385fc25dad05e568ae8538f5aa3656c5c8d4 (diff)
downloadNorthstarLauncher-082f3893215797268d7ac8c1000ebe371f276af7.tar.gz
NorthstarLauncher-082f3893215797268d7ac8c1000ebe371f276af7.zip
lots of stuff idk
Diffstat (limited to 'loader_wsock32_proxy')
-rw-r--r--loader_wsock32_proxy/dllmain.cpp310
-rw-r--r--loader_wsock32_proxy/include/MinHook.h372
-rw-r--r--loader_wsock32_proxy/include/MinHook.x64.libbin32400 -> 32401 bytes
-rw-r--r--loader_wsock32_proxy/loader.cpp186
-rw-r--r--loader_wsock32_proxy/loader.h18
-rw-r--r--loader_wsock32_proxy/loader_wsock32_proxy.vcxproj240
-rw-r--r--loader_wsock32_proxy/loader_wsock32_proxy.vcxproj.filters104
-rw-r--r--loader_wsock32_proxy/pch.cpp10
-rw-r--r--loader_wsock32_proxy/pch.h32
-rw-r--r--loader_wsock32_proxy/wsock32.asm14
-rw-r--r--loader_wsock32_proxy/wsock32.def156
11 files changed, 721 insertions, 721 deletions
diff --git a/loader_wsock32_proxy/dllmain.cpp b/loader_wsock32_proxy/dllmain.cpp
index 82e0be8b..7efe5e1d 100644
--- a/loader_wsock32_proxy/dllmain.cpp
+++ b/loader_wsock32_proxy/dllmain.cpp
@@ -1,155 +1,155 @@
-#include "pch.h"
-#include "loader.h"
-
-#include <Shlwapi.h>
-#include <filesystem>
-
-HINSTANCE hLThis = 0;
-FARPROC p[857];
-HINSTANCE hL = 0;
-
-bool GetExePathWide(wchar_t* dest, DWORD destSize)
-{
- if (!dest) return NULL;
- if (destSize < MAX_PATH) return NULL;
-
- DWORD length = GetModuleFileNameW(NULL, dest, destSize);
- return length && PathRemoveFileSpecW(dest);
-}
-
-wchar_t exePath[4096];
-wchar_t buffer1[8192];
-wchar_t buffer2[12288];
-
-BOOL WINAPI DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
-{
- if (reason == DLL_PROCESS_ATTACH)
- {
- hLThis = hInst;
-
- if (!GetExePathWide(exePath, 4096))
- {
- MessageBoxA(GetForegroundWindow(), "Failed getting game directory.\nThe game cannot continue and has to exit.", "Northstar Wsock32 Proxy Error", 0);
- return true;
- }
-
- if (!ProvisionNorthstar()) // does not call InitialiseNorthstar yet, will do it on LauncherMain hook
- return true;
-
- // copy the original library for system to our local directory, with changed name so that we can load it
- swprintf_s(buffer1, L"%s\\bin\\x64_retail\\wsock32.org.dll", exePath);
- GetSystemDirectoryW(buffer2, 4096);
- swprintf_s(buffer2, L"%s\\wsock32.dll", buffer2);
- try
- {
- std::filesystem::copy_file(buffer2, buffer1);
- }
- catch (const std::exception& e1)
- {
- if (!std::filesystem::exists(buffer1))
- {
- // fallback by copying to temp dir...
- // because apparently games installed by EA Desktop app don't have write permissions in their directories
- auto temp_dir = std::filesystem::temp_directory_path() / L"wsock32.org.dll";
- try
- {
- std::filesystem::copy_file(buffer2, temp_dir);
- }
- catch (const std::exception& e2)
- {
- 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());
- MessageBoxW(GetForegroundWindow(), buffer2, L"Northstar Wsock32 Proxy Error", 0);
- return false;
- }
- }
- swprintf_s(buffer1, L"%s", temp_dir.c_str());
- }
- }
- hL = LoadLibraryExW(buffer1, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
- if (!hL) {
- LibraryLoadError(GetLastError(), L"wsock32.org.dll", buffer1);
- return false;
- }
-
- // load the functions to proxy
- // it's only some of them, because in case of wsock32 most of the functions can actually be natively redirected
- // (see wsock32.def and https://source.winehq.org/WineAPI/wsock32.html)
- p[1] = GetProcAddress(hL, "EnumProtocolsA");
- p[2] = GetProcAddress(hL, "EnumProtocolsW");
- p[4] = GetProcAddress(hL, "GetAddressByNameA");
- p[5] = GetProcAddress(hL, "GetAddressByNameW");
- p[17] = GetProcAddress(hL, "WEP");
- p[30] = GetProcAddress(hL, "WSARecvEx");
- p[36] = GetProcAddress(hL, "__WSAFDIsSet");
- p[45] = GetProcAddress(hL, "getnetbyname");
- p[52] = GetProcAddress(hL, "getsockopt");
- p[56] = GetProcAddress(hL, "inet_network");
- p[67] = GetProcAddress(hL, "s_perror");
- p[72] = GetProcAddress(hL, "setsockopt");
- }
-
- if (reason == DLL_PROCESS_DETACH)
- {
- FreeLibrary(hL);
- return true;
- }
-
- return true;
-}
-
-extern "C"
-{
- FARPROC PA = NULL;
- int RunASM();
-
- void PROXY_EnumProtocolsA() {
- PA = p[1];
- RunASM();
- }
- void PROXY_EnumProtocolsW() {
- PA = p[2];
- RunASM();
- }
- void PROXY_GetAddressByNameA() {
- PA = p[4];
- RunASM();
- }
- void PROXY_GetAddressByNameW() {
- PA = p[5];
- RunASM();
- }
- void PROXY_WEP() {
- PA = p[17];
- RunASM();
- }
- void PROXY_WSARecvEx() {
- PA = p[30];
- RunASM();
- }
- void PROXY___WSAFDIsSet() {
- PA = p[36];
- RunASM();
- }
- void PROXY_getnetbyname() {
- PA = p[45];
- RunASM();
- }
- void PROXY_getsockopt() {
- PA = p[52];
- RunASM();
- }
- void PROXY_inet_network() {
- PA = p[56];
- RunASM();
- }
- void PROXY_s_perror() {
- PA = p[67];
- RunASM();
- }
- void PROXY_setsockopt() {
- PA = p[72];
- RunASM();
- }
-} \ No newline at end of file
+#include "pch.h"
+#include "loader.h"
+
+#include <Shlwapi.h>
+#include <filesystem>
+
+HINSTANCE hLThis = 0;
+FARPROC p[857];
+HINSTANCE hL = 0;
+
+bool GetExePathWide(wchar_t* dest, DWORD destSize)
+{
+ if (!dest) return NULL;
+ if (destSize < MAX_PATH) return NULL;
+
+ DWORD length = GetModuleFileNameW(NULL, dest, destSize);
+ return length && PathRemoveFileSpecW(dest);
+}
+
+wchar_t exePath[4096];
+wchar_t buffer1[8192];
+wchar_t buffer2[12288];
+
+BOOL WINAPI DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
+{
+ if (reason == DLL_PROCESS_ATTACH)
+ {
+ hLThis = hInst;
+
+ if (!GetExePathWide(exePath, 4096))
+ {
+ MessageBoxA(GetForegroundWindow(), "Failed getting game directory.\nThe game cannot continue and has to exit.", "Northstar Wsock32 Proxy Error", 0);
+ return true;
+ }
+
+ if (!ProvisionNorthstar()) // does not call InitialiseNorthstar yet, will do it on LauncherMain hook
+ return true;
+
+ // copy the original library for system to our local directory, with changed name so that we can load it
+ swprintf_s(buffer1, L"%s\\bin\\x64_retail\\wsock32.org.dll", exePath);
+ GetSystemDirectoryW(buffer2, 4096);
+ swprintf_s(buffer2, L"%s\\wsock32.dll", buffer2);
+ try
+ {
+ std::filesystem::copy_file(buffer2, buffer1);
+ }
+ catch (const std::exception& e1)
+ {
+ if (!std::filesystem::exists(buffer1))
+ {
+ // fallback by copying to temp dir...
+ // because apparently games installed by EA Desktop app don't have write permissions in their directories
+ auto temp_dir = std::filesystem::temp_directory_path() / L"wsock32.org.dll";
+ try
+ {
+ std::filesystem::copy_file(buffer2, temp_dir);
+ }
+ catch (const std::exception& e2)
+ {
+ 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());
+ MessageBoxW(GetForegroundWindow(), buffer2, L"Northstar Wsock32 Proxy Error", 0);
+ return false;
+ }
+ }
+ swprintf_s(buffer1, L"%s", temp_dir.c_str());
+ }
+ }
+ hL = LoadLibraryExW(buffer1, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
+ if (!hL) {
+ LibraryLoadError(GetLastError(), L"wsock32.org.dll", buffer1);
+ return false;
+ }
+
+ // load the functions to proxy
+ // it's only some of them, because in case of wsock32 most of the functions can actually be natively redirected
+ // (see wsock32.def and https://source.winehq.org/WineAPI/wsock32.html)
+ p[1] = GetProcAddress(hL, "EnumProtocolsA");
+ p[2] = GetProcAddress(hL, "EnumProtocolsW");
+ p[4] = GetProcAddress(hL, "GetAddressByNameA");
+ p[5] = GetProcAddress(hL, "GetAddressByNameW");
+ p[17] = GetProcAddress(hL, "WEP");
+ p[30] = GetProcAddress(hL, "WSARecvEx");
+ p[36] = GetProcAddress(hL, "__WSAFDIsSet");
+ p[45] = GetProcAddress(hL, "getnetbyname");
+ p[52] = GetProcAddress(hL, "getsockopt");
+ p[56] = GetProcAddress(hL, "inet_network");
+ p[67] = GetProcAddress(hL, "s_perror");
+ p[72] = GetProcAddress(hL, "setsockopt");
+ }
+
+ if (reason == DLL_PROCESS_DETACH)
+ {
+ FreeLibrary(hL);
+ return true;
+ }
+
+ return true;
+}
+
+extern "C"
+{
+ FARPROC PA = NULL;
+ int RunASM();
+
+ void PROXY_EnumProtocolsA() {
+ PA = p[1];
+ RunASM();
+ }
+ void PROXY_EnumProtocolsW() {
+ PA = p[2];
+ RunASM();
+ }
+ void PROXY_GetAddressByNameA() {
+ PA = p[4];
+ RunASM();
+ }
+ void PROXY_GetAddressByNameW() {
+ PA = p[5];
+ RunASM();
+ }
+ void PROXY_WEP() {
+ PA = p[17];
+ RunASM();
+ }
+ void PROXY_WSARecvEx() {
+ PA = p[30];
+ RunASM();
+ }
+ void PROXY___WSAFDIsSet() {
+ PA = p[36];
+ RunASM();
+ }
+ void PROXY_getnetbyname() {
+ PA = p[45];
+ RunASM();
+ }
+ void PROXY_getsockopt() {
+ PA = p[52];
+ RunASM();
+ }
+ void PROXY_inet_network() {
+ PA = p[56];
+ RunASM();
+ }
+ void PROXY_s_perror() {
+ PA = p[67];
+ RunASM();
+ }
+ void PROXY_setsockopt() {
+ PA = p[72];
+ RunASM();
+ }
+}
diff --git a/loader_wsock32_proxy/include/MinHook.h b/loader_wsock32_proxy/include/MinHook.h
index bbf7e7ad..15c0a875 100644
--- a/loader_wsock32_proxy/include/MinHook.h
+++ b/loader_wsock32_proxy/include/MinHook.h
@@ -1,186 +1,186 @@
-/*
- * MinHook - The Minimalistic API Hooking Library for x64/x86
- * Copyright (C) 2009-2017 Tsuda Kageyu.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__)
- #error MinHook supports only x86 and x64 systems.
-#endif
-
-#include <windows.h>
-
-// MinHook Error Codes.
-typedef enum MH_STATUS
-{
- // Unknown error. Should not be returned.
- MH_UNKNOWN = -1,
-
- // Successful.
- MH_OK = 0,
-
- // MinHook is already initialized.
- MH_ERROR_ALREADY_INITIALIZED,
-
- // MinHook is not initialized yet, or already uninitialized.
- MH_ERROR_NOT_INITIALIZED,
-
- // The hook for the specified target function is already created.
- MH_ERROR_ALREADY_CREATED,
-
- // The hook for the specified target function is not created yet.
- MH_ERROR_NOT_CREATED,
-
- // The hook for the specified target function is already enabled.
- MH_ERROR_ENABLED,
-
- // The hook for the specified target function is not enabled yet, or already
- // disabled.
- MH_ERROR_DISABLED,
-
- // The specified pointer is invalid. It points the address of non-allocated
- // and/or non-executable region.
- MH_ERROR_NOT_EXECUTABLE,
-
- // The specified target function cannot be hooked.
- MH_ERROR_UNSUPPORTED_FUNCTION,
-
- // Failed to allocate memory.
- MH_ERROR_MEMORY_ALLOC,
-
- // Failed to change the memory protection.
- MH_ERROR_MEMORY_PROTECT,
-
- // The specified module is not loaded.
- MH_ERROR_MODULE_NOT_FOUND,
-
- // The specified function is not found.
- MH_ERROR_FUNCTION_NOT_FOUND
-}
-MH_STATUS;
-
-// Can be passed as a parameter to MH_EnableHook, MH_DisableHook,
-// MH_QueueEnableHook or MH_QueueDisableHook.
-#define MH_ALL_HOOKS NULL
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- // Initialize the MinHook library. You must call this function EXACTLY ONCE
- // at the beginning of your program.
- MH_STATUS WINAPI MH_Initialize(VOID);
-
- // Uninitialize the MinHook library. You must call this function EXACTLY
- // ONCE at the end of your program.
- MH_STATUS WINAPI MH_Uninitialize(VOID);
-
- // Creates a Hook for the specified target function, in disabled state.
- // Parameters:
- // pTarget [in] A pointer to the target function, which will be
- // overridden by the detour function.
- // pDetour [in] A pointer to the detour function, which will override
- // the target function.
- // ppOriginal [out] A pointer to the trampoline function, which will be
- // used to call the original target function.
- // This parameter can be NULL.
- MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal);
-
- // Creates a Hook for the specified API function, in disabled state.
- // Parameters:
- // pszModule [in] A pointer to the loaded module name which contains the
- // target function.
- // pszTarget [in] A pointer to the target function name, which will be
- // overridden by the detour function.
- // pDetour [in] A pointer to the detour function, which will override
- // the target function.
- // ppOriginal [out] A pointer to the trampoline function, which will be
- // used to call the original target function.
- // This parameter can be NULL.
- MH_STATUS WINAPI MH_CreateHookApi(
- LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal);
-
- // Creates a Hook for the specified API function, in disabled state.
- // Parameters:
- // pszModule [in] A pointer to the loaded module name which contains the
- // target function.
- // pszTarget [in] A pointer to the target function name, which will be
- // overridden by the detour function.
- // pDetour [in] A pointer to the detour function, which will override
- // the target function.
- // ppOriginal [out] A pointer to the trampoline function, which will be
- // used to call the original target function.
- // This parameter can be NULL.
- // ppTarget [out] A pointer to the target function, which will be used
- // with other functions.
- // This parameter can be NULL.
- MH_STATUS WINAPI MH_CreateHookApiEx(
- LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget);
-
- // Removes an already created hook.
- // Parameters:
- // pTarget [in] A pointer to the target function.
- MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget);
-
- // Enables an already created hook.
- // Parameters:
- // pTarget [in] A pointer to the target function.
- // If this parameter is MH_ALL_HOOKS, all created hooks are
- // enabled in one go.
- MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget);
-
- // Disables an already created hook.
- // Parameters:
- // pTarget [in] A pointer to the target function.
- // If this parameter is MH_ALL_HOOKS, all created hooks are
- // disabled in one go.
- MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget);
-
- // Queues to enable an already created hook.
- // Parameters:
- // pTarget [in] A pointer to the target function.
- // If this parameter is MH_ALL_HOOKS, all created hooks are
- // queued to be enabled.
- MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget);
-
- // Queues to disable an already created hook.
- // Parameters:
- // pTarget [in] A pointer to the target function.
- // If this parameter is MH_ALL_HOOKS, all created hooks are
- // queued to be disabled.
- MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget);
-
- // Applies all queued changes in one go.
- MH_STATUS WINAPI MH_ApplyQueued(VOID);
-
- // Translates the MH_STATUS to its name as a string.
- const char * WINAPI MH_StatusToString(MH_STATUS status);
-
-#ifdef __cplusplus
-}
-#endif
-
+/*
+ * MinHook - The Minimalistic API Hooking Library for x64/x86
+ * Copyright (C) 2009-2017 Tsuda Kageyu.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__)
+ #error MinHook supports only x86 and x64 systems.
+#endif
+
+#include <windows.h>
+
+// MinHook Error Codes.
+typedef enum MH_STATUS
+{
+ // Unknown error. Should not be returned.
+ MH_UNKNOWN = -1,
+
+ // Successful.
+ MH_OK = 0,
+
+ // MinHook is already initialized.
+ MH_ERROR_ALREADY_INITIALIZED,
+
+ // MinHook is not initialized yet, or already uninitialized.
+ MH_ERROR_NOT_INITIALIZED,
+
+ // The hook for the specified target function is already created.
+ MH_ERROR_ALREADY_CREATED,
+
+ // The hook for the specified target function is not created yet.
+ MH_ERROR_NOT_CREATED,
+
+ // The hook for the specified target function is already enabled.
+ MH_ERROR_ENABLED,
+
+ // The hook for the specified target function is not enabled yet, or already
+ // disabled.
+ MH_ERROR_DISABLED,
+
+ // The specified pointer is invalid. It points the address of non-allocated
+ // and/or non-executable region.
+ MH_ERROR_NOT_EXECUTABLE,
+
+ // The specified target function cannot be hooked.
+ MH_ERROR_UNSUPPORTED_FUNCTION,
+
+ // Failed to allocate memory.
+ MH_ERROR_MEMORY_ALLOC,
+
+ // Failed to change the memory protection.
+ MH_ERROR_MEMORY_PROTECT,
+
+ // The specified module is not loaded.
+ MH_ERROR_MODULE_NOT_FOUND,
+
+ // The specified function is not found.
+ MH_ERROR_FUNCTION_NOT_FOUND
+}
+MH_STATUS;
+
+// Can be passed as a parameter to MH_EnableHook, MH_DisableHook,
+// MH_QueueEnableHook or MH_QueueDisableHook.
+#define MH_ALL_HOOKS NULL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ // Initialize the MinHook library. You must call this function EXACTLY ONCE
+ // at the beginning of your program.
+ MH_STATUS WINAPI MH_Initialize(VOID);
+
+ // Uninitialize the MinHook library. You must call this function EXACTLY
+ // ONCE at the end of your program.
+ MH_STATUS WINAPI MH_Uninitialize(VOID);
+
+ // Creates a Hook for the specified target function, in disabled state.
+ // Parameters:
+ // pTarget [in] A pointer to the target function, which will be
+ // overridden by the detour function.
+ // pDetour [in] A pointer to the detour function, which will override
+ // the target function.
+ // ppOriginal [out] A pointer to the trampoline function, which will be
+ // used to call the original target function.
+ // This parameter can be NULL.
+ MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal);
+
+ // Creates a Hook for the specified API function, in disabled state.
+ // Parameters:
+ // pszModule [in] A pointer to the loaded module name which contains the
+ // target function.
+ // pszTarget [in] A pointer to the target function name, which will be
+ // overridden by the detour function.
+ // pDetour [in] A pointer to the detour function, which will override
+ // the target function.
+ // ppOriginal [out] A pointer to the trampoline function, which will be
+ // used to call the original target function.
+ // This parameter can be NULL.
+ MH_STATUS WINAPI MH_CreateHookApi(
+ LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal);
+
+ // Creates a Hook for the specified API function, in disabled state.
+ // Parameters:
+ // pszModule [in] A pointer to the loaded module name which contains the
+ // target function.
+ // pszTarget [in] A pointer to the target function name, which will be
+ // overridden by the detour function.
+ // pDetour [in] A pointer to the detour function, which will override
+ // the target function.
+ // ppOriginal [out] A pointer to the trampoline function, which will be
+ // used to call the original target function.
+ // This parameter can be NULL.
+ // ppTarget [out] A pointer to the target function, which will be used
+ // with other functions.
+ // This parameter can be NULL.
+ MH_STATUS WINAPI MH_CreateHookApiEx(
+ LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget);
+
+ // Removes an already created hook.
+ // Parameters:
+ // pTarget [in] A pointer to the target function.
+ MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget);
+
+ // Enables an already created hook.
+ // Parameters:
+ // pTarget [in] A pointer to the target function.
+ // If this parameter is MH_ALL_HOOKS, all created hooks are
+ // enabled in one go.
+ MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget);
+
+ // Disables an already created hook.
+ // Parameters:
+ // pTarget [in] A pointer to the target function.
+ // If this parameter is MH_ALL_HOOKS, all created hooks are
+ // disabled in one go.
+ MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget);
+
+ // Queues to enable an already created hook.
+ // Parameters:
+ // pTarget [in] A pointer to the target function.
+ // If this parameter is MH_ALL_HOOKS, all created hooks are
+ // queued to be enabled.
+ MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget);
+
+ // Queues to disable an already created hook.
+ // Parameters:
+ // pTarget [in] A pointer to the target function.
+ // If this parameter is MH_ALL_HOOKS, all created hooks are
+ // queued to be disabled.
+ MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget);
+
+ // Applies all queued changes in one go.
+ MH_STATUS WINAPI MH_ApplyQueued(VOID);
+
+ // Translates the MH_STATUS to its name as a string.
+ const char * WINAPI MH_StatusToString(MH_STATUS status);
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/loader_wsock32_proxy/include/MinHook.x64.lib b/loader_wsock32_proxy/include/MinHook.x64.lib
index 213df08f..a346f386 100644
--- a/loader_wsock32_proxy/include/MinHook.x64.lib
+++ b/loader_wsock32_proxy/include/MinHook.x64.lib
Binary files differ
diff --git a/loader_wsock32_proxy/loader.cpp b/loader_wsock32_proxy/loader.cpp
index 663f1f7b..34a4b546 100644
--- a/loader_wsock32_proxy/loader.cpp
+++ b/loader_wsock32_proxy/loader.cpp
@@ -1,93 +1,93 @@
-#include "pch.h"
-#include "loader.h"
-#include "include/MinHook.h"
-#include <string>
-#include <system_error>
-#include <sstream>
-#include <fstream>
-#include <filesystem>
-
-void LibraryLoadError(DWORD dwMessageId, const wchar_t* libName, const wchar_t* location)
-{
- char text[4096];
- std::string message = std::system_category().message(dwMessageId);
- sprintf_s(text, "Failed to load the %ls at \"%ls\" (%lu):\n\n%hs", libName, location, dwMessageId, message.c_str());
- if (dwMessageId == 126 && std::filesystem::exists(location))
- {
- sprintf_s(text, "%s\n\nThe file at the specified location DOES exist, so this error indicates that one of its *dependencies* failed to be found.", text);
- }
- MessageBoxA(GetForegroundWindow(), text, "Northstar Wsock32 Proxy Error", 0);
-}
-
-bool ShouldLoadNorthstar()
-{
- bool loadNorthstar = strstr(GetCommandLineA(), "-northstar");
-
- if (loadNorthstar)
- return loadNorthstar;
-
- auto runNorthstarFile = std::ifstream("run_northstar.txt");
- if (runNorthstarFile)
- {
- std::stringstream runNorthstarFileBuffer;
- runNorthstarFileBuffer << runNorthstarFile.rdbuf();
- runNorthstarFile.close();
- if (!runNorthstarFileBuffer.str()._Starts_with("0"))
- loadNorthstar = true;
- }
- return loadNorthstar;
-}
-
-bool LoadNorthstar()
-{
- FARPROC Hook_Init = nullptr;
- {
- swprintf_s(buffer1, L"%s\\Northstar.dll", exePath);
- auto hHookModule = LoadLibraryExW(buffer1, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
- if (hHookModule) Hook_Init = GetProcAddress(hHookModule, "InitialiseNorthstar");
- if (!hHookModule || Hook_Init == nullptr)
- {
- LibraryLoadError(GetLastError(), L"Northstar.dll", buffer1);
- return false;
- }
- }
-
- ((bool (*)()) Hook_Init)();
- return true;
-}
-
-typedef int(*LauncherMainType)(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
-LauncherMainType LauncherMainOriginal;
-
-int LauncherMainHook(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
-{
- if (ShouldLoadNorthstar())
- LoadNorthstar();
- return LauncherMainOriginal(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
-}
-
-bool ProvisionNorthstar()
-{
- if (!ShouldLoadNorthstar())
- return true;
-
- if (MH_Initialize() != MH_OK)
- {
- MessageBoxA(GetForegroundWindow(), "MH_Initialize failed\nThe game cannot continue and has to exit.", "Northstar Wsock32 Proxy Error", 0);
- return false;
- }
-
- auto launcherHandle = GetModuleHandleA("launcher.dll");
- if (!launcherHandle)
- {
- MessageBoxA(GetForegroundWindow(), "Launcher isn't loaded yet.\nThe game cannot continue and has to exit.", "Northstar Wsock32 Proxy Error", 0);
- return false;
- }
-
- LPVOID pTarget = GetProcAddress(launcherHandle, "LauncherMain");
- if (MH_CreateHook(pTarget, &LauncherMainHook, reinterpret_cast<LPVOID*>(&LauncherMainOriginal)) != MH_OK || MH_EnableHook(pTarget) != MH_OK)
- MessageBoxA(
- GetForegroundWindow(), "Hook creation failed for function LauncherMain.", "Northstar Wsock32 Proxy Error", 0);
-
- return true;
-} \ No newline at end of file
+#include "pch.h"
+#include "loader.h"
+#include "include/MinHook.h"
+#include <string>
+#include <system_error>
+#include <sstream>
+#include <fstream>
+#include <filesystem>
+
+void LibraryLoadError(DWORD dwMessageId, const wchar_t* libName, const wchar_t* location)
+{
+ char text[4096];
+ std::string message = std::system_category().message(dwMessageId);
+ sprintf_s(text, "Failed to load the %ls at \"%ls\" (%lu):\n\n%hs", libName, location, dwMessageId, message.c_str());
+ if (dwMessageId == 126 && std::filesystem::exists(location))
+ {
+ sprintf_s(text, "%s\n\nThe file at the specified location DOES exist, so this error indicates that one of its *dependencies* failed to be found.", text);
+ }
+ MessageBoxA(GetForegroundWindow(), text, "Northstar Wsock32 Proxy Error", 0);
+}
+
+bool ShouldLoadNorthstar()
+{
+ bool loadNorthstar = strstr(GetCommandLineA(), "-northstar");
+
+ if (loadNorthstar)
+ return loadNorthstar;
+
+ auto runNorthstarFile = std::ifstream("run_northstar.txt");
+ if (runNorthstarFile)
+ {
+ std::stringstream runNorthstarFileBuffer;
+ runNorthstarFileBuffer << runNorthstarFile.rdbuf();
+ runNorthstarFile.close();
+ if (!runNorthstarFileBuffer.str()._Starts_with("0"))
+ loadNorthstar = true;
+ }
+ return loadNorthstar;
+}
+
+bool LoadNorthstar()
+{
+ FARPROC Hook_Init = nullptr;
+ {
+ swprintf_s(buffer1, L"%s\\Northstar.dll", exePath);
+ auto hHookModule = LoadLibraryExW(buffer1, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
+ if (hHookModule) Hook_Init = GetProcAddress(hHookModule, "InitialiseNorthstar");
+ if (!hHookModule || Hook_Init == nullptr)
+ {
+ LibraryLoadError(GetLastError(), L"Northstar.dll", buffer1);
+ return false;
+ }
+ }
+
+ ((bool (*)()) Hook_Init)();
+ return true;
+}
+
+typedef int(*LauncherMainType)(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
+LauncherMainType LauncherMainOriginal;
+
+int LauncherMainHook(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
+{
+ if (ShouldLoadNorthstar())
+ LoadNorthstar();
+ return LauncherMainOriginal(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
+}
+
+bool ProvisionNorthstar()
+{
+ if (!ShouldLoadNorthstar())
+ return true;
+
+ if (MH_Initialize() != MH_OK)
+ {
+ MessageBoxA(GetForegroundWindow(), "MH_Initialize failed\nThe game cannot continue and has to exit.", "Northstar Wsock32 Proxy Error", 0);
+ return false;
+ }
+
+ auto launcherHandle = GetModuleHandleA("launcher.dll");
+ if (!launcherHandle)
+ {
+ MessageBoxA(GetForegroundWindow(), "Launcher isn't loaded yet.\nThe game cannot continue and has to exit.", "Northstar Wsock32 Proxy Error", 0);
+ return false;
+ }
+
+ LPVOID pTarget = GetProcAddress(launcherHandle, "LauncherMain");
+ if (MH_CreateHook(pTarget, &LauncherMainHook, reinterpret_cast<LPVOID*>(&LauncherMainOriginal)) != MH_OK || MH_EnableHook(pTarget) != MH_OK)
+ MessageBoxA(
+ GetForegroundWindow(), "Hook creation failed for function LauncherMain.", "Northstar Wsock32 Proxy Error", 0);
+
+ return true;
+}
diff --git a/loader_wsock32_proxy/loader.h b/loader_wsock32_proxy/loader.h
index e5b4c51d..0c6fb053 100644
--- a/loader_wsock32_proxy/loader.h
+++ b/loader_wsock32_proxy/loader.h
@@ -1,9 +1,9 @@
-#pragma once
-
-extern wchar_t exePath[4096];
-extern wchar_t buffer1[8192];
-extern wchar_t buffer2[12288];
-
-void LibraryLoadError(DWORD dwMessageId, const wchar_t* libName, const wchar_t* location);
-bool ShouldLoadNorthstar();
-bool ProvisionNorthstar();
+#pragma once
+
+extern wchar_t exePath[4096];
+extern wchar_t buffer1[8192];
+extern wchar_t buffer2[12288];
+
+void LibraryLoadError(DWORD dwMessageId, const wchar_t* libName, const wchar_t* location);
+bool ShouldLoadNorthstar();
+bool ProvisionNorthstar();
diff --git a/loader_wsock32_proxy/loader_wsock32_proxy.vcxproj b/loader_wsock32_proxy/loader_wsock32_proxy.vcxproj
index 2b257de8..ea7f955b 100644
--- a/loader_wsock32_proxy/loader_wsock32_proxy.vcxproj
+++ b/loader_wsock32_proxy/loader_wsock32_proxy.vcxproj
@@ -1,120 +1,120 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <VCProjectVersion>16.0</VCProjectVersion>
- <Keyword>Win32Proj</Keyword>
- <ProjectGuid>{cf55f3b5-f348-450a-9ccb-c269f21d629d}</ProjectGuid>
- <RootNamespace>loaderwsock32proxy</RootNamespace>
- <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v143</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v143</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <LinkIncremental>true</LinkIncremental>
- <TargetName>wsock32</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <LinkIncremental>false</LinkIncremental>
- <TargetName>wsock32</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>_DEBUG;LOADERWSOCK32PROXY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- <LanguageStandard>stdcpp17</LanguageStandard>
- <AdditionalIncludeDirectories>..\NorthstarDedicatedTest\</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableUAC>false</EnableUAC>
- <ModuleDefinitionFile>wsock32.def</ModuleDefinitionFile>
- <AdditionalDependencies>.\include\MinHook.x64.lib;mswsock.lib;ws2_32.lib;Shlwapi.lib;imagehlp.lib;dbghelp.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>NDEBUG;LOADERWSOCK32PROXY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- <AdditionalIncludeDirectories>..\NorthstarDedicatedTest\</AdditionalIncludeDirectories>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableUAC>false</EnableUAC>
- <ModuleDefinitionFile>wsock32.def</ModuleDefinitionFile>
- <AdditionalDependencies>.\include\MinHook.x64.lib;mswsock.lib;ws2_32.lib;Shlwapi.lib;imagehlp.lib;dbghelp.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;wsock32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\MinHook.h" />
- <ClInclude Include="loader.h" />
- <ClInclude Include="pch.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="dllmain.cpp" />
- <ClCompile Include="loader.cpp" />
- <ClCompile Include="pch.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <MASM Include="wsock32.asm" />
- </ItemGroup>
- <ItemGroup>
- <None Include="wsock32.def" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
- </ImportGroup>
-</Project> \ No newline at end of file
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>16.0</VCProjectVersion>
+ <Keyword>Win32Proj</Keyword>
+ <ProjectGuid>{cf55f3b5-f348-450a-9ccb-c269f21d629d}</ProjectGuid>
+ <RootNamespace>loaderwsock32proxy</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <TargetName>wsock32</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <TargetName>wsock32</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>_DEBUG;LOADERWSOCK32PROXY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+ <LanguageStandard>stdcpp17</LanguageStandard>
+ <AdditionalIncludeDirectories>..\NorthstarDedicatedTest\</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableUAC>false</EnableUAC>
+ <ModuleDefinitionFile>wsock32.def</ModuleDefinitionFile>
+ <AdditionalDependencies>.\include\MinHook.x64.lib;mswsock.lib;ws2_32.lib;Shlwapi.lib;imagehlp.lib;dbghelp.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>NDEBUG;LOADERWSOCK32PROXY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+ <AdditionalIncludeDirectories>..\NorthstarDedicatedTest\</AdditionalIncludeDirectories>
+ <LanguageStandard>stdcpp17</LanguageStandard>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableUAC>false</EnableUAC>
+ <ModuleDefinitionFile>wsock32.def</ModuleDefinitionFile>
+ <AdditionalDependencies>.\include\MinHook.x64.lib;mswsock.lib;ws2_32.lib;Shlwapi.lib;imagehlp.lib;dbghelp.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;wsock32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="include\MinHook.h" />
+ <ClInclude Include="loader.h" />
+ <ClInclude Include="pch.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="dllmain.cpp" />
+ <ClCompile Include="loader.cpp" />
+ <ClCompile Include="pch.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <MASM Include="wsock32.asm" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="wsock32.def" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
+ </ImportGroup>
+</Project>
diff --git a/loader_wsock32_proxy/loader_wsock32_proxy.vcxproj.filters b/loader_wsock32_proxy/loader_wsock32_proxy.vcxproj.filters
index 4c6b1ba1..82093e4f 100644
--- a/loader_wsock32_proxy/loader_wsock32_proxy.vcxproj.filters
+++ b/loader_wsock32_proxy/loader_wsock32_proxy.vcxproj.filters
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- <Filter Include="Header Files\include">
- <UniqueIdentifier>{1b1575f7-3332-478b-9e85-9c0978249a70}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="pch.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="loader.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="include\MinHook.h">
- <Filter>Header Files\include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="dllmain.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="pch.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="loader.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <MASM Include="wsock32.asm">
- <Filter>Source Files</Filter>
- </MASM>
- </ItemGroup>
- <ItemGroup>
- <None Include="wsock32.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
-</Project> \ No newline at end of file
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ <Filter Include="Header Files\include">
+ <UniqueIdentifier>{1b1575f7-3332-478b-9e85-9c0978249a70}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="pch.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="loader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\MinHook.h">
+ <Filter>Header Files\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="dllmain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="pch.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="loader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <MASM Include="wsock32.asm">
+ <Filter>Source Files</Filter>
+ </MASM>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="wsock32.def">
+ <Filter>Source Files</Filter>
+ </None>
+ </ItemGroup>
+</Project>
diff --git a/loader_wsock32_proxy/pch.cpp b/loader_wsock32_proxy/pch.cpp
index 91c22df2..64b7eef6 100644
--- a/loader_wsock32_proxy/pch.cpp
+++ b/loader_wsock32_proxy/pch.cpp
@@ -1,5 +1,5 @@
-// pch.cpp: source file corresponding to the pre-compiled header
-
-#include "pch.h"
-
-// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
+// pch.cpp: source file corresponding to the pre-compiled header
+
+#include "pch.h"
+
+// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
diff --git a/loader_wsock32_proxy/pch.h b/loader_wsock32_proxy/pch.h
index 3e02bcde..0103ff59 100644
--- a/loader_wsock32_proxy/pch.h
+++ b/loader_wsock32_proxy/pch.h
@@ -1,16 +1,16 @@
-// pch.h: This is a precompiled header file.
-// Files listed below are compiled only once, improving build performance for future builds.
-// This also affects IntelliSense performance, including code completion and many code browsing features.
-// However, files listed here are ALL re-compiled if any one of them is updated between builds.
-// Do not add files here that you will be updating frequently as this negates the performance advantage.
-
-#ifndef PCH_H
-#define PCH_H
-
-#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
+// pch.h: This is a precompiled header file.
+// Files listed below are compiled only once, improving build performance for future builds.
+// This also affects IntelliSense performance, including code completion and many code browsing features.
+// However, files listed here are ALL re-compiled if any one of them is updated between builds.
+// Do not add files here that you will be updating frequently as this negates the performance advantage.
+
+#ifndef PCH_H
+#define PCH_H
+
+#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
diff --git a/loader_wsock32_proxy/wsock32.asm b/loader_wsock32_proxy/wsock32.asm
index c5f63c1b..22a9c384 100644
--- a/loader_wsock32_proxy/wsock32.asm
+++ b/loader_wsock32_proxy/wsock32.asm
@@ -1,7 +1,7 @@
-.data
-extern PA : qword
-.code
-RunASM proc
-jmp qword ptr [PA]
-RunASM endp
-end
+.data
+extern PA : qword
+.code
+RunASM proc
+jmp qword ptr [PA]
+RunASM endp
+end
diff --git a/loader_wsock32_proxy/wsock32.def b/loader_wsock32_proxy/wsock32.def
index 119a886b..448440b4 100644
--- a/loader_wsock32_proxy/wsock32.def
+++ b/loader_wsock32_proxy/wsock32.def
@@ -1,78 +1,78 @@
-LIBRARY wsock32
-EXPORTS
- AcceptEx=mswsock.AcceptEx
- EnumProtocolsA=PROXY_EnumProtocolsA
- EnumProtocolsW=PROXY_EnumProtocolsW
- GetAcceptExSockaddrs=mswsock.GetAcceptExSockaddrs
- GetAddressByNameA=PROXY_GetAddressByNameA
- GetAddressByNameW=PROXY_GetAddressByNameW
- GetNameByTypeA=ws2_32.GetNameByTypeA
- GetNameByTypeW=ws2_32.GetNameByTypeW
- GetServiceA=ws2_32.GetServiceA
- GetServiceW=ws2_32.GetServiceW
- GetTypeByNameA=ws2_32.GetTypeByNameA
- GetTypeByNameW=ws2_32.GetTypeByNameW
- MigrateWinsockConfiguration=ws2_32.MigrateWinsockConfiguration
- NPLoadNameSpaces=ws2_32.NPLoadNameSpaces
- SetServiceA=ws2_32.SetServiceA
- SetServiceW=ws2_32.SetServiceW
- TransmitFile=mswsock.TransmitFile
- WEP=PROXY_WEP
- WSAAsyncGetHostByAddr=ws2_32.WSAAsyncGetHostByAddr
- WSAAsyncGetHostByName=ws2_32.WSAAsyncGetHostByName
- WSAAsyncGetProtoByName=ws2_32.WSAAsyncGetProtoByName
- WSAAsyncGetProtoByNumber=ws2_32.WSAAsyncGetProtoByNumber
- WSAAsyncGetServByName=ws2_32.WSAAsyncGetServByName
- WSAAsyncGetServByPort=ws2_32.WSAAsyncGetServByPort
- WSAAsyncSelect=ws2_32.WSAAsyncSelect
- WSACancelAsyncRequest=ws2_32.WSACancelAsyncRequest
- WSACancelBlockingCall=ws2_32.WSACancelBlockingCall
- WSACleanup=ws2_32.WSACleanup @116
- WSAGetLastError=ws2_32.WSAGetLastError @111
- WSAIsBlocking=ws2_32.WSAIsBlocking
- WSARecvEx=PROXY_WSARecvEx
- WSASetBlockingHook=ws2_32.WSASetBlockingHook
- WSASetLastError=ws2_32.WSASetLastError @112
- WSAStartup=ws2_32.WSAStartup @115
- WSAUnhookBlockingHook=ws2_32.WSAUnhookBlockingHook
- WSApSetPostRoutine=ws2_32.WSApSetPostRoutine
- __WSAFDIsSet=PROXY___WSAFDIsSet @151
- accept=ws2_32.accept @1
- bind=ws2_32.bind @2
- closesocket=ws2_32.closesocket @3
- connect=ws2_32.connect @4
- dn_expand=ws2_32.dn_expand @1106
- gethostbyaddr=ws2_32.gethostbyaddr
- gethostbyname=ws2_32.gethostbyname @52
- gethostname=ws2_32.gethostname @57
- getnetbyname=PROXY_getnetbyname @ 1101
- getpeername=ws2_32.getpeername @5
- getprotobyname=ws2_32.getprotobyname
- getprotobynumber=ws2_32.getprotobynumber
- getservbyname=ws2_32.getservbyname
- getservbyport=ws2_32.getservbyport
- getsockname=ws2_32.getsockname @6
- getsockopt=PROXY_getsockopt @7
- htonl=ws2_32.htonl
- htons=ws2_32.htons @9
- inet_addr=ws2_32.inet_addr
- inet_network=PROXY_inet_network
- inet_ntoa=ws2_32.inet_ntoa
- ioctlsocket=ws2_32.ioctlsocket @12
- listen=ws2_32.listen @13
- ntohl=ws2_32.ntohl
- ntohs=ws2_32.ntohs @15
- rcmd=ws2_32.rcmd
- recv=ws2_32.recv @16
- recvfrom=ws2_32.recvfrom @17
- rexec=ws2_32.rexec
- rresvport=ws2_32.rresvport
- s_perror=PROXY_s_perror
- select=ws2_32.select @18
- select=ws2_32.select @18
- send=ws2_32.send @19
- sendto=ws2_32.sendto @20
- sethostname=ws2_32.sethostname
- setsockopt=PROXY_setsockopt @21
- shutdown=ws2_32.shutdown @22
- socket=ws2_32.socket @23
+LIBRARY wsock32
+EXPORTS
+ AcceptEx=mswsock.AcceptEx
+ EnumProtocolsA=PROXY_EnumProtocolsA
+ EnumProtocolsW=PROXY_EnumProtocolsW
+ GetAcceptExSockaddrs=mswsock.GetAcceptExSockaddrs
+ GetAddressByNameA=PROXY_GetAddressByNameA
+ GetAddressByNameW=PROXY_GetAddressByNameW
+ GetNameByTypeA=ws2_32.GetNameByTypeA
+ GetNameByTypeW=ws2_32.GetNameByTypeW
+ GetServiceA=ws2_32.GetServiceA
+ GetServiceW=ws2_32.GetServiceW
+ GetTypeByNameA=ws2_32.GetTypeByNameA
+ GetTypeByNameW=ws2_32.GetTypeByNameW
+ MigrateWinsockConfiguration=ws2_32.MigrateWinsockConfiguration
+ NPLoadNameSpaces=ws2_32.NPLoadNameSpaces
+ SetServiceA=ws2_32.SetServiceA
+ SetServiceW=ws2_32.SetServiceW
+ TransmitFile=mswsock.TransmitFile
+ WEP=PROXY_WEP
+ WSAAsyncGetHostByAddr=ws2_32.WSAAsyncGetHostByAddr
+ WSAAsyncGetHostByName=ws2_32.WSAAsyncGetHostByName
+ WSAAsyncGetProtoByName=ws2_32.WSAAsyncGetProtoByName
+ WSAAsyncGetProtoByNumber=ws2_32.WSAAsyncGetProtoByNumber
+ WSAAsyncGetServByName=ws2_32.WSAAsyncGetServByName
+ WSAAsyncGetServByPort=ws2_32.WSAAsyncGetServByPort
+ WSAAsyncSelect=ws2_32.WSAAsyncSelect
+ WSACancelAsyncRequest=ws2_32.WSACancelAsyncRequest
+ WSACancelBlockingCall=ws2_32.WSACancelBlockingCall
+ WSACleanup=ws2_32.WSACleanup @116
+ WSAGetLastError=ws2_32.WSAGetLastError @111
+ WSAIsBlocking=ws2_32.WSAIsBlocking
+ WSARecvEx=PROXY_WSARecvEx
+ WSASetBlockingHook=ws2_32.WSASetBlockingHook
+ WSASetLastError=ws2_32.WSASetLastError @112
+ WSAStartup=ws2_32.WSAStartup @115
+ WSAUnhookBlockingHook=ws2_32.WSAUnhookBlockingHook
+ WSApSetPostRoutine=ws2_32.WSApSetPostRoutine
+ __WSAFDIsSet=PROXY___WSAFDIsSet @151
+ accept=ws2_32.accept @1
+ bind=ws2_32.bind @2
+ closesocket=ws2_32.closesocket @3
+ connect=ws2_32.connect @4
+ dn_expand=ws2_32.dn_expand @1106
+ gethostbyaddr=ws2_32.gethostbyaddr
+ gethostbyname=ws2_32.gethostbyname @52
+ gethostname=ws2_32.gethostname @57
+ getnetbyname=PROXY_getnetbyname @ 1101
+ getpeername=ws2_32.getpeername @5
+ getprotobyname=ws2_32.getprotobyname
+ getprotobynumber=ws2_32.getprotobynumber
+ getservbyname=ws2_32.getservbyname
+ getservbyport=ws2_32.getservbyport
+ getsockname=ws2_32.getsockname @6
+ getsockopt=PROXY_getsockopt @7
+ htonl=ws2_32.htonl
+ htons=ws2_32.htons @9
+ inet_addr=ws2_32.inet_addr
+ inet_network=PROXY_inet_network
+ inet_ntoa=ws2_32.inet_ntoa
+ ioctlsocket=ws2_32.ioctlsocket @12
+ listen=ws2_32.listen @13
+ ntohl=ws2_32.ntohl
+ ntohs=ws2_32.ntohs @15
+ rcmd=ws2_32.rcmd
+ recv=ws2_32.recv @16
+ recvfrom=ws2_32.recvfrom @17
+ rexec=ws2_32.rexec
+ rresvport=ws2_32.rresvport
+ s_perror=PROXY_s_perror
+ select=ws2_32.select @18
+ select=ws2_32.select @18
+ send=ws2_32.send @19
+ sendto=ws2_32.sendto @20
+ sethostname=ws2_32.sethostname
+ setsockopt=PROXY_setsockopt @21
+ shutdown=ws2_32.shutdown @22
+ socket=ws2_32.socket @23