Subject: [Boost-bugs] [Boost C++ Libraries] #13455: path_from_handle using GetModuleFileNameW in wrong way
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-02-21 14:42:31
#13455: path_from_handle using GetModuleFileNameW in wrong way
------------------------------+-----------------------------
Reporter: oleg.dolgov@⦠| Owner: Andrey Semashev
Type: Bugs | Status: new
Milestone: To Be Determined | Component: winapi
Version: Boost 1.66.0 | Severity: Problem
Keywords: |
------------------------------+-----------------------------
boost\dll\detail\windows\path_from_handle.hpp
{{{
boost::detail::winapi::GetModuleFileNameW(handle, path_hldr,
DEFAULT_PATH_SIZE_);
ec = last_error_code();
if (!ec) {
return boost::filesystem::path(path_hldr);
}
}}}
The problem here is that code doesn't analyze return code.
If GetLastError() was dirty before a call this code will fail even if
GetModuleFileNameW() will success.
Yes, on success, GetModuleFileNameW() doesn't reset last error to
ERROR_SUCCESS.
-- Ticket URL: <https://svn.boost.org/trac10/ticket/13455> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2018-02-21 14:48:03 UTC