Make the crash handler work on wine properly (#1636)

* add LoadMethod to DalamudStartInfo
* add to_wstring utility function
* append full injector launch args for VEH
* remove usage of std::chrono::zoned_time
* fix injector arguments in crash handler restart
* enable VEH on wine
* remove dead wine detection code
* write out tspack with std::fstream
* fix off-by-one error in get_window_string()
* remove usage of std::chrono when writing tspack
* do not deadlock on crashing DalamudCrashHandler
This commit is contained in:
marzent 2024-02-11 22:01:34 +01:00 committed by GitHub
parent 16bc6b86e5
commit 386e5f245c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 148 additions and 77 deletions

View file

@ -578,21 +578,14 @@ std::vector<std::string> utils::get_env_list(const wchar_t* pcszName) {
return res;
}
bool utils::is_running_on_wine() {
if (get_env<bool>(L"XL_WINEONLINUX"))
return true;
HMODULE hntdll = GetModuleHandleW(L"ntdll.dll");
if (!hntdll)
return true;
if (GetProcAddress(hntdll, "wine_get_version"))
return true;
if (GetProcAddress(hntdll, "wine_get_host_version"))
return true;
if (GetProcAddress(hntdll, "wine_server_call"))
return true;
if (GetProcAddress(hntdll, "wine_unix_to_nt_file_name"))
return true;
return false;
std::wstring utils::to_wstring(const std::string& str) {
if (str.empty()) return std::wstring();
size_t convertedChars = 0;
size_t newStrSize = str.size() + 1;
std::wstring wstr(newStrSize, L'\0');
mbstowcs_s(&convertedChars, &wstr[0], newStrSize, str.c_str(), _TRUNCATE);
wstr.resize(convertedChars - 1);
return wstr;
}
std::filesystem::path utils::get_module_path(HMODULE hModule) {