Skip to content

Commit

Permalink
Add support for automated clean-up on restart and improved sandbox ac…
Browse files Browse the repository at this point in the history
…tion prompts
  • Loading branch information
Jkkoi committed Sep 16, 2024
1 parent 44d1ed0 commit a722a4c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
15 changes: 10 additions & 5 deletions SandboxiePlus/SandMan/SandMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ CSandMan::CSandMan(QWidget *parent)
}

connect(CSymbolProvider::Instance(), SIGNAL(StatusChanged(const QString&)), this, SLOT(OnSymbolStatus(const QString&)));

//qApp->setWindowIcon(GetIcon("IconEmptyDC", false));
}

Expand Down Expand Up @@ -2528,15 +2527,21 @@ void CSandMan::OnStatusChanged()
}

UpdateForceUSB();

if (theConf->GetBool("Options/CleanUpOnStart", false)) {
theAPI->UpdateProcesses(0, ShowAllSessions());
bool bAutoRun = QApplication::arguments().contains("-autorun");
if(bAutoRun) {
foreach(
const CSandBoxPtr &pBox, AllBoxes) {
if (pBox->GetBool("CleanAfterReboot"))
DeleteBoxContent(pBox, eAuto, true);
}
}
if (theConf->GetBool("Options/CleanUpOnStart", false)) {

//
// clean up Auto Delete boxes after reboot
//

theAPI->UpdateProcesses(0, ShowAllSessions());

foreach(const CSandBoxPtr & pBox, AllBoxes) {
if (pBox->GetActiveProcessCount() == 0)
OnBoxClosed(pBox);
Expand Down
18 changes: 12 additions & 6 deletions SandboxiePlus/SandMan/Views/SbieView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1397,12 +1397,18 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList<CSandBoxPtr>& SandB
if(QMessageBox::question(this, tr("Sandboxie-Plus"),
tr("Do you want to make the box cleaned after machine reboot?"),
QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes){
if(MoveFileExA(fileRoot.toStdString().c_str(),NULL,4)==0){
QMessageBox::warning(this, tr("Sandboxie-Plus"),
tr("The operation failed,please make sure that Sandman has admin privliage.")
, QMessageBox::Yes, 0);
}
}
if(QMessageBox::question(this, tr("Sandboxie-Plus"),
tr("Do you want to use Windows Delecting Feature(MoveFileEx)?Or we'll delete the box when Sandman.exe called by userinit.exe."),
QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes){
if(MoveFileExW(fileRoot.toStdString().c_str(),NULL,4)==0){
QMessageBox::warning(this, tr("Sandboxie-Plus"),
tr("The operation failed,please make sure that Sandman has admin privliage.")
, QMessageBox::Yes, 0);
}
}
else{
pBox->SetBool("CleanAfterReboot",true);
}
}
else if (Action == m_pMenuExport)
{
Expand Down

0 comments on commit a722a4c

Please sign in to comment.