Skip to content

Commit

Permalink
Reimplement hook_NtCreateFile to allow it to create reroutes
Browse files Browse the repository at this point in the history
  • Loading branch information
LostDragonist committed Mar 18, 2019
1 parent 6d20cc3 commit 5df4a82
Show file tree
Hide file tree
Showing 10 changed files with 792 additions and 907 deletions.
1 change: 1 addition & 0 deletions src/shared/ntdll_declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ typedef struct _FILE_REPARSE_POINT_INFORMATION {
ULONG Tag;
} FILE_REPARSE_POINT_INFORMATION, *PFILE_REPARSE_POINT_INFORMATION;

// copied from ntstatus.h
#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
#define STATUS_BUFFER_OVERFLOW ((NTSTATUS)0x80000005L)
#define STATUS_NO_MORE_FILES ((NTSTATUS)0x80000006L)
Expand Down
2 changes: 2 additions & 0 deletions src/shared/stringcast_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with usvfs. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

#include <string>
#include <limits>
#include <boost/type_traits.hpp>
Expand Down
7 changes: 0 additions & 7 deletions src/usvfs_dll/hookmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,6 @@ void HookManager::initHooks()
installHook(kbaseMod, k32Mod, "GetFileAttributesW", hook_GetFileAttributesW);
installHook(kbaseMod, k32Mod, "SetFileAttributesW", hook_SetFileAttributesW);

// Unfortunately, at least on windows 10 1709 x64 the CreateFileA and CreateFile2 translate
// to CreateFileInternal directly (so hooking CreateFileW alone is not enough)
installHook(kbaseMod, k32Mod, "CreateFileW", hook_CreateFileW);
installHook(kbaseMod, k32Mod, "CreateFileA", hook_CreateFileA);
if (IsWindows8OrGreater())
installHook(kbaseMod, k32Mod, "CreateFile2", hook_CreateFile2, reinterpret_cast<LPVOID*>(&CreateFile2));

installHook(kbaseMod, k32Mod, "CreateDirectoryW", hook_CreateDirectoryW);
installHook(kbaseMod, k32Mod, "RemoveDirectoryW", hook_RemoveDirectoryW);
installHook(kbaseMod, k32Mod, "DeleteFileW", hook_DeleteFileW);
Expand Down
Loading

0 comments on commit 5df4a82

Please sign in to comment.