Skip to content

Commit 7454a09

Browse files
authored
Merge pull request #34 from isanae/deletion-mapping
Don't map files that don't exist when deleting them
2 parents 4f617f9 + 6acd543 commit 7454a09

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

include/usvfs_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define USVFS_VERSION_MAJOR 0
44
#define USVFS_VERSION_MINOR 4
55
#define USVFS_VERSION_BUILD 4
6-
#define USVFS_VERSION_REVISION 7
6+
#define USVFS_VERSION_REVISION 8
77

88
#define USVFS_BUILD_STRING ""
99
#define USVFS_BUILD_WSTRING L""

src/usvfs_dll/hooks/kernel32.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,10 @@ BOOL WINAPI usvfs::hook_DeleteFileW(LPCWSTR lpFileName)
524524
}
525525
POST_REALCALL
526526

527-
reroute.removeMapping(READ_CONTEXT());
527+
if (res) {
528+
reroute.removeMapping(READ_CONTEXT());
529+
}
530+
528531
if (reroute.wasRerouted())
529532
LOG_CALL().PARAMWRAP(lpFileName).PARAMWRAP(reroute.fileName()).PARAM(res).PARAM(callContext.lastError());
530533

@@ -1137,7 +1140,10 @@ DLLEXPORT BOOL WINAPI usvfs::hook_RemoveDirectoryW(
11371140
}
11381141
POST_REALCALL
11391142

1140-
reroute.removeMapping(READ_CONTEXT(), true);
1143+
if (res) {
1144+
reroute.removeMapping(READ_CONTEXT(), true);
1145+
}
1146+
11411147
if (reroute.wasRerouted())
11421148
LOG_CALL().PARAMWRAP(lpPathName).PARAMWRAP(reroute.fileName()).PARAM(res).PARAM(callContext.lastError());
11431149

0 commit comments

Comments
 (0)