summaryrefslogtreecommitdiff
path: root/zen/dst_hack.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2015-10-02 14:49:33 +0200
committerDaniel Wilhelm <daniel@wili.li>2015-10-02 14:49:33 +0200
commita6e9143baf48bdc093788545636570808f9c103c (patch)
treed223a9360134cd8105a96ee0faf5c2643bd9141b /zen/dst_hack.cpp
parent6.4 (diff)
downloadFreeFileSync-a6e9143baf48bdc093788545636570808f9c103c.tar.gz
FreeFileSync-a6e9143baf48bdc093788545636570808f9c103c.tar.bz2
FreeFileSync-a6e9143baf48bdc093788545636570808f9c103c.zip
6.5
Diffstat (limited to 'zen/dst_hack.cpp')
-rw-r--r--zen/dst_hack.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/zen/dst_hack.cpp b/zen/dst_hack.cpp
index 887b9b63..95fbe732 100644
--- a/zen/dst_hack.cpp
+++ b/zen/dst_hack.cpp
@@ -166,10 +166,10 @@ FILETIME utcToLocal(const FILETIME& utcTime) //throw std::runtime_error
&utcTime, //__in const FILETIME *lpFileTime,
&localTime)) //__out LPFILETIME lpLocalFileTime
{
- const std::wstring errorMsg = _("Conversion error:") + L" FILETIME -> local FILETIME: " + L"(" +
- L"High: " + numberTo<std::wstring>(utcTime.dwHighDateTime) + L" " +
- L"Low: " + numberTo<std::wstring>(utcTime.dwLowDateTime) + L") " + L"\n\n" + formatSystemError(L"FileTimeToLocalFileTime", getLastError());
- throw std::runtime_error(utfCvrtTo<std::string>(errorMsg));
+ const DWORD lastError = ::GetLastError(); //copy before directly or indirectly making other system calls!
+ throw std::runtime_error(utfCvrtTo<std::string>(_("Conversion error:") + L" FILETIME -> local FILETIME: " + L"(" +
+ L"High: " + numberTo<std::wstring>(utcTime.dwHighDateTime) + L" " +
+ L"Low: " + numberTo<std::wstring>(utcTime.dwLowDateTime) + L") " + L"\n\n" + formatSystemError(L"FileTimeToLocalFileTime", lastError)));
}
return localTime;
}
@@ -184,10 +184,10 @@ FILETIME localToUtc(const FILETIME& localTime) //throw std::runtime_error
&localTime, //__in const FILETIME *lpLocalFileTime,
&utcTime)) //__out LPFILETIME lpFileTime
{
- const std::wstring errorMsg = _("Conversion error:") + L" local FILETIME -> FILETIME: " + L"(" +
- L"High: " + numberTo<std::wstring>(localTime.dwHighDateTime) + L" " +
- L"Low: " + numberTo<std::wstring>(localTime.dwLowDateTime) + L") " + L"\n\n" + formatSystemError(L"LocalFileTimeToFileTime", getLastError());
- throw std::runtime_error(utfCvrtTo<std::string>(errorMsg));
+ const DWORD lastError = ::GetLastError(); //copy before directly or indirectly making other system calls!
+ throw std::runtime_error(utfCvrtTo<std::string>(_("Conversion error:") + L" local FILETIME -> FILETIME: " + L"(" +
+ L"High: " + numberTo<std::wstring>(localTime.dwHighDateTime) + L" " +
+ L"Low: " + numberTo<std::wstring>(localTime.dwLowDateTime) + L") " + L"\n\n" + formatSystemError(L"LocalFileTimeToFileTime", lastError)));
}
return utcTime;
}
bgstack15