aboutsummaryrefslogtreecommitdiff
path: root/loader_wsock32_proxy/loader.cpp
diff options
context:
space:
mode:
authorp0358 <p0358@users.noreply.github.com>2022-01-24 19:43:21 +0100
committerp0358 <p0358@users.noreply.github.com>2022-01-24 20:18:29 +0100
commit75d99e1a81bfbd0dbbaf0b1ace144a8156a47148 (patch)
tree6bac439914d9ed6108cea9b53217965c8786ca1c /loader_wsock32_proxy/loader.cpp
parentf31c452286cf8861f328b94b6b51c004a46984e0 (diff)
downloadNorthstarLauncher-75d99e1a81bfbd0dbbaf0b1ace144a8156a47148.tar.gz
NorthstarLauncher-75d99e1a81bfbd0dbbaf0b1ace144a8156a47148.zip
Misc improvements
Diffstat (limited to 'loader_wsock32_proxy/loader.cpp')
-rw-r--r--loader_wsock32_proxy/loader.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/loader_wsock32_proxy/loader.cpp b/loader_wsock32_proxy/loader.cpp
index 907caa9d..61b4daf3 100644
--- a/loader_wsock32_proxy/loader.cpp
+++ b/loader_wsock32_proxy/loader.cpp
@@ -5,12 +5,17 @@
#include <system_error>
#include <sstream>
#include <fstream>
+#include <filesystem>
void LibraryLoadError(DWORD dwMessageId, const wchar_t* libName, const wchar_t* location)
{
- char text[2048];
+ 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);
}
@@ -37,12 +42,12 @@ bool LoadNorthstar()
{
FARPROC Hook_Init = nullptr;
{
- swprintf_s(dllPath, L"%s\\Northstar.dll", exePath);
- auto hHookModule = LoadLibraryExW(dllPath, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
+ 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", dllPath);
+ LibraryLoadError(GetLastError(), L"Northstar.dll", buffer1);
return false;
}
}