From b84beed70c4e0d3575b1ec197c6b8e78065eb8aa Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Sat, 27 May 2023 17:12:22 +0200 Subject: [PATCH] 1.9.6 --- CHANGELOG.md | 3 +++ SandboxiePlus/SandMan/Helpers/WinHelper.cpp | 4 ++++ SandboxiePlus/SandMan/SbiePlusAPI.cpp | 3 +++ SandboxiePlus/SandMan/SbiePlusAPI.h | 1 + SandboxiePlus/SandMan/Views/SbieView.cpp | 6 ++++-- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d14ef63..a79a4776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). - fixed "Reset all GUI options" does not reset all GUI sections as expected [#2967](https://github.com/sandboxie-plus/Sandboxie/issues/2967) - fixed sbie:// links below the Box Type presets [#2959](https://github.com/sandboxie-plus/Sandboxie/issues/2959#issuecomment-1565264161) - fixed "Reset all GUI options" makes all sandbox names disappear [#2972](https://github.com/sandboxie-plus/Sandboxie/issues/2972) +- fixed A game can't be launched properly from "Run from Start Menu" [#2969](https://github.com/sandboxie-plus/Sandboxie/issues/2969) + + ## [1.9.5 / 5.64.5] - 2023-05-26 diff --git a/SandboxiePlus/SandMan/Helpers/WinHelper.cpp b/SandboxiePlus/SandMan/Helpers/WinHelper.cpp index a297124e..6dc9d5a9 100644 --- a/SandboxiePlus/SandMan/Helpers/WinHelper.cpp +++ b/SandboxiePlus/SandMan/Helpers/WinHelper.cpp @@ -50,6 +50,10 @@ QVariantMap ResolveShortcut(const QString& LinkPath) return Link; Link["Arguments"] = QString::fromWCharArray(szPath); + hRes = psl->GetWorkingDirectory(szPath, ARRAYSIZE(szPath)); + if (!FAILED(hRes)) + Link["WorkingDir"] = QString::fromWCharArray(szPath); + int IconIndex; hRes = psl->GetIconLocation(szPath, ARRAYSIZE(szPath), &IconIndex); if (FAILED(hRes)) diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.cpp b/SandboxiePlus/SandMan/SbiePlusAPI.cpp index d4a837a6..b2cc8fd1 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.cpp +++ b/SandboxiePlus/SandMan/SbiePlusAPI.cpp @@ -518,9 +518,12 @@ void CSandBoxPlus::ScanStartMenu() pLink->Target = Link["Path"].toString(); pLink->Icon = Link["IconPath"].toString(); pLink->IconIndex = Link["IconIndex"].toInt(); + pLink->WorkDir = Link["WorkingDir"].toString(); if (!pLink->Target.isEmpty() && !QFile::exists(pLink->Target) && !IsBoxexPath(pLink->Target)) pLink->Target = theAPI->GetBoxedPath(this, pLink->Target, FoundLink.Snapshot); + if (!pLink->WorkDir.isEmpty() && !QFile::exists(pLink->WorkDir) && !IsBoxexPath(pLink->WorkDir)) + pLink->WorkDir = theAPI->GetBoxedPath(this, pLink->WorkDir, FoundLink.Snapshot); if (!pLink->Icon.isEmpty() && !QFile::exists(pLink->Icon) && !IsBoxexPath(pLink->Icon)) pLink->Icon = theAPI->GetBoxedPath(this, pLink->Icon, FoundLink.Snapshot); } diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.h b/SandboxiePlus/SandMan/SbiePlusAPI.h index 98ddfa81..3fb19ec5 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.h +++ b/SandboxiePlus/SandMan/SbiePlusAPI.h @@ -163,6 +163,7 @@ public: QString Target; QString Icon; int IconIndex; + QString WorkDir; }; QList GetStartMenu() const { return m_StartMenu.values(); } diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 9be4c797..69fa7d61 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -1459,11 +1459,12 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList& SandB else // custom run menu command { QString Command = Action->data().toString(); + QString WorkingDir = Action->property("WorkingDir").toString(); if (Command.isEmpty()) - Results.append(SandBoxes.first()->RunStart("start_menu")); + Results.append(SandBoxes.first()->RunStart("start_menu", false, WorkingDir)); else { auto pBoxEx = SandBoxes.first().objectCast(); - Results.append(SandBoxes.first()->RunStart(pBoxEx->GetFullCommand(Command))); + Results.append(SandBoxes.first()->RunStart(pBoxEx->GetFullCommand(Command), false, WorkingDir)); } } @@ -1838,6 +1839,7 @@ void CSbieView::UpdateStartMenu(CSandBoxPlus* pBoxEx) if(Icon.isNull()) Icon = m_IconProvider.icon(QFileInfo(Link.Target)); pAction->setIcon(Icon); pAction->setData(Link.Target); + pAction->setProperty("WorkingDir", Link.WorkDir); } }