From bf964b61adeb3a7ab517f9dea1100aeb10975b9a Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Sun, 12 Mar 2023 16:36:22 +0100 Subject: [PATCH] 1.8.1 --- Sandboxie/common/my_version.h | 4 +- Sandboxie/core/dll/ipc.c | 119 ++++++++++++++++++-- Sandboxie/core/dll/trace.c | 2 +- SandboxiePlus/MiscHelpers/Common/Finder.cpp | 2 +- SandboxiePlus/SandMan/Views/TraceView.cpp | 6 +- SandboxiePlus/version.h | 2 +- 6 files changed, 120 insertions(+), 15 deletions(-) diff --git a/Sandboxie/common/my_version.h b/Sandboxie/common/my_version.h index 99009e77..d14003b2 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,63,0 -#define MY_VERSION_STRING "5.63.0" +#define MY_VERSION_BINARY 5,63,1 +#define MY_VERSION_STRING "5.63.1" #define MY_ABI_VERSION 0x56000 // These #defines are used by either Resource Compiler or NSIS installer diff --git a/Sandboxie/core/dll/ipc.c b/Sandboxie/core/dll/ipc.c index 3f97c8fc..5e9d43db 100644 --- a/Sandboxie/core/dll/ipc.c +++ b/Sandboxie/core/dll/ipc.c @@ -483,7 +483,9 @@ _FX void Ipc_CreateObjects(void) WCHAR *TruePath; WCHAR *CopyPath; WCHAR *backslash; - WCHAR *buffer; + WCHAR *buffer = NULL; + WCHAR *BNOLINKS = NULL; + WCHAR *buffer2 = NULL; HANDLE handle; WCHAR str[64]; ULONG errlvl = 0; @@ -538,19 +540,113 @@ _FX void Ipc_CreateObjects(void) goto finish; } + // todo: fix-me: peroperly reparse symbolicl inks in IPC paths instead of creating dummy for everything + + buffer = Dll_Alloc((wcslen(CopyPath) + 32) * sizeof(WCHAR)); + + // + // create BNOLINKS directory and symbolic links + // + + BNOLINKS = Dll_Alloc((wcslen(CopyPath) + 32) * sizeof(WCHAR)); + + wcscpy(BNOLINKS, CopyPath); + + status = STATUS_UNSUCCESSFUL; + backslash = wcsrchr(BNOLINKS, L'\\'); + if (backslash) { + *backslash = L'\0'; + backslash = wcsrchr(BNOLINKS, L'\\'); + if (backslash) { + wcscpy(str, backslash); + *backslash = L'\0'; + wcscat(BNOLINKS, L"\\BNOLINKS"); + status = STATUS_SUCCESS; + } + } + + if (NT_SUCCESS(status)) + status = SbieApi_CreateDirOrLink(BNOLINKS, NULL); + + if (NT_SUCCESS(status)) { + wcscpy(buffer, BNOLINKS); + wcscat(buffer, str); + status = SbieApi_CreateDirOrLink(buffer, CopyPath); + } + + if (! NT_SUCCESS(status)) { + errlvl = 77; + goto finish; + } + + // + // create Global directory and symbolic links + // + + buffer2 = Dll_Alloc((Dll_BoxIpcPathLen + 32) * sizeof(WCHAR)); + + wcscpy(buffer2, Dll_BoxIpcPath); + wcscat(buffer2, L"\\BaseNamedObjects"); + + status = SbieApi_CreateDirOrLink(buffer2, NULL); + + if (! NT_SUCCESS(status)) { + errlvl = 88; + goto finish; + } + + wcscpy(buffer, buffer2); + wcscat(buffer, L"\\Global"); + + status = SbieApi_CreateDirOrLink(buffer, buffer2); + + if (! NT_SUCCESS(status)) { + errlvl = 51; + goto finish; + } + + wcscpy(buffer, buffer2); + wcscat(buffer, L"\\Local"); + + status = SbieApi_CreateDirOrLink(buffer, buffer2); + + if (! NT_SUCCESS(status)) { + errlvl = 52; + goto finish; + } + + wcscpy(buffer, buffer2); + wcscat(buffer, L"\\Session"); + + status = SbieApi_CreateDirOrLink(buffer, BNOLINKS); + + if (! NT_SUCCESS(status)) { + errlvl = 53; + goto finish; + } + + if (NT_SUCCESS(status)) { + wcscpy(buffer, BNOLINKS); + wcscat(buffer, L"\\0"); + status = SbieApi_CreateDirOrLink(buffer, buffer2); + } + + if (! NT_SUCCESS(status)) { + errlvl = 66; + goto finish; + } + // // create Global,Local,Session symbolic links // - buffer = Dll_Alloc((wcslen(CopyPath) + 32) * sizeof(WCHAR)); - wcscpy(buffer, CopyPath); wcscat(buffer, L"\\Global"); - status = SbieApi_CreateDirOrLink(buffer, CopyPath); + status = SbieApi_CreateDirOrLink(buffer, buffer2); if (! NT_SUCCESS(status)) { - errlvl = 44; + errlvl = 41; goto finish; } @@ -560,17 +656,17 @@ _FX void Ipc_CreateObjects(void) status = SbieApi_CreateDirOrLink(buffer, CopyPath); if (! NT_SUCCESS(status)) { - errlvl = 55; + errlvl = 42; goto finish; } wcscpy(buffer, CopyPath); wcscat(buffer, L"\\Session"); - status = SbieApi_CreateDirOrLink(buffer, CopyPath); + status = SbieApi_CreateDirOrLink(buffer, BNOLINKS); if (! NT_SUCCESS(status)) { - errlvl = 66; + errlvl = 43; goto finish; } @@ -580,6 +676,13 @@ _FX void Ipc_CreateObjects(void) finish: + if(buffer) + Dll_Free(buffer); + if(BNOLINKS) + Dll_Free(BNOLINKS); + if(buffer2) + Dll_Free(buffer2); + if (errlvl) SbieApi_Log(2308, L"[%d / %08X]", errlvl, status); } diff --git a/Sandboxie/core/dll/trace.c b/Sandboxie/core/dll/trace.c index 98e212c5..82e67fbb 100644 --- a/Sandboxie/core/dll/trace.c +++ b/Sandboxie/core/dll/trace.c @@ -289,7 +289,7 @@ VOID InstrumentationTrace(ULONG_PTR ReturnAddress, NTSTATUS ReturnStatus) #endif #ifdef _WIN64 - // Note: this would also be needed in native 32 bit, but there instrumentation does not work anyhow + // Note: this would also be needed in native 32 bit extern SBIELOW_DATA* SbieApi_data; if (NtFunction == (ULONG_PTR)SbieApi_data->NtDeviceIoControlFile_code) return; // this is used by our sys call interface, the driver will log this syscall diff --git a/SandboxiePlus/MiscHelpers/Common/Finder.cpp b/SandboxiePlus/MiscHelpers/Common/Finder.cpp index 37d2ca35..41da663c 100644 --- a/SandboxiePlus/MiscHelpers/Common/Finder.cpp +++ b/SandboxiePlus/MiscHelpers/Common/Finder.cpp @@ -169,7 +169,7 @@ void CFinder::OnUpdate() iOptions |= eHighLight; QString Exp = m_pSearch->text(); - QString ExpStr = ((iOptions & CFinder::eRegExp) == 0) ? Exp : (".*" + QRegularExpression::escape(Exp) + ".*"); + QString ExpStr = ((iOptions & CFinder::eRegExp) != 0) ? Exp : (".*" + QRegularExpression::escape(Exp).replace("\\","\\\\") + ".*"); m_RegExp = QRegularExpression(ExpStr, (iOptions & CFinder::eCaseSens) != 0 ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption); SetFilter(Exp, iOptions, GetColumn()); diff --git a/SandboxiePlus/SandMan/Views/TraceView.cpp b/SandboxiePlus/SandMan/Views/TraceView.cpp index c2340f8a..b4f36c98 100644 --- a/SandboxiePlus/SandMan/Views/TraceView.cpp +++ b/SandboxiePlus/SandMan/Views/TraceView.cpp @@ -106,7 +106,7 @@ CTraceTree::~CTraceTree() void CTraceTree::SetFilter(const QString& Exp, int iOptions, int Column) { - bool bReset = m_FilterExp != Exp || m_bHighLight != ((iOptions & CFinder::eHighLight) != 0); + bool bReset = m_bHighLight != ((iOptions & CFinder::eHighLight) != 0) || (!m_bHighLight && m_FilterExp != Exp); //QString ExpStr = ((iOptions & CFinder::eRegExp) == 0) ? Exp : (".*" + QRegularExpression::escape(Exp) + ".*"); //QRegularExpression RegExp(ExpStr, (iOptions & CFinder::eCaseSens) != 0 ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption); @@ -220,6 +220,7 @@ CTraceView::CTraceView(bool bStandAlone, QWidget* parent) : QWidget(parent) m_pTraceTid = new QComboBox(); m_pTraceTid->addItem(tr("[All]"), 0); m_pTraceTid->setMinimumWidth(75); + m_pTraceTid->setEditable(true); connect(m_pTraceTid, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSetTidFilter())); m_pTraceToolBar->addWidget(m_pTraceTid); @@ -590,7 +591,8 @@ void CTraceView::OnSetPidFilter() void CTraceView::OnSetTidFilter() { - m_FilterTid = m_pTraceTid->currentData().toUInt(); + //m_FilterTid = m_pTraceTid->currentData().toUInt(); + m_FilterTid = m_pTraceTid->currentText().toUInt(); //m_pSortProxy->m_FilterTid = m_pTraceTid->currentData().toUInt(); //m_pSortProxy->setFilterKeyColumn(m_pSortProxy->filterKeyColumn()); diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index f66f584e..453bcec8 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -2,7 +2,7 @@ #define VERSION_MJR 1 #define VERSION_MIN 8 -#define VERSION_REV 0 +#define VERSION_REV 1 #define VERSION_UPD 0 #ifndef STR