From 1ff28679b0557a642d29f1651a90a8f7fec77171 Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Sun, 3 Mar 2024 22:10:30 +0100 Subject: [PATCH] 1.13.2 --- CHANGELOG.md | 2 ++ Sandboxie/common/my_version.h | 4 ++-- Sandboxie/common/pattern.c | 30 +++++++++++++++++++++++++++--- Sandboxie/install/Templates.ini | 3 +++ SandboxiePlus/version.h | 2 +- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4bc9462..d893ff7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,12 +17,14 @@ This project adheres to [Semantic Versioning](http://semver.org/). - added option to prevent sandboxed processes from interfering with power operations [#3640](https://github.com/sandboxie-plus/Sandboxie/issues/3640) (thx Yeyixiao) - it can be enabled with "BlockInterferePower=y" - see the sandbox option "Prevents processes in the sandbox from interfering with power operations" in SandMan UI +- added new pattern mechanism using a ** in a pattern as palceholder means an arbitrary path element but not containing a '\' ### Changed - reworked option for suspending all processes in SandMan (originally introduced in 1.13.1) [#3582](https://github.com/sandboxie-plus/Sandboxie/issues/3582#issuecomment-1969628215) ### Fixed - fixed privacy mode, NormalFilePath and symbolic link issue [#3660](https://github.com/sandboxie-plus/Sandboxie/issues/3660) +- fixed "Recycle bin for drive * is corrupted" [#3665] (https://github.com/sandboxie-plus/Sandboxie/issues/3665) diff --git a/Sandboxie/common/my_version.h b/Sandboxie/common/my_version.h index d7275cbd..a741aa65 100644 --- a/Sandboxie/common/my_version.h +++ b/Sandboxie/common/my_version.h @@ -21,8 +21,8 @@ #ifndef _MY_VERSION_H #define _MY_VERSION_H -#define MY_VERSION_BINARY 5,68,1 -#define MY_VERSION_STRING "5.68.1" +#define MY_VERSION_BINARY 5,68,2 +#define MY_VERSION_STRING "5.68.2" #define MY_ABI_VERSION 0x56800 // These #defines are used by either Resource Compiler or NSIS installer diff --git a/Sandboxie/common/pattern.c b/Sandboxie/common/pattern.c index 98c38360..7b6822af 100644 --- a/Sandboxie/common/pattern.c +++ b/Sandboxie/common/pattern.c @@ -63,6 +63,7 @@ struct _PATTERN { // allocated as part of this PATTERN object struct { BOOLEAN hex; + BOOLEAN no_bs; USHORT len; WCHAR *ptr; } cons[0]; @@ -100,6 +101,9 @@ _Check_return_ _CRTIMP long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_op static const WCHAR *Pattern_wcsnstr( const WCHAR *hstr, const WCHAR *nstr, int nlen); +static const WCHAR *Pattern_wcsnstr_ex( + const WCHAR *hstr, const WCHAR *nstr, int nlen, int no_bs); + //--------------------------------------------------------------------------- // Variables @@ -125,6 +129,7 @@ _FX PATTERN *Pattern_Create( PATTERN *pat; WCHAR *optr; BOOLEAN any_hex_cons; + ULONG start_count; // // count number of constant parts in the input string, and @@ -190,8 +195,11 @@ _FX PATTERN *Pattern_Create( iptr = string; while (iptr) { - while (*iptr == L'*') + start_count = num_cons > 0 ? 1 : 0; + while (*iptr == L'*') { ++iptr; + ++start_count; + } iptr2 = wcschr(iptr, L'*'); if (iptr2) { @@ -218,6 +226,8 @@ _FX PATTERN *Pattern_Create( } else pat->cons[num_cons].hex = FALSE; + pat->cons[num_cons].no_bs = start_count == 2; + ++num_cons; optr += len_ptr + 1; } @@ -404,9 +414,9 @@ _FX int Pattern_Match2( while (1) { - const WCHAR *ptr = Pattern_wcsnstr( + const WCHAR *ptr = Pattern_wcsnstr_ex( string + str_index, - pat->cons[con_index].ptr, pat->cons[con_index].len); + pat->cons[con_index].ptr, pat->cons[con_index].len, pat->cons[con_index].no_bs); if (! ptr) { @@ -607,6 +617,18 @@ _FX int Pattern_wcstol(const WCHAR *text, WCHAR **endptr) _FX const WCHAR *Pattern_wcsnstr( const WCHAR *hstr, const WCHAR *nstr, int nlen) +{ + return Pattern_wcsnstr_ex(hstr, nstr, nlen, FALSE); +} + + +//--------------------------------------------------------------------------- +// Pattern_wcsnstr_ex +//--------------------------------------------------------------------------- + + +_FX const WCHAR *Pattern_wcsnstr_ex( + const WCHAR *hstr, const WCHAR *nstr, int nlen, int no_bs) { int i; while (*hstr) { @@ -620,6 +642,8 @@ _FX const WCHAR *Pattern_wcsnstr( return hstr; } ++hstr; + if (no_bs && *hstr == L'\\') + break; } return NULL; } diff --git a/Sandboxie/install/Templates.ini b/Sandboxie/install/Templates.ini index aef8495b..44241f27 100644 --- a/Sandboxie/install/Templates.ini +++ b/Sandboxie/install/Templates.ini @@ -432,6 +432,9 @@ NormalFilePath=%SbieHome%\* NormalFilePath=%ProgramFiles%\* NormalFilePath=%ProgramFiles% (x86)\* NormalFilePath=%ProgramData%\Microsoft\* +# recycle bin +NormalFilePath=?:\$Recycle.Bin\* +WriteFilePath=?:\$Recycle.Bin\**\* # shell & ui NormalKeyPath=HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize\* NormalKeyPath=HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\* diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index 052b3869..da96d42a 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -2,7 +2,7 @@ #define VERSION_MJR 1 #define VERSION_MIN 13 -#define VERSION_REV 1 +#define VERSION_REV 2 #define VERSION_UPD 0 #ifndef STR