From 3dda65c852fa220561ded3cb1e43c84536b1c0d5 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Sat, 29 Jan 2022 20:38:26 +0100 Subject: [PATCH] Update file.c --- Sandboxie/core/dll/file.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Sandboxie/core/dll/file.c b/Sandboxie/core/dll/file.c index ff99d86f..68f33585 100644 --- a/Sandboxie/core/dll/file.c +++ b/Sandboxie/core/dll/file.c @@ -381,6 +381,23 @@ static ULONG File_Snapshot_Count = 0; #include "file_init.c" +//--------------------------------------------------------------------------- +// File_FindBoxPrefixLength +//--------------------------------------------------------------------------- + + +_FX ULONG File_FindBoxPrefixLength(const WCHAR* CopyPath) +{ + ULONG length = wcslen(CopyPath); + ULONG prefixLen = 0; + if (length >= Dll_BoxFilePathLen && 0 == Dll_NlsStrCmp(CopyPath, Dll_BoxFilePath, Dll_BoxFilePathLen)) + prefixLen = Dll_BoxFilePathLen; + if (File_AltBoxPath && length >= File_AltBoxPathLen && 0 == Dll_NlsStrCmp(CopyPath, File_AltBoxPath, File_AltBoxPathLen)) + prefixLen = File_AltBoxPathLen; + return prefixLen; +} + + //--------------------------------------------------------------------------- // File_GetName //---------------------------------------------------------------------------