parent
f978eb8f72
commit
c86975ab3c
|
@ -10,7 +10,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||
|
||||
### Fixed
|
||||
- fixed BlockNetworkFiles=y not workign tigether with RestrictDevices=y [#2629](https://github.com/sandboxie-plus/Sandboxie/issues/2629)
|
||||
|
||||
- fixed sandman crash issue introduced in 1.7.0
|
||||
- fixed trace log filter case case sensitive
|
||||
- fixed performance issues with Delete V2
|
||||
|
||||
|
||||
## [1.7.0 / 5.62.0] - 2022-12-27
|
||||
|
|
|
@ -1154,25 +1154,6 @@ BOOL CBoxFile::GetBoxCreationTime(FILETIME *out_time)
|
|||
BOOL CBoxFile::QueryFileAttributes(
|
||||
const WCHAR *path, ULONG *attrs, ULONG64 *size)
|
||||
{
|
||||
NTSTATUS status;
|
||||
UNICODE_STRING uni;
|
||||
OBJECT_ATTRIBUTES objattrs;
|
||||
FILE_NETWORK_OPEN_INFORMATION info;
|
||||
|
||||
CString prefixed_path = CString(L"\\??\\") + path;
|
||||
uni.Buffer = (WCHAR *)(const WCHAR *)prefixed_path;
|
||||
uni.Length = prefixed_path.GetLength() * sizeof(WCHAR);
|
||||
uni.MaximumLength = uni.Length + sizeof(WCHAR);
|
||||
|
||||
InitializeObjectAttributes(
|
||||
&objattrs, &uni, OBJ_CASE_INSENSITIVE, NULL, NULL);
|
||||
|
||||
status = NtQueryFullAttributesFile(&objattrs, &info);
|
||||
|
||||
if (! NT_SUCCESS(status))
|
||||
return FALSE;
|
||||
|
||||
*attrs = info.FileAttributes;
|
||||
*size = info.EndOfFile.QuadPart;
|
||||
return TRUE;
|
||||
return SbieDll_QueryFileAttributes((const WCHAR*)prefixed_path, size, NULL, attrs);
|
||||
}
|
||||
|
|
|
@ -7404,6 +7404,41 @@ _FX void SbieDll_DeviceChange(WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// SbieDll_QueryFileAttributes
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
BOOL SbieDll_QueryFileAttributes(const WCHAR *NtPath, ULONG64 *size, ULONG64 *date, ULONG *attrs)
|
||||
{
|
||||
NTSTATUS status;
|
||||
UNICODE_STRING uni;
|
||||
OBJECT_ATTRIBUTES objattrs;
|
||||
FILE_NETWORK_OPEN_INFORMATION info;
|
||||
|
||||
uni.Buffer = (WCHAR *)NtPath;
|
||||
uni.Length = wcslen(NtPath) * sizeof(WCHAR);
|
||||
uni.MaximumLength = uni.Length + sizeof(WCHAR);
|
||||
|
||||
InitializeObjectAttributes(
|
||||
&objattrs, &uni, OBJ_CASE_INSENSITIVE, NULL, NULL);
|
||||
|
||||
if(__sys_NtQueryFullAttributesFile)
|
||||
status = __sys_NtQueryFullAttributesFile(&objattrs, &info);
|
||||
else
|
||||
status = NtQueryFullAttributesFile(&objattrs, &info);
|
||||
|
||||
if (! NT_SUCCESS(status))
|
||||
return FALSE;
|
||||
|
||||
if(size) *size = info.EndOfFile.QuadPart;
|
||||
if(date) *date = info.LastWriteTime.QuadPart;
|
||||
if(attrs) *attrs = info.FileAttributes;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// We don't want calls to StopTailCallOptimization to be optimized away
|
||||
#pragma optimize("", off)
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ static LIST File_PathRoot;
|
|||
static CRITICAL_SECTION *File_PathRoot_CritSec = NULL;
|
||||
|
||||
static HANDLE File_BoxRootWatcher = NULL;
|
||||
static ULONG64 File_PathsFileSize = 0;
|
||||
static ULONG64 File_PathsFileDate = 0;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Functions
|
||||
|
@ -84,6 +86,8 @@ static BOOLEAN File_HasDeleted_v2(const WCHAR* TruePath);
|
|||
static WCHAR* File_GetRelocation(const WCHAR* TruePath);
|
||||
static NTSTATUS File_SetRelocation(const WCHAR *OldTruePath, const WCHAR *NewTruePath);
|
||||
|
||||
BOOL File_GetAttributes_internal(const WCHAR *name, ULONG64 *size, ULONG64 *date, ULONG *attrs);
|
||||
|
||||
HANDLE File_AcquireMutex(const WCHAR* MutexName);
|
||||
void File_ReleaseMutex(HANDLE hMutex);
|
||||
#define FILE_VFS_MUTEX SBIE L"_VFS_Mutex"
|
||||
|
@ -420,6 +424,8 @@ _FX BOOLEAN File_SavePathTree()
|
|||
|
||||
File_SavePathTree_internal(&File_PathRoot, FILE_PATH_FILE_NAME);
|
||||
|
||||
File_GetAttributes_internal(FILE_PATH_FILE_NAME, &File_PathsFileSize, &File_PathsFileDate, NULL);
|
||||
|
||||
LeaveCriticalSection(File_PathRoot_CritSec);
|
||||
|
||||
return TRUE;
|
||||
|
@ -563,13 +569,22 @@ _FX VOID File_RefreshPathTree()
|
|||
|
||||
if (WaitForSingleObject(File_BoxRootWatcher, 0) == WAIT_OBJECT_0) {
|
||||
|
||||
//
|
||||
// something changed, reload the path tree
|
||||
//
|
||||
ULONG64 PathsFileSize = 0;
|
||||
ULONG64 PathsFileDate = 0;
|
||||
if (File_GetAttributes_internal(FILE_PATH_FILE_NAME, &PathsFileSize, &PathsFileDate, NULL)
|
||||
&& (File_PathsFileSize != PathsFileSize || File_PathsFileDate != PathsFileDate)) {
|
||||
|
||||
File_LoadPathTree();
|
||||
File_PathsFileSize = PathsFileSize;
|
||||
File_PathsFileDate = PathsFileDate;
|
||||
|
||||
FindNextChangeNotification(File_BoxRootWatcher); // rearm the watcher
|
||||
//
|
||||
// something changed, reload the path tree
|
||||
//
|
||||
|
||||
File_LoadPathTree();
|
||||
|
||||
FindNextChangeNotification(File_BoxRootWatcher); // rearm the watcher
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -592,6 +607,8 @@ _FX BOOLEAN File_InitDelete_v2()
|
|||
// File_SavePathTree();
|
||||
//#endif
|
||||
|
||||
File_GetAttributes_internal(FILE_PATH_FILE_NAME, &File_PathsFileSize, &File_PathsFileDate, NULL);
|
||||
|
||||
WCHAR BoxFilePath[MAX_PATH] = { 0 };
|
||||
wcscpy(BoxFilePath, Dll_BoxFilePath);
|
||||
SbieDll_TranslateNtToDosPath(BoxFilePath);
|
||||
|
@ -820,3 +837,18 @@ _FX WCHAR* File_GetRelocation(const WCHAR *TruePath)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// File_GetAttributes_internal
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
BOOL File_GetAttributes_internal(const WCHAR *name, ULONG64 *size, ULONG64 *date, ULONG *attrs)
|
||||
{
|
||||
WCHAR PathsFile[MAX_PATH] = { 0 };
|
||||
wcscpy(PathsFile, Dll_BoxFilePath);
|
||||
wcscat(PathsFile, L"\\");
|
||||
wcscat(PathsFile, name);
|
||||
|
||||
return SbieDll_QueryFileAttributes(PathsFile, size, date, attrs);
|
||||
}
|
||||
|
|
|
@ -58,6 +58,8 @@ static CRITICAL_SECTION *Key_PathRoot_CritSec = NULL;
|
|||
BOOLEAN Key_RegPaths_Loaded = FALSE;
|
||||
|
||||
static HANDLE Key_BoxRootWatcher = NULL;
|
||||
static ULONG64 Key_PathsFileSize = 0;
|
||||
static ULONG64 Key_PathsFileDate = 0;
|
||||
static volatile ULONGLONG Key_PathsVersion = 0; // count reloads
|
||||
|
||||
|
||||
|
@ -87,6 +89,8 @@ VOID File_SavePathNode_internal(HANDLE hPathsFile, LIST* parent, WCHAR* Path, UL
|
|||
BOOLEAN File_MarkDeleted_internal(LIST* Root, const WCHAR* Path);
|
||||
VOID File_SetRelocation_internal(LIST* Root, const WCHAR* OldTruePath, const WCHAR* NewTruePath);
|
||||
|
||||
BOOL File_GetAttributes_internal(const WCHAR *name, ULONG64 *size, ULONG64 *date, ULONG *attrs);
|
||||
|
||||
HANDLE File_AcquireMutex(const WCHAR* MutexName);
|
||||
void File_ReleaseMutex(HANDLE hMutex);
|
||||
#define KEY_VCM_MUTEX SBIE L"_VCM_Mutex"
|
||||
|
@ -124,10 +128,12 @@ _FX BOOLEAN Key_SavePathTree()
|
|||
|
||||
File_SavePathTree_internal(&Key_PathRoot, KEY_PATH_FILE_NAME);
|
||||
|
||||
LeaveCriticalSection(Key_PathRoot_CritSec);
|
||||
File_GetAttributes_internal(KEY_PATH_FILE_NAME, &Key_PathsFileSize, &Key_PathsFileDate, NULL);
|
||||
|
||||
Key_PathsVersion++;
|
||||
|
||||
LeaveCriticalSection(Key_PathRoot_CritSec);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -167,13 +173,22 @@ _FX VOID Key_RefreshPathTree()
|
|||
|
||||
if (WaitForSingleObject(Key_BoxRootWatcher, 0) == WAIT_OBJECT_0) {
|
||||
|
||||
//
|
||||
// something changed, reload the path tree
|
||||
//
|
||||
ULONG64 PathsFileSize = 0;
|
||||
ULONG64 PathsFileDate = 0;
|
||||
if (File_GetAttributes_internal(KEY_PATH_FILE_NAME, &PathsFileSize, &PathsFileDate, NULL)
|
||||
&& (Key_PathsFileSize != PathsFileSize || Key_PathsFileDate != PathsFileDate)) {
|
||||
|
||||
Key_LoadPathTree();
|
||||
Key_PathsFileSize = PathsFileSize;
|
||||
Key_PathsFileDate = PathsFileDate;
|
||||
|
||||
FindNextChangeNotification(Key_BoxRootWatcher); // rearm the watcher
|
||||
//
|
||||
// something changed, reload the path tree
|
||||
//
|
||||
|
||||
Key_LoadPathTree();
|
||||
|
||||
FindNextChangeNotification(Key_BoxRootWatcher); // rearm the watcher
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,6 +210,8 @@ _FX BOOLEAN Key_InitDelete_v2()
|
|||
//#ifdef WITH_DEBUG
|
||||
// Key_SavePathTree();
|
||||
//#endif
|
||||
|
||||
File_GetAttributes_internal(KEY_PATH_FILE_NAME, &Key_PathsFileSize, &Key_PathsFileDate, NULL);
|
||||
|
||||
WCHAR BoxFilePath[MAX_PATH] = { 0 };
|
||||
wcscpy(BoxFilePath, Dll_BoxFilePath);
|
||||
|
|
|
@ -80,6 +80,8 @@ SBIEDLL_EXPORT void SbieDll_UnHookModule(HMODULE module);
|
|||
|
||||
SBIEDLL_EXPORT void SbieDll_DeviceChange(WPARAM wParam, LPARAM lParam);
|
||||
|
||||
SBIEDLL_EXPORT BOOL SbieDll_QueryFileAttributes(const WCHAR *NtPath, ULONG64 *size, ULONG64 *date, ULONG *attrs);
|
||||
|
||||
SBIEDLL_EXPORT const WCHAR *SbieDll_GetDrivePath(ULONG DriveIndex);
|
||||
|
||||
SBIEDLL_EXPORT const WCHAR *SbieDll_GetUserPathEx(WCHAR which);
|
||||
|
|
|
@ -399,11 +399,11 @@ void CTraceView::Refresh()
|
|||
else
|
||||
{
|
||||
if (bHasFilter && !m_pTrace->m_bHighLight) {
|
||||
if (!pEntry->GetName().contains(m_pTrace->m_FilterExp)
|
||||
&& !pEntry->GetMessage().contains(m_pTrace->m_FilterExp)
|
||||
//&& !pEntry->GetTypeStr().contains(m_pTrace->m_FilterExp) // dont filter on non static strings !!!
|
||||
//&& !pEntry->GetStautsStr().contains(m_pTrace->m_FilterExp) // dont filter on non static strings !!!
|
||||
&& !pEntry->GetProcessName().contains(m_pTrace->m_FilterExp))
|
||||
if (!pEntry->GetName().contains(m_pTrace->m_FilterExp, Qt::CaseInsensitive)
|
||||
&& !pEntry->GetMessage().contains(m_pTrace->m_FilterExp, Qt::CaseInsensitive)
|
||||
//&& !pEntry->GetTypeStr().contains(m_pTrace->m_FilterExp, Qt::CaseInsensitive) // dont filter on non static strings !!!
|
||||
//&& !pEntry->GetStautsStr().contains(m_pTrace->m_FilterExp, Qt::CaseInsensitive) // dont filter on non static strings !!!
|
||||
&& !pEntry->GetProcessName().contains(m_pTrace->m_FilterExp, Qt::CaseInsensitive))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue