This commit is contained in:
DavidXanatos 2022-02-18 20:09:35 +01:00
parent 266b3c0859
commit 3bcdd330d5
26 changed files with 194 additions and 117 deletions

View File

@ -5,11 +5,21 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.0.12 / 5.55.12] - 2022-02-xx (in development)
### Changed ## [1.0.12 / 5.55.12] - 2022-02-??
### Added
- added mini dump creation to sandman.exe in case it crashes
### Changed
- disabled Chrome and Firefox phishing entries in new sandboxes (by isaak654) [#1616](https://github.com/sandboxie-plus/Sandboxie/pull/1616) - disabled Chrome and Firefox phishing entries in new sandboxes (by isaak654) [#1616](https://github.com/sandboxie-plus/Sandboxie/pull/1616)
- updated Mozilla paths for the BlockSoftwareUpdaters template (by isaak654) [#1623](https://github.com/sandboxie-plus/Sandboxie/pull/1623) - updated Mozilla paths for the BlockSoftwareUpdaters template (by isaak654) [#1623](https://github.com/sandboxie-plus/Sandboxie/pull/1623)
- reworked tray icon generation now using overlays, added busy overlay
### Fixed
- fixed issue with accessing network drives in privacy mode [#1617](https://github.com/sandboxie-plus/Sandboxie/issues/1617)
- fixed issue with ping in compartment mode [1608](https://github.com/sandboxie-plus/Sandboxie/issues/1608)
- fixed sandman zu freezing when a log of processes are created and closed in a box

View File

@ -21,8 +21,8 @@
#ifndef _MY_VERSION_H #ifndef _MY_VERSION_H
#define _MY_VERSION_H #define _MY_VERSION_H
#define MY_VERSION_BINARY 5,55,11 #define MY_VERSION_BINARY 5,55,12
#define MY_VERSION_STRING "5.55.11" #define MY_VERSION_STRING "5.55.12"
#define MY_VERSION_COMPAT "5.55.0" // this refers to the driver ABI compatibility #define MY_VERSION_COMPAT "5.55.0" // this refers to the driver ABI compatibility
// These #defines are used by either Resource Compiler or NSIS installer // These #defines are used by either Resource Compiler or NSIS installer

View File

@ -193,6 +193,7 @@ static tMDWD s_pMDWD;
static HMODULE s_hDbgHelpMod; static HMODULE s_hDbgHelpMod;
static MINIDUMP_TYPE s_dumpTyp = MiniDumpNormal; // MiniDumpWithDataSegs or MiniDumpWithFullMemory static MINIDUMP_TYPE s_dumpTyp = MiniDumpNormal; // MiniDumpWithDataSegs or MiniDumpWithFullMemory
static wchar_t s_szMiniDumpName[64]; static wchar_t s_szMiniDumpName[64];
static wchar_t s_szMiniDumpPath[MAX_PATH];
static LONG __stdcall MyCrashHandlerExceptionFilter(EXCEPTION_POINTERS* pEx) static LONG __stdcall MyCrashHandlerExceptionFilter(EXCEPTION_POINTERS* pEx)
{ {
@ -214,7 +215,7 @@ static LONG __stdcall MyCrashHandlerExceptionFilter(EXCEPTION_POINTERS* pEx)
wchar_t szMiniDumpFileName[128]; wchar_t szMiniDumpFileName[128];
wsprintf(szMiniDumpFileName, L"%s %s.dmp", s_szMiniDumpName, QDateTime::currentDateTime().toString("dd.MM.yyyy hh-mm-ss,zzz").replace(QRegExp("[:*?<>|\"\\/]"), "_").toStdWString().c_str()); wsprintf(szMiniDumpFileName, L"%s %s.dmp", s_szMiniDumpName, QDateTime::currentDateTime().toString("dd.MM.yyyy hh-mm-ss,zzz").replace(QRegExp("[:*?<>|\"\\/]"), "_").toStdWString().c_str());
wchar_t szMiniDumpPath[MAX_PATH] = { 0 }; /*wchar_t szMiniDumpPath[MAX_PATH] = { 0 };
HANDLE hFile = CreateFile(szMiniDumpFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE hFile = CreateFile(szMiniDumpFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) if (hFile != INVALID_HANDLE_VALUE)
@ -226,7 +227,14 @@ static LONG __stdcall MyCrashHandlerExceptionFilter(EXCEPTION_POINTERS* pEx)
wchar_t szMiniDumpFilePath[MAX_PATH] = { 0 }; wchar_t szMiniDumpFilePath[MAX_PATH] = { 0 };
wsprintf(szMiniDumpFilePath, L"%s\\%s.dmp", szMiniDumpPath, szMiniDumpFileName); wsprintf(szMiniDumpFilePath, L"%s\\%s.dmp", szMiniDumpPath, szMiniDumpFileName);
hFile = CreateFile(szMiniDumpFilePath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); hFile = CreateFile(szMiniDumpFilePath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
} }*/
wchar_t szMiniDumpPath[MAX_PATH];
wcscpy(szMiniDumpPath, s_szMiniDumpPath);
wcscat(szMiniDumpPath, L"\\");
wcscat(szMiniDumpPath, szMiniDumpFileName);
HANDLE hFile = CreateFile(szMiniDumpPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) if (hFile != INVALID_HANDLE_VALUE)
{ {
@ -256,14 +264,16 @@ static LONG __stdcall MyCrashHandlerExceptionFilter(EXCEPTION_POINTERS* pEx)
return EXCEPTION_CONTINUE_SEARCH; // this will trigger the "normal" OS error-dialog return EXCEPTION_CONTINUE_SEARCH; // this will trigger the "normal" OS error-dialog
} }
void InitMiniDumpWriter(const wchar_t* Name) void InitMiniDumpWriter(const wchar_t* Name, const wchar_t* Path)
{ {
if (s_hDbgHelpMod != NULL) if (s_hDbgHelpMod != NULL)
return; return;
ASSERT(wcslen(Name) < ARRSIZE(s_szMiniDumpName)); ASSERT(wcslen(Name) < ARRSIZE(s_szMiniDumpName));
wcscpy(s_szMiniDumpName, Name); wcscpy(s_szMiniDumpName, Name);
ASSERT(wcslen(Path) < ARRSIZE(s_szMiniDumpPath));
wcscpy(s_szMiniDumpPath, Path);
// Initialize the member, so we do not load the dll after the exception has occured // Initialize the member, so we do not load the dll after the exception has occured
// which might be not possible anymore... // which might be not possible anymore...
s_hDbgHelpMod = LoadLibrary(L"dbghelp.dll"); s_hDbgHelpMod = LoadLibrary(L"dbghelp.dll");
@ -369,7 +379,7 @@ void InstallSigAction(int sig)
} }
} }
void InitMiniDumpWriter(const wchar_t* Name) void InitMiniDumpWriter(const wchar_t* Name, const wchar_t* Path)
{ {
ASSERT(wcslen(Name) < ARRSIZE(s_szMiniDumpName)); ASSERT(wcslen(Name) < ARRSIZE(s_szMiniDumpName));
wcscpy(s_szMiniDumpName, Name); wcscpy(s_szMiniDumpName, Name);
@ -384,7 +394,7 @@ quint64 GetCurCycle()
} }
#else #else
void InitMiniDumpWriter(const wchar_t* Name) void InitMiniDumpWriter(const wchar_t* Name, const wchar_t* Path)
{ {
} }

View File

@ -169,5 +169,5 @@ private:
#define TRACE_LOCKER(x) #define TRACE_LOCKER(x)
#endif #endif
MISCHELPERS_EXPORT void InitMiniDumpWriter(const wchar_t* Name); MISCHELPERS_EXPORT void InitMiniDumpWriter(const wchar_t* Name, const wchar_t* Path);
MISCHELPERS_EXPORT quint64 GetCurCycle(); MISCHELPERS_EXPORT quint64 GetCurCycle();

View File

@ -172,19 +172,11 @@ bool CBoxedProcess::InitProcessInfo()
if (NT_SUCCESS(status)) { if (NT_SUCCESS(status)) {
m_ParendPID = (quint32)BasicInformation.InheritedFromUniqueProcessId; m_ParendPID = (quint32)BasicInformation.InheritedFromUniqueProcessId;
} }
int iMaxRetry = 10;
retry:
TCHAR filename[MAX_PATH]; TCHAR filename[MAX_PATH];
if (DWORD size = GetModuleFileNameEx(ProcessHandle, NULL, filename, MAX_PATH)) DWORD dwSize = MAX_PATH;
if(QueryFullProcessImageNameW(ProcessHandle, 0, filename, &dwSize))
m_ImagePath = QString::fromWCharArray(filename); m_ImagePath = QString::fromWCharArray(filename);
else if (iMaxRetry-- > 0) {
// on win 7 this sometimes fails with invalid handle despite the handle being valid,
// just wait a second and retry, this happend when comming from OnProcessBoxed
QThread::msleep(50);
goto retry;
}
BOOL isTargetWow64Process = FALSE; BOOL isTargetWow64Process = FALSE;
IsWow64Process(ProcessHandle, &isTargetWow64Process); IsWow64Process(ProcessHandle, &isTargetWow64Process);

View File

@ -2290,12 +2290,12 @@ CBoxedProcessPtr CSbieAPI::OnProcessBoxed(quint32 ProcessId, const QString& Path
pProcess->InitProcessInfo(); pProcess->InitProcessInfo();
} }
if (pProcess->m_ParendPID == 0){
pProcess->m_ParendPID = ParentId;
pProcess->m_ImagePath = Path;
}
if(pProcess->m_ImageName.isEmpty()) if(pProcess->m_ImageName.isEmpty())
pProcess->m_ImageName = Path.mid(Path.lastIndexOf("\\") + 1); pProcess->m_ImageName = Path.mid(Path.lastIndexOf("\\") + 1);
if (pProcess->m_ParendPID == 0)
pProcess->m_ParendPID = ParentId;
if (pProcess->m_ImagePath.isEmpty())
pProcess->m_ImagePath = Path;
return pProcess; return pProcess;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 B

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 775 B

After

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

View File

@ -46,26 +46,27 @@
<file>HelpingHand.png</file> <file>HelpingHand.png</file>
<file>Actions/RegEdit.png</file> <file>Actions/RegEdit.png</file>
<file>Actions/Software.png</file> <file>Actions/Software.png</file>
<file>IconEmpty.png</file>
<file>IconEmptyD.png</file>
<file>IconFull.png</file>
<file>IconFullD.png</file>
<file>Actions/Ampel.png</file> <file>Actions/Ampel.png</file>
<file>Actions/Compatibility.png</file> <file>Actions/Compatibility.png</file>
<file>IconOff.png</file>
<file>Actions/Lock.png</file> <file>Actions/Lock.png</file>
<file>Actions/Shell.png</file> <file>Actions/Shell.png</file>
<file>IconFullDC.png</file>
<file>IconEmptyDC.png</file>
<file>IconOffC.png</file>
<file>IconFullC.png</file>
<file>IconEmptyC.png</file>
<file>Actions/Duplicate.png</file> <file>Actions/Duplicate.png</file>
<file>Actions/Up.png</file> <file>Actions/Up.png</file>
<file>Actions/Down.png</file> <file>Actions/Down.png</file>
<file>Actions/All.png</file> <file>Actions/All.png</file>
<file>Actions/Save.png</file> <file>Actions/Save.png</file>
<file>Actions/Uninstall.png</file> <file>Actions/Uninstall.png</file>
<file>IconBusy.png</file>
<file>IconBusyC.png</file>
<file>IconDFP.png</file>
<file>IconDFPC.png</file>
<file>IconEmpty.png</file>
<file>IconEmptyC.png</file>
<file>IconFull.png</file>
<file>IconFullC.png</file>
<file>IconOff.png</file>
<file>IconOffC.png</file>
<file>IconOffCx.png</file>
</qresource> </qresource>
<qresource prefix="/Boxes"> <qresource prefix="/Boxes">
<file alias="Empty3">Boxes/sandbox-b-empty.png</file> <file alias="Empty3">Boxes/sandbox-b-empty.png</file>

View File

@ -226,11 +226,13 @@ CSandMan::CSandMan(QWidget *parent)
} }
// Tray // Tray
m_pTrayIcon = new QSystemTrayIcon(GetTrayIconName(), this); m_pTrayIcon = new QSystemTrayIcon(GetTrayIcon(), this);
m_pTrayIcon->setToolTip("Sandboxie-Plus"); m_pTrayIcon->setToolTip(GetTrayText());
connect(m_pTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(OnSysTray(QSystemTrayIcon::ActivationReason))); connect(m_pTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(OnSysTray(QSystemTrayIcon::ActivationReason)));
m_bIconEmpty = true; m_bIconEmpty = true;
m_bIconDisabled = false; m_bIconDisabled = false;
m_bIconBusy = false;
m_iDeletingContent = 0;
m_pTrayMenu = new QMenu(); m_pTrayMenu = new QMenu();
QAction* pShowHide = m_pTrayMenu->addAction(GetIcon("IconFull", false), tr("Show/Hide"), this, SLOT(OnShowHide())); QAction* pShowHide = m_pTrayMenu->addAction(GetIcon("IconFull", false), tr("Show/Hide"), this, SLOT(OnShowHide()));
@ -278,7 +280,7 @@ CSandMan::CSandMan(QWidget *parent)
m_pTraySeparator = m_pTrayMenu->addSeparator(); m_pTraySeparator = m_pTrayMenu->addSeparator();
m_pTrayMenu->addAction(m_pEmptyAll); m_pTrayMenu->addAction(m_pEmptyAll);
m_pDisableForce2 = m_pTrayMenu->addAction(tr("Pause Forced Programs Rules"), this, SLOT(OnDisableForce2())); m_pDisableForce2 = m_pTrayMenu->addAction(tr("Pause Forcing Programs"), this, SLOT(OnDisableForce2()));
m_pDisableForce2->setCheckable(true); m_pDisableForce2->setCheckable(true);
m_pTrayMenu->addSeparator(); m_pTrayMenu->addSeparator();
@ -417,7 +419,7 @@ void CSandMan::CreateMenus()
m_pMenuFile->addSeparator(); m_pMenuFile->addSeparator();
m_pEmptyAll = m_pMenuFile->addAction(CSandMan::GetIcon("EmptyAll"), tr("Terminate All Processes"), this, SLOT(OnEmptyAll())); m_pEmptyAll = m_pMenuFile->addAction(CSandMan::GetIcon("EmptyAll"), tr("Terminate All Processes"), this, SLOT(OnEmptyAll()));
m_pWndFinder = m_pMenuFile->addAction(CSandMan::GetIcon("finder"), tr("Window Finder"), this, SLOT(OnWndFinder())); m_pWndFinder = m_pMenuFile->addAction(CSandMan::GetIcon("finder"), tr("Window Finder"), this, SLOT(OnWndFinder()));
m_pDisableForce = m_pMenuFile->addAction(tr("Pause Forced Programs Rules"), this, SLOT(OnDisableForce())); m_pDisableForce = m_pMenuFile->addAction(tr("Pause Forcing Programs"), this, SLOT(OnDisableForce()));
m_pDisableForce->setCheckable(true); m_pDisableForce->setCheckable(true);
m_pMenuFile->addSeparator(); m_pMenuFile->addSeparator();
m_pMaintenance = m_pMenuFile->addMenu(CSandMan::GetIcon("Maintenance"), tr("&Maintenance")); m_pMaintenance = m_pMenuFile->addMenu(CSandMan::GetIcon("Maintenance"), tr("&Maintenance"));
@ -751,24 +753,60 @@ void CSandMan::dropEvent(QDropEvent* e)
RunSandboxed(Commands, "DefaultBox"); RunSandboxed(Commands, "DefaultBox");
} }
QIcon CSandMan::GetTrayIconName(bool isConnected) QIcon CSandMan::GetTrayIcon(bool isConnected)
{ {
bool bClassic = (theConf->GetInt("Options/SysTrayIcon", 1) == 2);
QString IconFile; QString IconFile;
if (isConnected) { if (isConnected) {
if (m_bIconEmpty) if (m_bIconEmpty)
IconFile = "IconEmpty"; IconFile = "IconEmpty";
else else
IconFile = "IconFull"; IconFile = "IconFull";
if (m_bIconDisabled)
IconFile += "D";
} else } else
IconFile = "IconOff"; IconFile = "IconOff";
if (bClassic) IconFile += "C";
if (theConf->GetInt("Options/SysTrayIcon", 1) == 2) QSize size = QSize(16, 16);
IconFile += "C"; QPixmap result(size);
result.fill(Qt::transparent); // force alpha channel
QPainter painter(&result);
QPixmap base = GetIcon(IconFile, false).pixmap(size);
QPixmap overlay;
return GetIcon(IconFile, false); if (m_bIconBusy) {
IconFile = "IconBusy";
if (bClassic) { // classic has a different icon instead of an overlay
IconFile += "C";
base = GetIcon(IconFile, false).pixmap(size);
}
else
overlay = GetIcon(IconFile, false).pixmap(size);
}
painter.drawPixmap(0, 0, base);
if(!overlay.isNull()) painter.drawPixmap(0, 0, overlay);
if (m_bIconDisabled) {
IconFile = "IconDFP";
if (bClassic) IconFile += "C";
overlay = GetIcon(IconFile, false).pixmap(size);
painter.drawPixmap(0, 0, overlay);
}
return QIcon(result);
}
QString CSandMan::GetTrayText(bool isConnected)
{
QString Text = "Sandboxie-Plus";
if(!isConnected)
Text += tr(" - Driver/Service NOT Running!");
else if(m_iDeletingContent)
Text += tr(" - Deleting Sandbox Content");
return Text;
} }
void CSandMan::timerEvent(QTimerEvent* pEvent) void CSandMan::timerEvent(QTimerEvent* pEvent)
@ -777,6 +815,7 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
return; return;
bool bForceProcessDisabled = false; bool bForceProcessDisabled = false;
bool bIconBusy = false;
bool bConnected = false; bool bConnected = false;
if (theAPI->IsConnected()) if (theAPI->IsConnected())
@ -807,12 +846,17 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
else else
ActiveProcesses = Processes.count(); ActiveProcesses = Processes.count();
if (m_bIconEmpty != (ActiveProcesses == 0) || m_bIconDisabled != bForceProcessDisabled) if (theAPI->IsBusy() || m_iDeletingContent > 0)
bIconBusy = true;
if (m_bIconEmpty != (ActiveProcesses == 0) || m_bIconBusy != bIconBusy || m_bIconDisabled != bForceProcessDisabled)
{ {
m_bIconEmpty = (ActiveProcesses == 0); m_bIconEmpty = (ActiveProcesses == 0);
m_bIconBusy = bIconBusy;
m_bIconDisabled = bForceProcessDisabled; m_bIconDisabled = bForceProcessDisabled;
m_pTrayIcon->setIcon(GetTrayIconName()); m_pTrayIcon->setIcon(GetTrayIcon());
m_pTrayIcon->setToolTip(GetTrayText());
} }
} }
@ -900,18 +944,49 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
} }
} }
bool CSandMan::DoDeleteCmd(const CSandBoxPtr &pBox) SB_STATUS CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, bool DeleteShapshots)
{ {
foreach(const QString& Value, pBox->GetTextList("OnBoxDelete", true, false, true)) { SB_STATUS Ret = SB_OK;
QString Value2 = pBox->Expand(Value); m_iDeletingContent++;
CSbieProgressPtr pProgress = CSbieUtils::RunCommand(Value2, true);
if (!pProgress.isNull()) { if (Mode != eAuto) {
AddAsyncOp(pProgress, true, tr("Executing OnBoxDelete: %1").arg(Value2)); Ret = pBox->TerminateAll();
if (pProgress->IsCanceled()) if (Ret.IsError())
return false; goto finish;
}
if (Mode != eForDelete) {
foreach(const QString & Value, pBox->GetTextList("OnBoxDelete", true, false, true)) {
QString Value2 = pBox->Expand(Value);
CSbieProgressPtr pProgress = CSbieUtils::RunCommand(Value2, true);
if (!pProgress.isNull()) {
AddAsyncOp(pProgress, true, tr("Executing OnBoxDelete: %1").arg(Value2));
if (pProgress->IsCanceled()) {
Ret = CSbieStatus(SB_Canceled);
goto finish;
}
}
} }
} }
return true;
{
SB_PROGRESS Status;
if (Mode != eForDelete && !DeleteShapshots && pBox->HasSnapshots()) { // in auto delete mdoe always return to last snapshot
QString Current;
QString Default = pBox->GetDefaultSnapshot(&Current);
Status = pBox->SelectSnapshot(Mode == eAuto ? Current : Default);
}
else // if there are no snapshots just use the normal cleaning procedure
Status = pBox->CleanBox();
Ret = Status;
if (Status.GetStatus() == OP_ASYNC)
Ret = AddAsyncOp(Status.GetValue(), true, tr("Auto Deleting %1 Content").arg(pBox->GetName()));
}
finish:
m_iDeletingContent--;
return Ret;
} }
void CSandMan::OnBoxClosed(const QString& BoxName) void CSandMan::OnBoxClosed(const QString& BoxName)
@ -937,22 +1012,7 @@ void CSandMan::OnBoxClosed(const QString& BoxName)
CheckResults(QList<SB_STATUS>() << Status); CheckResults(QList<SB_STATUS>() << Status);
} }
else else
{ DeleteBoxContent(pBox, eAuto, DeleteShapshots);
if (!DoDeleteCmd(pBox))
return;
SB_PROGRESS Status;
if (!DeleteShapshots && pBox->HasSnapshots()) { // in auto delete mdoe always return to last snapshot
QString Current;
pBox->GetDefaultSnapshot(&Current);
Status = pBox->SelectSnapshot(Current);
}
else // if there are no snapshots just use the normal cleaning procedure
Status = pBox->CleanBox();
if (Status.GetStatus() == OP_ASYNC)
AddAsyncOp(Status.GetValue(), true, tr("Auto Deleting %1 content").arg(BoxName));
}
} }
} }
@ -1080,9 +1140,11 @@ void CSandMan::OnStatusChanged()
this->setWindowTitle(appTitle); this->setWindowTitle(appTitle);
m_pTrayIcon->setIcon(GetTrayIconName(isConnected)); m_pTrayIcon->setIcon(GetTrayIcon(isConnected));
m_pTrayIcon->setToolTip(GetTrayText(isConnected));
m_bIconEmpty = true; m_bIconEmpty = true;
m_bIconDisabled = false; m_bIconDisabled = false;
m_bIconBusy = false;
m_pNewBox->setEnabled(isConnected); m_pNewBox->setEnabled(isConnected);
m_pNewGroup->setEnabled(isConnected); m_pNewGroup->setEnabled(isConnected);
@ -1900,7 +1962,7 @@ void CSandMan::OnSetMonitoring()
//m_pTraceView->setEnabled(m_pEnableMonitoring->isChecked()); //m_pTraceView->setEnabled(m_pEnableMonitoring->isChecked());
} }
bool CSandMan::AddAsyncOp(const CSbieProgressPtr& pProgress, bool bWait, const QString& InitialMsg) SB_STATUS CSandMan::AddAsyncOp(const CSbieProgressPtr& pProgress, bool bWait, const QString& InitialMsg)
{ {
m_pAsyncProgress.insert(pProgress.data(), pProgress); m_pAsyncProgress.insert(pProgress.data(), pProgress);
connect(pProgress.data(), SIGNAL(Message(const QString&)), this, SLOT(OnAsyncMessage(const QString&))); connect(pProgress.data(), SIGNAL(Message(const QString&)), this, SLOT(OnAsyncMessage(const QString&)));
@ -1919,7 +1981,9 @@ bool CSandMan::AddAsyncOp(const CSbieProgressPtr& pProgress, bool bWait, const Q
if (pProgress->IsFinished()) // Note: since the operation runs asynchronously, it may have already finished, so we need to test for that if (pProgress->IsFinished()) // Note: since the operation runs asynchronously, it may have already finished, so we need to test for that
OnAsyncFinished(pProgress.data()); OnAsyncFinished(pProgress.data());
return !pProgress->IsCanceled(); if (pProgress->IsCanceled())
return CSbieStatus(SB_Canceled);
return SB_OK;
} }
void CSandMan::OnAsyncFinished() void CSandMan::OnAsyncFinished()

View File

@ -38,9 +38,15 @@ public:
SB_PROGRESS RecoverFiles(const QList<QPair<QString, QString>>& FileList, int Action = 0); SB_PROGRESS RecoverFiles(const QList<QPair<QString, QString>>& FileList, int Action = 0);
bool DoDeleteCmd(const CSandBoxPtr &pBox); enum EDelMode {
eDefault,
eAuto,
eForDelete
};
bool AddAsyncOp(const CSbieProgressPtr& pProgress, bool bWait = false, const QString& InitialMsg = QString()); SB_STATUS DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, bool DeleteShapshots = true);
SB_STATUS AddAsyncOp(const CSbieProgressPtr& pProgress, bool bWait = false, const QString& InitialMsg = QString());
static QString FormatError(const SB_STATUS& Error); static QString FormatError(const SB_STATUS& Error);
static void CheckResults(QList<SB_STATUS> Results); static void CheckResults(QList<SB_STATUS> Results);
@ -75,7 +81,8 @@ protected:
static void RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QList<QPair<QString, QString>>& FileList, int Action = 0); static void RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QList<QPair<QString, QString>>& FileList, int Action = 0);
QIcon GetTrayIconName(bool isConnected = true); QIcon GetTrayIcon(bool isConnected = true);
QString GetTrayText(bool isConnected = true);
void closeEvent(QCloseEvent* e); void closeEvent(QCloseEvent* e);
@ -285,6 +292,8 @@ private:
//QMenu* m_pBoxMenu; //QMenu* m_pBoxMenu;
bool m_bIconEmpty; bool m_bIconEmpty;
bool m_bIconDisabled; bool m_bIconDisabled;
bool m_bIconBusy;
int m_iDeletingContent;
bool m_bExit; bool m_bExit;

View File

@ -7,6 +7,7 @@
CSbiePlusAPI::CSbiePlusAPI(QObject* parent) : CSbieAPI(parent) CSbiePlusAPI::CSbiePlusAPI(QObject* parent) : CSbieAPI(parent)
{ {
m_JobCount = 0;
} }
CSbiePlusAPI::~CSbiePlusAPI() CSbiePlusAPI::~CSbiePlusAPI()
@ -451,6 +452,7 @@ SB_STATUS CSandBoxPlus::DeleteContentAsync(bool DeleteShapshots, bool bOnAutoDel
void CSandBoxPlus::AddJobToQueue(CBoxJob* pJob) void CSandBoxPlus::AddJobToQueue(CBoxJob* pJob)
{ {
theAPI->m_JobCount++;
m_JobQueue.append(QSharedPointer<CBoxJob>(pJob)); m_JobQueue.append(QSharedPointer<CBoxJob>(pJob));
if (m_JobQueue.count() == 1) if (m_JobQueue.count() == 1)
StartNextJob(); StartNextJob();
@ -476,6 +478,7 @@ next:
else else
{ {
m_JobQueue.removeFirst(); m_JobQueue.removeFirst();
theAPI->m_JobCount--;
if (Status.IsError()) { if (Status.IsError()) {
m_JobQueue.clear(); m_JobQueue.clear();
theGUI->CheckResults(QList<SB_STATUS>() << Status); theGUI->CheckResults(QList<SB_STATUS>() << Status);
@ -494,6 +497,7 @@ void CSandBoxPlus::OnAsyncFinished()
m_StatusStr.clear(); m_StatusStr.clear();
QSharedPointer<CBoxJob> pJob = m_JobQueue.takeFirst(); QSharedPointer<CBoxJob> pJob = m_JobQueue.takeFirst();
theAPI->m_JobCount--;
CSbieProgressPtr pProgress = pJob->GetProgress(); CSbieProgressPtr pProgress = pJob->GetProgress();
if (pProgress->IsCanceled()) { if (pProgress->IsCanceled()) {
m_JobQueue.clear(); m_JobQueue.clear();

View File

@ -17,12 +17,17 @@ public:
virtual bool IsRunningAsAdmin(); virtual bool IsRunningAsAdmin();
virtual bool IsBusy() const { return m_JobCount > 0; }
protected: protected:
friend class CSandBoxPlus;
virtual CSandBox* NewSandBox(const QString& BoxName, class CSbieAPI* pAPI); virtual CSandBox* NewSandBox(const QString& BoxName, class CSbieAPI* pAPI);
virtual CBoxedProcess* NewBoxedProcess(quint32 ProcessId, class CSandBox* pBox); virtual CBoxedProcess* NewBoxedProcess(quint32 ProcessId, class CSandBox* pBox);
virtual CBoxedProcessPtr OnProcessBoxed(quint32 ProcessId, const QString& Path, const QString& Box, quint32 ParentId); virtual CBoxedProcessPtr OnProcessBoxed(quint32 ProcessId, const QString& Path, const QString& Box, quint32 ParentId);
int m_JobCount;
QMultiMap<quint32, QString> m_WindowMap; QMultiMap<quint32, QString> m_WindowMap;
}; };

View File

@ -989,20 +989,12 @@ void CSbieView::OnSandBoxAction(QAction* Action)
foreach(const CSandBoxPtr& pBox, SandBoxes) foreach(const CSandBoxPtr& pBox, SandBoxes)
{ {
SB_STATUS Status1 = pBox->TerminateAll(); SB_STATUS Status = theGUI->DeleteBoxContent(pBox, CSandMan::eForDelete);
if (Status1.IsError()) { if (Status.GetMsgCode() == SB_Canceled)
Results.append(Status1); break;
continue; if (!Status.IsError())
} Status = pBox->RemoveBox();
Results.append(Status);
SB_PROGRESS Status = pBox->CleanBox();
if (Status.GetStatus() == OP_ASYNC)
theGUI->AddAsyncOp(Status.GetValue(), true, tr("Deleting %1 content").arg(pBox->GetName()));
else if (Status.IsError()) {
Results.append(Status);
continue;
}
Results.append(pBox->RemoveBox());
} }
} }
else if (Action == m_pMenuCleanUp) else if (Action == m_pMenuCleanUp)
@ -1041,27 +1033,10 @@ void CSbieView::OnSandBoxAction(QAction* Action)
} }
else else
{ {
SB_STATUS Status1 = pBox->TerminateAll(); SB_STATUS Status = theGUI->DeleteBoxContent(pBox, CSandMan::eDefault, DeleteShapshots);
if (Status1.IsError()) { if (Status.GetMsgCode() == SB_Canceled)
Results.append(Status1); break;
continue; Results.append(Status);
}
if (!theGUI->DoDeleteCmd(pBox))
continue;
SB_PROGRESS Status;
if (!DeleteShapshots && pBox->HasSnapshots()) {
QString Default = pBox->GetDefaultSnapshot();
Status = pBox->SelectSnapshot(Default);
}
else // if there are no snapshots jut use the normal cleaning procedure
Status = pBox->CleanBox();
if (Status.GetStatus() == OP_ASYNC)
theGUI->AddAsyncOp(Status.GetValue());
else if (Status.IsError())
Results.append(Status);
} }
} }
} }

View File

@ -325,7 +325,9 @@ void COptionsWindow::OnBoxTypChanged()
//ui.chkRestrictServices->setChecked(true); //ui.chkRestrictServices->setChecked(true);
ui.chkPrivacy->setChecked(BoxType == CSandBoxPlus::eHardenedPlus); ui.chkPrivacy->setChecked(BoxType == CSandBoxPlus::eHardenedPlus);
//SetTemplate("NoUACProxy", false); //SetTemplate("NoUACProxy", false);
//SetTemplate("DeviceSecurity", true); //if ((g_FeatureFlags & CSbieAPI::eSbieFeatureCert) == 0)
// SetTemplate("DeviceSecurity", true); // requirers rule specificity
SetTemplate("RpcPortBindingsExt", false);
break; break;
case CSandBoxPlus::eDefaultPlus: case CSandBoxPlus::eDefaultPlus:
case CSandBoxPlus::eDefault: case CSandBoxPlus::eDefault:
@ -345,6 +347,7 @@ void COptionsWindow::OnBoxTypChanged()
ui.chkPrivacy->setChecked(BoxType == CSandBoxPlus::eAppBoxPlus); ui.chkPrivacy->setChecked(BoxType == CSandBoxPlus::eAppBoxPlus);
//SetTemplate("NoUACProxy", true); //SetTemplate("NoUACProxy", true);
//SetTemplate("DeviceSecurity", false); //SetTemplate("DeviceSecurity", false);
SetTemplate("RpcPortBindingsExt", true);
break; break;
} }

View File

@ -97,6 +97,10 @@ int main(int argc, char *argv[])
// use a shared setting location when used in a business environment for easier administration // use a shared setting location when used in a business environment for easier administration
theConf = new CSettings("Sandboxie-Plus", g_CertInfo.business); theConf = new CSettings("Sandboxie-Plus", g_CertInfo.business);
#ifndef _DEBUG
InitMiniDumpWriter(L"SandMan", QString(theConf->GetConfigDir()).replace("/", "\\").toStdWString().c_str());
#endif
//QThreadPool::globalInstance()->setMaxThreadCount(theConf->GetInt("Options/MaxThreadPool", 10)); //QThreadPool::globalInstance()->setMaxThreadCount(theConf->GetInt("Options/MaxThreadPool", 10));

View File

@ -2,7 +2,7 @@
#define VERSION_MJR 1 #define VERSION_MJR 1
#define VERSION_MIN 0 #define VERSION_MIN 0
#define VERSION_REV 11 #define VERSION_REV 12
#define VERSION_UPD 0 #define VERSION_UPD 0
#ifndef STR #ifndef STR