From 8854fdbbe4658f04bde2e9c394ef09a22b33893d Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Fri, 22 Dec 2023 15:50:26 +0100 Subject: [PATCH] 1.12.6 --- CHANGELOG.md | 3 ++- .../QSbieAPI/Sandboxie/BoxedProcess.cpp | 3 +++ SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp | 17 +++++++++++++++++ SandboxiePlus/QSbieAPI/Sandboxie/SandBox.h | 6 ++++-- SandboxiePlus/QSbieAPI/SbieAPI.cpp | 8 ++++---- 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c090f1a6..1001fdfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,8 +14,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). - fixed "The directory name is invalid" when starting a process in a encrypted private box [#3475](https://github.com/sandboxie-plus/Sandboxie/issues/3475) - fixed symbolic links created inside a sandbox not working properly [#3181](https://github.com/sandboxie-plus/Sandboxie/issues/3181) - fixed issue with drives mounted to multiple fodlers or a drive lettet and a folder -- fixed issue with file paths when using boxes a with relocated root (e.g. to an ImDisk volume) +- fixed issue with file paths when using boxes a with relocated root (e.g. to an ImDisk volume) [#3506](https://github.com/sandboxie-plus/Sandboxie/issues/3506) - fixed issue with explorer on windows 11 when usign SysCallLockDown=y [#3516](https://github.com/sandboxie-plus/Sandboxie/issues/3516) +- fixed sandman not showing icons of processes located on a ImDisk volume diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp b/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp index 4a75ff66..3d0c2c85 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp +++ b/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp @@ -240,6 +240,9 @@ bool CBoxedProcess::InitProcessInfo() SB_STATUS Status = m_pBox->Api()->GetProcessInfo(m_ProcessId, &m_ParendPID, &m_ProcessInfo.Flags, &m_bSuspended, &m_ImagePath, &m_CommandLine, &m_WorkingDir); + if (m_ImagePath.left(8) == "\\Device\\" && m_ImagePath.left(m_pBox->m_FileRePath.length()).compare(m_pBox->m_FileRePath, Qt::CaseInsensitive) == 0) + m_ImagePath = m_pBox->m_FilePath + m_ImagePath.mid(m_pBox->m_FileRePath.length()); + return !Status.IsError(); } diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp b/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp index 9da9fe08..738647b4 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp +++ b/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp @@ -165,6 +165,23 @@ SB_STATUS CSandBox::SetSuspendedAll(bool bSuspended) return m_pAPI->SetSuspendedAll(m_Name, bSuspended); } +void CSandBox::OpenBox() +{ + HANDLE hFile = CreateFileW((LPCWSTR)m_FilePath.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (hFile != INVALID_HANDLE_VALUE) + { + WCHAR targetPath[MAX_PATH]; + if(GetFinalPathNameByHandleW(hFile, targetPath, MAX_PATH, FILE_NAME_NORMALIZED | VOLUME_NAME_NT)) + m_FileRePath = QString::fromWCharArray(targetPath); + CloseHandle(hFile); + } +} + +void CSandBox::CloseBox() +{ + m_FileRePath.clear(); +} + bool CSandBox::IsEmpty() const { return !QFile::exists(m_FilePath); diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.h b/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.h index c96de86e..5b7e3ddb 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.h +++ b/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.h @@ -57,8 +57,8 @@ public: virtual SB_STATUS TerminateAll(); virtual SB_STATUS SetSuspendedAll(bool bSuspended); - virtual void OpenBox() {} - virtual void CloseBox() {} + virtual void OpenBox(); + virtual void CloseBox(); virtual bool IsEnabled() const { return m_IsEnabled; } @@ -87,6 +87,7 @@ public: class CSbieAPI* Api() { return m_pAPI; } protected: + friend class CBoxedProcess; friend class CSbieAPI; SB_PROGRESS CleanBoxFolders(const QStringList& BoxFolders); @@ -96,6 +97,7 @@ protected: static void MergeSnapshotAsync(const CSbieProgressPtr& pProgress, const QString& BoxPath, const QString& TargetID, const QString& SourceID, const QPair& params); QString m_FilePath; + QString m_FileRePath; // reparsed Nt path QString m_RegPath; QString m_IpcPath; QString m_Mount; diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.cpp b/SandboxiePlus/QSbieAPI/SbieAPI.cpp index 5f80bd18..74b0a153 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.cpp +++ b/SandboxiePlus/QSbieAPI/SbieAPI.cpp @@ -1541,11 +1541,11 @@ SB_STATUS CSbieAPI::UpdateBoxPaths(CSandBox* pSandBox) if (!Status) return Status; - QString FilePath = Nt2DosPath(QString::fromWCharArray(FileRoot.c_str(), wcslen(FileRoot.c_str()))); - QString RegPath = QString::fromWCharArray(KeyRoot.c_str(), wcslen(KeyRoot.c_str())); - QString IpcPath = QString::fromWCharArray(IpcRoot.c_str(), wcslen(IpcRoot.c_str())); + QString FilePath = QString::fromWCharArray(FileRoot.c_str()); + QString RegPath = QString::fromWCharArray(KeyRoot.c_str()); + QString IpcPath = QString::fromWCharArray(IpcRoot.c_str()); - pSandBox->SetBoxPaths(FilePath, RegPath, IpcPath); + pSandBox->SetBoxPaths(Nt2DosPath(FilePath), RegPath, IpcPath); return SB_OK; }