Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ICU loading on 1809 #1

Open
wants to merge 2 commits into
base: tz-windows
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/tz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,19 @@ namespace {
const HMODULE _Icu_Module, const HMODULE _IcuIn_Module, const HMODULE _IcuUc_Module,
_STD atomic<_Ty>& _Stored_Pfn, LPCSTR _Fn_name, DWORD& _Last_error) noexcept {
const HMODULE _icus[3] = {_Icu_Module, _IcuIn_Module, _IcuUc_Module};
DWORD last_error = E_FAIL;
for (int i = 0; i < 3; i++) {
if (_icus[i] == nullptr) break;
if (_icus[i] == nullptr) continue;
const auto _Pfn = reinterpret_cast<_Ty>(GetProcAddress(_icus[i], _Fn_name));
if (_Pfn != nullptr) {
_Stored_Pfn.store(_Pfn, _STD memory_order_relaxed);
last_error = S_OK;
break;
} else {
_Last_error = GetLastError();
last_error = GetLastError();
}
}
if (!SUCCEEDED(last_error)) _Last_error = last_error;
}

[[nodiscard]] _Icu_api_level _Init_icu_functions(_Icu_api_level _Level) noexcept {
Expand Down Expand Up @@ -481,7 +484,12 @@ namespace {
DWORD dwFVISize = GetFileVersionInfoSizeW(_Icu_DLL_Name.c_str(), &dwDummy);
LPBYTE lpVersionInfo = new BYTE[dwFVISize];
if (GetFileVersionInfoW(_Icu_DLL_Name.c_str(), 0, dwFVISize, lpVersionInfo) == 0) {
return _Level;
delete[] lpVersionInfo;
DWORD dwFVISize = GetFileVersionInfoSizeW(_IcuIn_DLL_Name.c_str(), &dwDummy);
lpVersionInfo = new BYTE[dwFVISize];
if (GetFileVersionInfoW(_IcuIn_DLL_Name.c_str(), 0, dwFVISize, lpVersionInfo) == 0) {
return _Level;
}
}

UINT uLen;
Expand Down