Skip to content

Commit de611de

Browse files
authored
Merge pull request #14 from ModOrganizer2/Develop
Stage for release 2.2.1
2 parents ee05b67 + 19421b8 commit de611de

32 files changed

+134
-113
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
url = https://github.com/fmtlib/fmt.git
1010
[submodule "spdlog"]
1111
path = spdlog
12-
url = https://github.com/TanninOne/spdlog.git
12+
url = https://github.com/gabime/spdlog.git

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
version: 1.0.{build}
2-
image: Visual Studio 2017
2+
image: Visual Studio 2019 Preview
33
configuration: Release
44
platform:
55
- x64
66
- x86
77
environment:
88
GTEST_PATH: C:\Libraries\googletest
9-
BOOST_PATH: C:\Libraries\boost_1_69_0
9+
BOOST_PATH: C:\Libraries\boost_1_70_0
1010
WEBHOOK_URL:
1111
secure: gOKbXaZM9ImtMD5XrYITvdyZUW/az082G9OIN1EC1VZ2CuYaUUM6WY2eiNxaFeOL7/9Jyu/m+Vm1fH54CEyigcUUaxA7d8F5IMWlOgE/7YYdaAFSMUTFD7EK+++3FBYfmU1F/nZ61wsiWE6hB9Au5FpGBSCeQ0Tf8U8m0ybPmD0=
1212
before_build:

include/usvfs_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#define USVFS_VERSION_MAJOR 0
44
#define USVFS_VERSION_MINOR 4
5-
#define USVFS_VERSION_BUILD 3
5+
#define USVFS_VERSION_BUILD 4
66
#define USVFS_VERSION_REVISION 0
77

88
#define USVFS_BUILD_STRING ""

spdlog

Submodule spdlog updated 132 files

src/shared/directory_tree.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,14 @@ class DirectoryTree
449449
if (auto par = parent()) {
450450
spdlog::get("usvfs")->info("remove from tree {}", m_Name.c_str());
451451
auto self = par->m_Nodes.find(m_Name.c_str());
452-
par->erase(self);
452+
if (self != par->m_Nodes.end()) {
453+
par->erase(self);
454+
}
455+
else {
456+
//trying to remove a node that des not exist, most likely because it was already removed in a lower level call.
457+
//this is known to happen when MoveFile has the MOVEFILE_COPY_ALLOWED flag and moving a mapped file.
458+
spdlog::get("usvfs")->warn("Failed to remove inexisting node from tree: {}", m_Name.c_str());
459+
}
453460
}
454461
}
455462

src/shared/shmlogger.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,13 @@ void spdlog::sinks::shm_sink::output(level::level_enum lev,
176176
switch (lev) {
177177
case level::trace:
178178
case level::debug:
179-
case level::notice: {
179+
case level::info: {
180180
// m_LogQueue.send(message.c_str(), count, 0);
181181
sent = m_LogQueue.try_send(message.c_str(),
182182
static_cast<unsigned int>(count), 0);
183183
} break;
184-
case level::alert:
185-
case level::critical:
186-
case level::emerg:
187-
case level::err: {
184+
case level::err:
185+
case level::critical: {
188186
m_LogQueue.send(message.c_str(), static_cast<unsigned int>(count), 0);
189187
} break;
190188
default: {

src/shared/shmlogger.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ along with usvfs. If not, see <http://www.gnu.org/licenses/>.
2727
#include <boost/format.hpp>
2828
#include <atomic>
2929
#include <spdlog.h>
30+
#include <fmt/ostr.h>
3031
#include <cstdint>
3132

3233
typedef boost::interprocess::message_queue_t<usvfs::shared::VoidPointerT> message_queue_interop;

src/usvfs_dll/hooks/kernel32.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ HMODULE WINAPI usvfs::hook_LoadLibraryExW(LPCWSTR lpFileName, HANDLE hFile,
139139
HMODULE res = nullptr;
140140

141141
HOOK_START_GROUP(MutExHookGroup::LOAD_LIBRARY)
142+
// Why is the usual if (!callContext.active()... check missing?
142143

143144
RerouteW reroute = RerouteW::create(READ_CONTEXT(), callContext, lpFileName);
144145
PRE_REALCALL
@@ -488,6 +489,7 @@ DWORD WINAPI usvfs::hook_SetFileAttributesW(
488489
DWORD res = 0UL;
489490

490491
HOOK_START_GROUP(MutExHookGroup::FILE_ATTRIBUTES)
492+
// Why is the usual if (!callContext.active()... check missing?
491493

492494
RerouteW reroute = RerouteW::create(READ_CONTEXT(), callContext, lpFileName);
493495
PRE_REALCALL
@@ -508,6 +510,7 @@ BOOL WINAPI usvfs::hook_DeleteFileW(LPCWSTR lpFileName)
508510
BOOL res = FALSE;
509511

510512
HOOK_START_GROUP(MutExHookGroup::DELETE_FILE)
513+
// Why is the usual if (!callContext.active()... check missing?
511514

512515
RerouteW reroute = RerouteW::create(READ_CONTEXT(), callContext, lpFileName);
513516

@@ -800,6 +803,9 @@ BOOL WINAPI usvfs::hook_MoveFileWithProgressA(LPCSTR lpExistingFileName, LPCSTR
800803

801804
BOOL WINAPI usvfs::hook_MoveFileWithProgressW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags)
802805
{
806+
807+
//TODO: Remove all redundant hooks to moveFile alternatives.
808+
//it would appear that all other moveFile functions end up calling this one with no additional code.
803809
BOOL res = FALSE;
804810

805811
HOOK_START_GROUP(MutExHookGroup::SHELL_FILEOP)
@@ -861,7 +867,9 @@ BOOL WINAPI usvfs::hook_MoveFileWithProgressW(LPCWSTR lpExistingFileName, LPCWST
861867
writeReroute.updateResult(callContext, res);
862868

863869
if (res) {
864-
readReroute.removeMapping(READ_CONTEXT(), isDirectory); // Updating the rerouteCreate to check deleted file entries should make this okay
870+
//TODO: this call causes the node to be removed twice in case of MOVEFILE_COPY_ALLOWED as the deleteFile hook lower level already takes care of it,
871+
//but deleteFile can't be disabled since we are relying on it in case of MOVEFILE_REPLACE_EXISTING for the destination file.
872+
readReroute.removeMapping(READ_CONTEXT(), isDirectory); // Updating the rerouteCreate to check deleted file entries should make this okay (not related to comments above)
865873

866874
if (writeReroute.newReroute()) {
867875
if (isDirectory)
@@ -1094,6 +1102,7 @@ DLLEXPORT BOOL WINAPI usvfs::hook_RemoveDirectoryW(
10941102
BOOL res = FALSE;
10951103

10961104
HOOK_START_GROUP(MutExHookGroup::DELETE_FILE)
1105+
// Why is the usual if (!callContext.active()... check missing?
10971106

10981107
RerouteW reroute = RerouteW::create(READ_CONTEXT(), callContext, lpPathName);
10991108

src/usvfs_dll/hooks/ntdll.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ NTSTATUS ntdll_mess_NtOpenFile(PHANDLE FileHandle,
10751075
NTSTATUS res = STATUS_NO_SUCH_FILE;
10761076

10771077
HOOK_START_GROUP(MutExHookGroup::OPEN_FILE)
1078+
// Why is the usual if (!callContext.active()... check missing?
10781079

10791080
bool storePath = false;
10801081
if (((OpenOptions & FILE_DIRECTORY_FILE) != 0UL)
@@ -1299,6 +1300,10 @@ NTSTATUS WINAPI usvfs::hook_NtClose(HANDLE Handle)
12991300
// std::lock_guard<std::recursive_mutex> lock(activeSearches.queryMutex);
13001301
auto iter = activeSearches.info.find(Handle);
13011302
if (iter != activeSearches.info.end()) {
1303+
if (iter->second.currentSearchHandle != INVALID_HANDLE_VALUE) {
1304+
::CloseHandle(iter->second.currentSearchHandle);
1305+
}
1306+
13021307
activeSearches.info.erase(iter);
13031308
log = true;
13041309
}
@@ -1340,6 +1345,7 @@ NTSTATUS WINAPI usvfs::hook_NtQueryAttributesFile(
13401345
NTSTATUS res = STATUS_SUCCESS;
13411346

13421347
HOOK_START_GROUP(MutExHookGroup::FILE_ATTRIBUTES)
1348+
// Why is the usual if (!callContext.active()... check missing?
13431349

13441350
UnicodeString inPath = CreateUnicodeString(ObjectAttributes);
13451351

src/usvfs_proxy/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ int main(int argc, char **argv) {
116116
exceptionDialog(__LINE__, 2, e.what(), e2.what());
117117
// no way to log this
118118
} catch (const std::exception &) {
119-
logger->critical() << e.what();
119+
logger->critical(e.what());
120120
}
121121
return 1;
122122
}
@@ -216,7 +216,7 @@ int main(int argc, char **argv) {
216216
// no way to log this
217217
exceptionDialog(__LINE__, 2, e.what(), e2.what());
218218
} catch (const std::exception &) {
219-
logger->critical() << e.what();
219+
logger->critical(e.what());
220220
}
221221
}
222222
}

0 commit comments

Comments
 (0)