Skip to content

Commit

Permalink
fixed hook_FindFirstFileExW() not handling trailing slashes
Browse files Browse the repository at this point in the history
updated boost to 1.72
bumped to 4.4.7
  • Loading branch information
isanae committed Apr 17, 2020
1 parent 5666ce2 commit edcb0ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/usvfs_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define USVFS_VERSION_MAJOR 0
#define USVFS_VERSION_MINOR 4
#define USVFS_VERSION_BUILD 4
#define USVFS_VERSION_REVISION 6
#define USVFS_VERSION_REVISION 7

#define USVFS_BUILD_STRING ""
#define USVFS_BUILD_WSTRING L""
Expand Down
11 changes: 11 additions & 0 deletions src/usvfs_dll/hooks/kernel32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,17 @@ HANDLE WINAPI usvfs::hook_FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVEL
return res;
}

// FindFirstFileEx() must fail early if the path ends with a slash
if (lpFileName) {
const auto len = wcslen(lpFileName);
if (len > 0) {
if (lpFileName[len - 1] == L'\\' || lpFileName[len - 1] == L'/') {
spdlog::get("usvfs")->warn("hook_FindFirstFileExW(): path '{}' ends with slash, always fails", fs::path(lpFileName).string());
return INVALID_HANDLE_VALUE;
}
}
}

fs::path finalPath;
RerouteW reroute;
fs::path originalPath;
Expand Down
2 changes: 1 addition & 1 deletion vsbuild/external_dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Import Project="external_dependencies_local.props" Condition="Exists('external_dependencies_local.props')"/>
</ImportGroup>
<PropertyGroup Label="UserMacros">
<BOOST_PATH Condition="'$(BOOST_PATH)'==''">..\..\boost_1_71_0</BOOST_PATH>
<BOOST_PATH Condition="'$(BOOST_PATH)'==''">..\..\boost_1_72_0</BOOST_PATH>
<BOOST_PATH Condition="'$(BOOST_PATH)'!=''">$(BOOST_PATH)</BOOST_PATH>
<GTEST_PATH Condition="'$(GTEST_PATH)'==''">..\..\googletest</GTEST_PATH>
</PropertyGroup>
Expand Down

0 comments on commit edcb0ef

Please sign in to comment.