diff --git a/source/lib/sysdep/os/win/wdll_ver.cpp b/source/lib/sysdep/os/win/wdll_ver.cpp index ff1b46659f..b3381fa1dd 100644 --- a/source/lib/sysdep/os/win/wdll_ver.cpp +++ b/source/lib/sysdep/os/win/wdll_ver.cpp @@ -45,8 +45,6 @@ static LibError ReadVersionString(const fs::wpath& modulePathname_, wchar_t* out_ver, size_t out_ver_len) { WinScopedPreserveLastError s; // GetFileVersion*, Ver* - WinScopedDisableWow64Redirection noRedirect; - const std::wstring modulePathname = modulePathname_.string(); // determine size of and allocate memory for version information. @@ -58,7 +56,7 @@ static LibError ReadVersionString(const fs::wpath& modulePathname_, wchar_t* out // (necessary since GetFileVersionInfoSize doesn't SetLastError) HMODULE hModule = LoadLibraryExW(modulePathname.c_str(), 0, LOAD_LIBRARY_AS_DATAFILE); if(!hModule) - WARN_RETURN(ERR::FAIL); // file not found + return ERR::FAIL; // NOWARN (file not found - due to FS redirection?) FreeLibrary(hModule); return ERR::NOT_SUPPORTED; // NOWARN (module apparently lacks version information) } @@ -98,11 +96,15 @@ void wdll_ver_Append(const fs::wpath& pathname, std::wstring& list) modulePathname = fs::change_extension(modulePathname, L".dll"); const std::wstring moduleName(modulePathname.leaf()); - // read file version. - // (note: we can ignore the return value since the default - // text has already been set) + // read file version. try this with and without FS redirection since + // pathname might assume both. wchar_t versionString[500] = L"unknown"; // enclosed in () below - (void)ReadVersionString(modulePathname, versionString, ARRAY_SIZE(versionString)); + if(ReadVersionString(modulePathname, versionString, ARRAY_SIZE(versionString)) != INFO::OK) + { + WinScopedDisableWow64Redirection s; + // if this still fails, we'll at least write the default "unknown" version. + (void)ReadVersionString(modulePathname, versionString, ARRAY_SIZE(versionString)); + } if(!list.empty()) list += L", "; diff --git a/source/ps/UserReport.cpp b/source/ps/UserReport.cpp index e124661242..5f0241719c 100644 --- a/source/ps/UserReport.cpp +++ b/source/ps/UserReport.cpp @@ -438,8 +438,11 @@ private: // responsive to shutdown requests even if the network is pretty slow amount = std::min((size_t)1024, amount); - memcpy(bufptr, &self->m_RequestData[self->m_RequestDataOffset], amount); - self->m_RequestDataOffset += amount; + if(amount != 0) // (avoids invalid operator[] call where index=size) + { + memcpy(bufptr, &self->m_RequestData[self->m_RequestDataOffset], amount); + self->m_RequestDataOffset += amount; + } self->SetStatus("sending:" + CStr::FromDouble((double)self->m_RequestDataOffset / self->m_RequestData.size()));