This commit is contained in:
DavidXanatos 2024-01-07 17:24:28 +01:00
parent 18c497eedf
commit bfb5c94720
5 changed files with 43 additions and 12 deletions

View File

@ -14,7 +14,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- fixed MessageBox with MB_DEFAULT_DESKTOP_ONLY or MB_SERVICE_NOTIFICATION can not display title and text correctly in security hardened box. [#3529](https://github.com/sandboxie-plus/Sandboxie/issues/3529)
- fixed Can't run npm inside security hardened sandbox on Windows 11 [#3505](https://github.com/sandboxie-plus/Sandboxie/issues/3505)
- fixed [1.12.6] Symlink and open path issue [#3537](https://github.com/sandboxie-plus/Sandboxie/issues/3537)
- when a volume without a asociated drive letter is encountered sbie uses \drive\{guid} instead of \drive\[letter]
- Note: when the volume later gets a drive letter the data under \drive\{guid} will be ignored!
- fixed right click a sandbox shortcut - click run unsandboxed in order to open the file without sandbox [#3528](https://github.com/sandboxie-plus/Sandboxie/issues/3528)
- Note: for the fix to take full effect the shell integration need to be re applied

View File

@ -200,7 +200,7 @@ void CSbieObject::ShellInstall(const QVariantMap& Options)
{
CSettingsWindow::AddContextMenu(Options["legacy"].toBool());
if (Options["runUnBoxed"].toBool()) {
CSbieUtils::AddContextMenu2(QApplication::applicationDirPath().replace("/", "\\") + "\\Start.exe",
CSbieUtils::AddContextMenu2(QApplication::applicationDirPath().replace("/", "\\") + "\\SandMan.exe",
tr("Run &Un-Sandboxed"),
QApplication::applicationDirPath().replace("/", "\\") + "\\Start.exe");
}

View File

@ -1603,11 +1603,11 @@ void CSandMan::OnMessage(const QString& MsgData)
QString BoxName;
QString CmdLine = Message.mid(4);
if (CmdLine.contains("\\start.exe", Qt::CaseInsensitive)) {
if (CmdLine.contains("\\start.exe", Qt::CaseInsensitive) || CmdLine.contains("\\sandman.exe", Qt::CaseInsensitive)) {
int pos = CmdLine.indexOf("/box:", 0, Qt::CaseInsensitive);
int pos2 = CmdLine.indexOf(" ", pos);
if (pos != -1 && pos2 != -1) {
BoxName = CmdLine.mid(pos + 5, pos2 - (pos + 5));
//BoxName = CmdLine.mid(pos + 5, pos2 - (pos + 5));
CmdLine = CmdLine.mid(pos2 + 1);
}
}
@ -1633,7 +1633,7 @@ void CSandMan::OnMessage(const QString& MsgData)
BoxName = theAPI->GetGlobalSettings()->GetText("DefaultBox", "DefaultBox");
if (!BoxName.isEmpty())
RunStart(BoxName, CmdLine, false, WrkDir);
RunStart(BoxName == "*DFP*" ? "" : BoxName, CmdLine, false, WrkDir);
else
RunSandboxed(QStringList(CmdLine), BoxName, WrkDir);
}

View File

@ -1521,7 +1521,7 @@ void CSettingsWindow::SaveSettings()
if (ui.chkShellMenu2->isChecked() != CSbieUtils::HasContextMenu2()) {
if (ui.chkShellMenu2->isChecked()) {
CSbieUtils::AddContextMenu2(QApplication::applicationDirPath().replace("/", "\\") + "\\Start.exe",
CSbieUtils::AddContextMenu2(QApplication::applicationDirPath().replace("/", "\\") + "\\SandMan.exe",
tr("Run &Un-Sandboxed"),
QApplication::applicationDirPath().replace("/", "\\") + "\\Start.exe");
} else

View File

@ -102,15 +102,26 @@ int main(int argc, char *argv[])
g_PendingMessage = "Op:" + Op;
}
CmdPos = -1;
// Context Menu invocations
int BoxPos = -1;
for (int i = 0; i < Args.size(); i++) {
if (Args[i].left(5).compare("/box:", Qt::CaseInsensitive) == 0)
CmdPos = i;
if (Args[i].left(5).compare("/box:", Qt::CaseInsensitive) == 0) {
BoxPos = i;
break;
}
}
if (CmdPos != -1) {
int DfpPos = Args.indexOf("/disable_force", Qt::CaseInsensitive);
// the first argument wins
if (BoxPos != -1 && DfpPos != -1) {
if (BoxPos < DfpPos) DfpPos = -1;
else BoxPos = -1;
}
// run sandboxed
if (BoxPos != -1)
{
// Note: a escaped command ending with \" will fail and unescape "
//QString CommandLine;
//for (int i = CmdPos + 1; i < Args.count(); i++)
//for (int i = BoxPos + 1; i < Args.count(); i++)
// CommandLine += "\"" + Args[i] + "\" ";
//g_PendingMessage = "Run:" + CommandLine.trimmed();
LPWSTR cmdLine0 = wcsstr(GetCommandLineW(), L"/box:");
@ -124,14 +135,31 @@ int main(int argc, char *argv[])
}
g_PendingMessage = "Run:" + QString::fromWCharArray(cmdLine + 1);
g_PendingMessage += "\nFrom:" + QDir::currentPath();
QString BoxName = QString::fromWCharArray(cmdLine0 + 5, cmdLine - (cmdLine0 + 5));
if(BoxName != "__ask__")
g_PendingMessage += "\nIn:" + BoxName;
}
// run un sandboxed
if (DfpPos != -1)
{
LPWSTR cmdLine0 = wcsstr(GetCommandLineW(), L"/disable_force");
if (!cmdLine0) return -1;
LPWSTR cmdLine = cmdLine0 + 14;
if (IsBoxed) {
ShellExecute(NULL, L"open", cmdLine + 1, NULL, NULL, SW_SHOWNORMAL);
return 0;
}
g_PendingMessage = "Run:" + QString::fromWCharArray(cmdLine + 1);
g_PendingMessage += "\nFrom:" + QDir::currentPath();
g_PendingMessage += "\nIn:*DFP*";
}
if (IsBoxed) {
QMessageBox::critical(NULL, "Sandboxie-Plus", CSandMan::tr("Sandboxie Manager can not be run sandboxed!"));
return -1;