From 254235136fa8b74ad147f03b646d4015208c14be Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Sat, 26 Aug 2023 22:15:32 +0200 Subject: [PATCH] 1.11.0a --- CHANGELOG.md | 3 +++ Sandboxie/core/svc/MountManager.cpp | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04892fc077..558664e93a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Changed - changed the new optin layout to now be the default for non vintage views (can be changed back in the settings) +### Fixed +- fixed issue when re creating rambox junction + ## [1.11.0 / 5.66.0] - 2023-08-25 diff --git a/Sandboxie/core/svc/MountManager.cpp b/Sandboxie/core/svc/MountManager.cpp index c02bbb1bdc..6462f90eab 100644 --- a/Sandboxie/core/svc/MountManager.cpp +++ b/Sandboxie/core/svc/MountManager.cpp @@ -966,7 +966,7 @@ bool MountManager::AcquireBoxRoot(const WCHAR* boxname, const WCHAR* reg_root, c if (!pRoot->InUse) { std::shared_ptr& pMount = UseRamDisk ? m_RamDisk : pRoot->Mount; - if (pMount && pRoot->Mount && !pRoot->Mount->NtPath.empty()) { + if (pMount && !pMount->NtPath.empty()) { std::wstring proxy = ImDiskQueryDeviceProxy(pMount->NtPath); if (_wcsnicmp(proxy.c_str(), L"\\BaseNamedObjects\\Global\\" IMBOX_PROXY, 25 + 11) != 0) pMount->NtPath.clear(); @@ -1019,23 +1019,23 @@ bool MountManager::AcquireBoxRoot(const WCHAR* boxname, const WCHAR* reg_root, c if (!pRoot->Mount || pRoot->Mount->NtPath.empty()) errlvl = 0x11; - else { - TargetNtPath = pRoot->Mount->NtPath + L"\\"; - if (UseRamDisk) // ram disk is shared so individualize the folder names - TargetNtPath += boxname; - else - TargetNtPath += SBIEDISK_LABEL; + else pRoot->Path = file_root; - } // pRoot->Mount->RefCount++; } - if (!TargetNtPath.empty()) { + if (errlvl == 0 && !pRoot->InUse) { // // Append box name and try to create // + TargetNtPath = pRoot->Mount->NtPath + L"\\"; + if (UseRamDisk) // ram disk is shared so individualize the folder names + TargetNtPath += boxname; + else + TargetNtPath += SBIEDISK_LABEL; + HANDLE handle = OpenOrCreateNtFolder(TargetNtPath.c_str()); if (!handle) errlvl = 0x12; @@ -1085,7 +1085,7 @@ void MountManager::LockBoxRoot(const WCHAR* reg_root, ULONG session_id) auto I = m_RootMap.find(reg_root); if (I != m_RootMap.end()) { // SbieApi_LogEx(session_id, 2201, L"LockBoxRoot %S", reg_root); - I->second->InUse = false; + I->second->InUse = true; } LeaveCriticalSection(&m_CritSec);