This commit is contained in:
DavidXanatos 2022-05-28 21:53:41 +02:00
parent 2b6dda05e4
commit ad7f4a88f4
4 changed files with 29 additions and 13 deletions

View File

@ -472,8 +472,12 @@ _FX BOOLEAN File_LoadPathTree_internal(LIST* Root, const WCHAR* name)
HANDLE hPathsFile;
hPathsFile = CreateFile(PathsFile, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hPathsFile == INVALID_HANDLE_VALUE)
if (hPathsFile == INVALID_HANDLE_VALUE) {
hPathsFile = CreateFile(PathsFile, FILE_APPEND_DATA, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hPathsFile != INVALID_HANDLE_VALUE)
CloseHandle(hPathsFile);
return FALSE;
}
File_ClearPathBranche_internal(Root);
@ -562,9 +566,9 @@ _FX VOID File_RefreshPathTree()
//
File_LoadPathTree();
}
FindNextChangeNotification(File_BoxRootWatcher); // rearm the watcher
FindNextChangeNotification(File_BoxRootWatcher); // rearm the watcher
}
}
@ -592,6 +596,8 @@ _FX BOOLEAN File_InitDelete_v2()
File_BoxRootWatcher = FindFirstChangeNotification(BoxFilePath, FALSE, FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE);
FindNextChangeNotification(File_BoxRootWatcher); // arm the watcher
return TRUE;
}

View File

@ -142,16 +142,23 @@ _FX BOOLEAN File_Init(void)
File_DriveAddSN = SbieApi_QueryConfBool(NULL, L"UseVolumeSerialNumbers", FALSE);
File_Delete_v2 = SbieApi_QueryConfBool(NULL, L"UseFileDeleteV2", FALSE);
File_NoReparse = SbieApi_QueryConfBool(NULL, L"NoPathReparse", FALSE);
if (! File_InitDrives(0xFFFFFFFF))
return FALSE;
File_Delete_v2 = SbieApi_QueryConfBool(NULL, L"UseFileDeleteV2", FALSE);
if (File_Delete_v2)
File_InitDelete_v2();
// this is here as it requirers file stuff to be set up
extern BOOLEAN Key_Delete_v2;
BOOLEAN Key_InitDelete_v2();
Key_Delete_v2 = SbieApi_QueryConfBool(NULL, L"UseRegDeleteV2", FALSE);
if (Key_Delete_v2)
Key_InitDelete_v2();
// this requirers key stuff to be set up
if (SbieApi_QueryConfBool(NULL, L"SeparateUserFolders", TRUE)) {
if (!File_InitUsers())
return FALSE;

View File

@ -362,11 +362,6 @@ _FX BOOLEAN Key_Init(void)
Key_UseObjectNames = SbieApi_QueryConfBool(NULL, L"UseObjectNameForKeys", FALSE);
Key_Delete_v2 = SbieApi_QueryConfBool(NULL, L"UseRegDeleteV2", FALSE);
if (Key_Delete_v2)
Key_InitDelete_v2();
List_Init(&Key_Handles);
List_Init(&Key_MergeCacheList);
@ -2515,7 +2510,13 @@ _FX NTSTATUS Key_NtDeleteValueKey(
status = __sys_NtDeleteValueKey(KeyHandle, ValueName);
} if (Key_Delete_v2){
} else if (Key_Delete_v2) {
RtlInitUnicodeString(&objname, CopyPath);
OBJECT_ATTRIBUTES objattrs;
InitializeObjectAttributes(&objattrs, &objname, OBJ_CASE_INSENSITIVE, NULL, NULL);
Key_CreatePath(&objattrs, NULL);
Key_MarkDeletedEx_v2(TruePath, ValueName->Buffer);

View File

@ -172,9 +172,9 @@ _FX VOID Key_RefreshPathTree()
//
Key_LoadPathTree();
}
FindNextChangeNotification(Key_BoxRootWatcher); // rearm the watcher
FindNextChangeNotification(Key_BoxRootWatcher); // rearm the watcher
}
}
@ -202,6 +202,8 @@ _FX BOOLEAN Key_InitDelete_v2()
Key_BoxRootWatcher = FindFirstChangeNotification(BoxFilePath, FALSE, FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE);
FindNextChangeNotification(Key_BoxRootWatcher); // arm the watcher
return TRUE;
}