Skip to content

Commit

Permalink
fix: display redistributables warning on load error
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyTWF committed Aug 16, 2022
1 parent 98e9ee7 commit a37d810
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/loader/dllmain.cpp
Expand Up @@ -56,8 +56,15 @@ UKCP_LOADER_API void EuroScopePlugInInit(EuroScopePlugIn::CPlugIn** ppPlugInInst
UnloadPluginLibrary(pluginDllInstance, *windows);
std::wstring message = L"Unable to load the UKControllerPluginCore DLL.\r\n";
message += L"Please contact the VATSIM UK Web Services Department.\r\n\r\n";

auto lastError = GetLastError();
if (lastError == 126 || lastError == 127 || lastError == 128) {
message += L"Please ensure you have the latest version of the C++ Redistributables (2022) installed.";
message += L"\r\n\r\n";
}

message += L"Errno: " + std::to_wstring(errno) + L"\r\n";
message += L"LastError: " + std::to_wstring(GetLastError()) + L"\r\n";
message += L"LastError: " + std::to_wstring(lastError) + L"\r\n";

MessageBox(GetActiveWindow(), message.c_str(), L"UKCP Bootstrap Failed", MB_OK | MB_ICONSTOP);
throw std::exception("UKCP broke");
Expand Down

0 comments on commit a37d810

Please sign in to comment.