// On success, GetModuleFileNameW() doesn't reset last error to ERROR_SUCCESS. Resetting it manually.
boost::winapi::GetLastError(); // HERE
// If `handle` parameter is NULL, GetModuleFileName retrieves the path of the
// executable file of the current process.
boost::winapi::WCHAR_ path_hldr[DEFAULT_PATH_SIZE_];
boost::winapi::GetModuleFileNameW(handle, path_hldr, DEFAULT_PATH_SIZE_);
ec = boost::dll::detail::last_error_code();
if (!ec) {
return boost::filesystem::path(path_hldr);
}
So this really confuses me. AFAIK GetLastError() function only gets the last error, it doesn't reset it.
so it's here and the link is https://github.com/boostorg/dll/blob/a7f356119218a9a6d58fd5ea61cc6bc4c120ac9d/include/boost/dll/detail/windows/path_from_handle.hpp#L35
So this really confuses me. AFAIK GetLastError() function only gets the last error, it doesn't reset it.
What does
Resetting it manually.
mean?