From 2859471549aa33059ac51f22deee270970f1b5d1 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Wed, 8 Jun 2022 11:53:59 +0200 Subject: [PATCH 01/19] 1.1.2 --- Sandboxie/core/dll/advapi.c | 4 +-- Sandboxie/core/dll/guienum.c | 48 +++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Sandboxie/core/dll/advapi.c b/Sandboxie/core/dll/advapi.c index c32b97ca..2ed9b798 100644 --- a/Sandboxie/core/dll/advapi.c +++ b/Sandboxie/core/dll/advapi.c @@ -247,7 +247,7 @@ _FX BOOLEAN AdvApi_Init(HMODULE module) // only hook SetSecurityInfo if this is Chrome. Outlook 2013 uses delayed loading and will cause infinite callbacks // Starting with Win 10, we only want to hook ntmarta!SetSecurityInfo. Do NOT hook advapi!SetSecurityInfo. Delay loading for advapi will cause infinite recursion. // Note: the infinite recursion issue has been resolved int 5.43 - if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER)) { + if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { SetSecurityInfo = __sys_SetSecurityInfo; GetSecurityInfo = __sys_GetSecurityInfo; SBIEDLL_HOOK(AdvApi_, SetSecurityInfo); @@ -730,7 +730,7 @@ _FX BOOLEAN Ntmarta_Init(HMODULE module) #define GETPROC2(x,s) __sys_Ntmarta_##x##s = (P_##x) Ldr_GetProcAddrNew(DllName_ntmarta, L#x L#s,#x #s); GETPROC2(GetSecurityInfo, ); - if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER)) { + if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { GetSecurityInfo = __sys_Ntmarta_GetSecurityInfo; if (GetSecurityInfo) diff --git a/Sandboxie/core/dll/guienum.c b/Sandboxie/core/dll/guienum.c index 30a62f62..e85d46e3 100644 --- a/Sandboxie/core/dll/guienum.c +++ b/Sandboxie/core/dll/guienum.c @@ -578,18 +578,22 @@ _FX HDESK Gui_OpenDesktopA( //--------------------------------------------------------------------------- //Gui_CreateWindowStationW //--------------------------------------------------------------------------- -extern HANDLE Sandboxie_WinSta; -_FX HANDLE Gui_CreateWindowStationW (void *lpwinsta, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa) { + +_FX HANDLE Gui_CreateWindowStationW (void *lpwinsta, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa) +{ HANDLE myHandle = 0; myHandle = __sys_CreateWindowStationW(lpwinsta, dwFlags, dwDesiredAccess, lpsa); - if (!myHandle) { - if(Sandboxie_WinSta) - return Sandboxie_WinSta; - SbieApi_Log(2205, L"CreateWindowStation"); - } - return myHandle; + if (myHandle) + return myHandle; + + extern HANDLE Sandboxie_WinSta; + if(Sandboxie_WinSta && ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_MOZILLA_FIREFOX) || Config_GetSettingsForImageName_bool(L"UseSbieWndStation", TRUE))) + return Sandboxie_WinSta; + + SbieApi_Log(2205, L"CreateWindowStation"); + return 0; } @@ -598,22 +602,26 @@ _FX HANDLE Gui_CreateWindowStationW (void *lpwinsta, DWORD dwFlags, ACCESS_MASK //--------------------------------------------------------------------------- -_FX HANDLE Gui_CreateWindowStationA (void *lpwinsta, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa) { +_FX HANDLE Gui_CreateWindowStationA (void *lpwinsta, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa) +{ HANDLE myHandle = 0; myHandle = __sys_CreateWindowStationA(lpwinsta, dwFlags, dwDesiredAccess, lpsa); - if (!myHandle) { - if(Sandboxie_WinSta) - return Sandboxie_WinSta; - SbieApi_Log(2205, L"CreateWindowStation"); - } - return myHandle; + if (myHandle) + return myHandle; + + extern HANDLE Sandboxie_WinSta; + if(Sandboxie_WinSta && ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_MOZILLA_FIREFOX) || Config_GetSettingsForImageName_bool(L"UseSbieWndStation", TRUE))) + return Sandboxie_WinSta; + + SbieApi_Log(2205, L"CreateWindowStation"); + return 0; } //--------------------------------------------------------------------------- // Gui_CreateDesktopW //--------------------------------------------------------------------------- -extern HANDLE Sandboxie_Desktop; + _FX HDESK Gui_CreateDesktopW( void *lpszDesktop, void *lpszDevice, void *DevMode, ULONG dwFlags, @@ -625,7 +633,7 @@ _FX HDESK Gui_CreateDesktopW( if (rc) return rc; - if (!Config_GetSettingsForImageName_bool(L"UseSbieWndStation", TRUE) && (Dll_ImageType != DLL_IMAGE_GOOGLE_CHROME) && (Dll_ImageType != DLL_IMAGE_MOZILLA_FIREFOX)) + if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { //Call the system CreateDesktopW without a security context. //This works in tandem with the Ntmarta_GetSecurityInfo hook (see in advapi.c). @@ -639,8 +647,6 @@ _FX HDESK Gui_CreateDesktopW( return rc; } - if (Sandboxie_Desktop) - return Sandboxie_Desktop; SbieApi_Log(2205, L"CreateDesktop"); return CreateEvent(NULL, FALSE, FALSE, NULL); } @@ -661,15 +667,13 @@ _FX HDESK Gui_CreateDesktopA( if (rc) return rc; - if (!Config_GetSettingsForImageName_bool(L"UseSbieWndStation", TRUE) && (Dll_ImageType != DLL_IMAGE_GOOGLE_CHROME) && (Dll_ImageType != DLL_IMAGE_MOZILLA_FIREFOX)) + if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { rc = __sys_CreateDesktopA(lpszDesktop, NULL, NULL, dwFlags, dwDesiredAccess, NULL); if (rc) return rc; } - if (Sandboxie_Desktop) - return Sandboxie_Desktop; SbieApi_Log(2205, L"CreateDesktop"); return CreateEvent(NULL, FALSE, FALSE, NULL); } From 7a2e840c8982a821c9e53867fbe9b4acdd06c58c Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Wed, 8 Jun 2022 17:23:19 +0200 Subject: [PATCH 02/19] 1.1.2 --- Sandboxie/common/my_version.h | 4 +- Sandboxie/core/dll/sysinfo.c | 2 +- Sandboxie/core/drv/process.c | 2 +- SandboxiePlus/SandMan/SandMan.cpp | 731 ++---------------- SandboxiePlus/SandMan/SandMan.h | 7 +- SandboxiePlus/SandMan/SandMan.pri | 10 - SandboxiePlus/SandMan/SandMan.vcxproj | 82 +- SandboxiePlus/SandMan/SandMan.vcxproj.filters | 6 + SandboxiePlus/SandMan/SandManUpdate.cpp | 420 ++++++++++ SandboxiePlus/SandMan/SbieFindWnd.cpp | 232 ++++++ SandboxiePlus/SandMan/Views/SbieView.cpp | 6 +- .../SandMan/Windows/FileBrowserWindow.cpp | 2 +- .../SandMan/Windows/OptionsAdvanced.cpp | 4 +- .../SandMan/Windows/OptionsWindow.cpp | 10 + SandboxiePlus/SandMan/Windows/PopUpWindow.cpp | 2 +- .../SandMan/Windows/RecoveryWindow.cpp | 2 +- SandboxiePlus/version.h | 2 +- 17 files changed, 821 insertions(+), 703 deletions(-) create mode 100644 SandboxiePlus/SandMan/SandManUpdate.cpp create mode 100644 SandboxiePlus/SandMan/SbieFindWnd.cpp diff --git a/Sandboxie/common/my_version.h b/Sandboxie/common/my_version.h index 8406b174..9ba754d6 100644 --- a/Sandboxie/common/my_version.h +++ b/Sandboxie/common/my_version.h @@ -21,8 +21,8 @@ #ifndef _MY_VERSION_H #define _MY_VERSION_H -#define MY_VERSION_BINARY 5,56,1 -#define MY_VERSION_STRING "5.56.1" +#define MY_VERSION_BINARY 5,56,2 +#define MY_VERSION_STRING "5.56.2" #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 diff --git a/Sandboxie/core/dll/sysinfo.c b/Sandboxie/core/dll/sysinfo.c index a8a15809..5b4babe8 100644 --- a/Sandboxie/core/dll/sysinfo.c +++ b/Sandboxie/core/dll/sysinfo.c @@ -133,7 +133,7 @@ _FX BOOLEAN SysInfo_Init(void) SysInfo_UseSbieJob = !Gui_OpenAllWinClasses && !SbieApi_QueryConfBool(NULL, L"NoAddProcessToJob", FALSE); if (Dll_OsBuild >= 8400) - SysInfo_CanUseJobs = SbieApi_QueryConfBool(NULL, L"AllowBoxedJobs", TRUE); + SysInfo_CanUseJobs = SbieApi_QueryConfBool(NULL, L"AllowBoxedJobs", FALSE); SBIEDLL_HOOK(SysInfo_, NtCreateJobObject); SBIEDLL_HOOK(SysInfo_, NtOpenJobObject); diff --git a/Sandboxie/core/drv/process.c b/Sandboxie/core/drv/process.c index 642a1f72..2e9f7e09 100644 --- a/Sandboxie/core/drv/process.c +++ b/Sandboxie/core/drv/process.c @@ -1348,7 +1348,7 @@ _FX BOOLEAN Process_NotifyProcess_Create( // boxed job to a process will not interfere with the job assigned by SbieSvc // - new_proc->can_use_jobs = Conf_Get_Boolean(new_proc->box->name, L"AllowBoxedJobs", 0, TRUE); + new_proc->can_use_jobs = Conf_Get_Boolean(new_proc->box->name, L"AllowBoxedJobs", 0, FALSE); } // diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 8cffa448..3a71d48f 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -286,6 +286,7 @@ void CSandMan::LoadState() restoreState(theConf->GetBlob("MainWindow/Window_State")); //m_pBoxTree->restoreState(theConf->GetBlob("MainWindow/BoxTree_Columns")); m_pMessageLog->GetView()->header()->restoreState(theConf->GetBlob("MainWindow/LogList_Columns")); + m_pRecoveryLog->GetView()->header()->restoreState(theConf->GetBlob("MainWindow/RecoveryLog_Columns")); m_pLogSplitter->restoreState(theConf->GetBlob("MainWindow/Log_Splitter")); m_pPanelSplitter->restoreState(theConf->GetBlob("MainWindow/Panel_Splitter")); m_pLogTabs->setCurrentIndex(theConf->GetInt("MainWindow/LogTab", 0)); @@ -297,6 +298,7 @@ void CSandMan::StoreState() theConf->SetBlob("MainWindow/Window_State", saveState()); //theConf->SetBlob("MainWindow/BoxTree_Columns", m_pBoxTree->saveState()); theConf->SetBlob("MainWindow/LogList_Columns", m_pMessageLog->GetView()->header()->saveState()); + theConf->SetBlob("MainWindow/RecoveryLog_Columns", m_pRecoveryLog->GetView()->header()->saveState()); theConf->SetBlob("MainWindow/Log_Splitter", m_pLogSplitter->saveState()); theConf->SetBlob("MainWindow/Panel_Splitter", m_pPanelSplitter->saveState()); theConf->SetValue("MainWindow/LogTab", m_pLogTabs->currentIndex()); @@ -377,6 +379,7 @@ void CSandMan::CreateMenus() m_pCleanUpMenu->addSeparator(); m_pCleanUpMsgLog = m_pCleanUpMenu->addAction(tr("Cleanup Message Log"), this, SLOT(OnCleanUp())); m_pCleanUpTrace = m_pCleanUpMenu->addAction(tr("Cleanup Trace Log"), this, SLOT(OnCleanUp())); + m_pCleanUpRecovery = m_pCleanUpMenu->addAction(tr("Cleanup Recovery Log"), this, SLOT(OnCleanUp())); m_pKeepTerminated = m_pMenuView->addAction(CSandMan::GetIcon("Keep"), tr("Keep terminated"), this, SLOT(OnProcView())); m_pKeepTerminated->setCheckable(true); @@ -527,6 +530,22 @@ void CSandMan::CreateView() m_pTraceView->AddAction(m_pCleanUpTrace); m_pLogTabs->addTab(m_pTraceView, tr("Trace Log")); + + + // Recovery Log + m_pRecoveryLog = new CPanelWidgetEx(); + + //m_pRecoveryLog->GetView()->setItemDelegate(theGUI->GetItemDelegate()); + ((QTreeWidgetEx*)m_pRecoveryLog->GetView())->setHeaderLabels(tr("Time|Box Name|File Path").split("|")); + + m_pRecoveryLog->GetMenu()->insertAction(m_pRecoveryLog->GetMenu()->actions()[0], m_pCleanUpMsgLog); + m_pRecoveryLog->GetMenu()->insertSeparator(m_pRecoveryLog->GetMenu()->actions()[0]); + + m_pRecoveryLog->GetView()->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_pRecoveryLog->GetView()->setSortingEnabled(false); + + m_pLogTabs->addTab(m_pRecoveryLog, tr("Recovery Log")); + // } void CSandMan::CreateTrayMenu() @@ -1389,6 +1408,23 @@ bool CSandMan::CheckCertificate() return false; } +void CSandMan::UpdateCertState() +{ + g_CertInfo.State = theAPI->GetCertState(); + + g_CertInfo.about_to_expire = g_CertInfo.expirers_in_sec && g_CertInfo.expirers_in_sec < (60 * 60 * 24 * 30); + if (g_CertInfo.outdated) + OnLogMessage(tr("The supporter certificate is not valid for this build, please get an updated certificate")); + // outdated always implicates it is no longer valid + else if (g_CertInfo.expired) // may be still valid for the current and older builds + OnLogMessage(tr("The supporter certificate has expired%1, please get an updated certificate") + .arg(g_CertInfo.valid ? tr(", but it remains valid for the current build") : "")); + else if (g_CertInfo.about_to_expire) + OnLogMessage(tr("The supporter certificate will expire in %1 days, please get an updated certificate").arg(g_CertInfo.expirers_in_sec / (60 * 60 * 24))); + + emit CertUpdated(); +} + void CSandMan::OnQueuedRequest(quint32 ClientPid, quint32 ClientTid, quint32 RequestId, const QVariantMap& Data) { m_pPopUpWindow->AddUserPrompt(RequestId, Data, ClientPid); @@ -1456,14 +1492,14 @@ CRecoveryWindow* CSandMan::ShowRecovery(const CSandBoxPtr& pBox, bool bFind) return pBoxEx->m_pRecoveryWnd; } -SB_PROGRESS CSandMan::RecoverFiles(const QList>& FileList, int Action) +SB_PROGRESS CSandMan::RecoverFiles(const QString& BoxName, const QList>& FileList, int Action) { CSbieProgressPtr pProgress = CSbieProgressPtr(new CSbieProgress()); - QtConcurrent::run(CSandMan::RecoverFilesAsync, pProgress, FileList, Action); + QtConcurrent::run(CSandMan::RecoverFilesAsync, pProgress, BoxName, FileList, Action); return SB_PROGRESS(OP_ASYNC, pProgress); } -void CSandMan::RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QList>& FileList, int Action) +void CSandMan::RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QString& BoxName, const QList>& FileList, int Action) { SB_STATUS Status = SB_OK; @@ -1506,6 +1542,13 @@ void CSandMan::RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QList< if (!QFile::rename(BoxPath, RecoveryPath)) Unrecovered.append(BoxPath); + else { + QMetaObject::invokeMethod(theGUI, "OnFileRecovered", Qt::BlockingQueuedConnection, // show this question using the GUI thread + Q_ARG(QString, BoxName), + Q_ARG(QString, RecoveryPath), + Q_ARG(QString, BoxPath) + ); + } } if (!Unrecovered.isEmpty()) @@ -1528,6 +1571,17 @@ void CSandMan::RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QList< pProgress->Finish(Status); } +void CSandMan::OnFileRecovered(const QString& BoxName, const QString& FilePath, const QString& BoxPath) +{ + QTreeWidgetItem* pItem = new QTreeWidgetItem(); // Time|Box|FilePath + pItem->setText(0, QDateTime::currentDateTime().toString("hh:mm:ss.zzz")); + pItem->setText(1, BoxName); + pItem->setText(2, FilePath); + m_pRecoveryLog->GetTree()->addTopLevelItem(pItem); + + m_pRecoveryLog->GetView()->verticalScrollBar()->setValue(m_pRecoveryLog->GetView()->verticalScrollBar()->maximum()); +} + int CSandMan::ShowQuestion(const QString& question, const QString& checkBoxText, bool* checkBoxSetting, int buttons, int defaultButton) { return CCheckableMessageBox::question(this, "Sandboxie-Plus", question, checkBoxText, checkBoxSetting, (QDialogButtonBox::StandardButtons)buttons, (QDialogButtonBox::StandardButton)defaultButton, QMessageBox::Question); @@ -1881,6 +1935,9 @@ void CSandMan::OnCleanUp() if (sender() == m_pCleanUpTrace || sender() == m_pCleanUpButton) m_pTraceView->Clear(); + + if (sender() == m_pCleanUpRecovery || sender() == m_pCleanUpButton) + m_pRecoveryLog->GetTree()->clear(); if (sender() == m_pCleanUpProcesses || sender() == m_pCleanUpButton) theAPI->UpdateProcesses(false, m_pShowAllSessions->isChecked()); @@ -2399,443 +2456,6 @@ QString CSandMan::GetVersion() return Version; } -void CSandMan::CheckForUpdates(bool bManual) -{ - if (!m_pUpdateProgress.isNull()) - return; - - m_pUpdateProgress = CSbieProgressPtr(new CSbieProgress()); - AddAsyncOp(m_pUpdateProgress); - m_pUpdateProgress->ShowMessage(tr("Checking for updates...")); - - if (m_RequestManager == NULL) - m_RequestManager = new CNetworkAccessManager(30 * 1000, this); - - - QUrlQuery Query; - Query.addQueryItem("software", "sandboxie-plus"); - //QString Branche = theConf->GetString("Options/ReleaseBranche"); - //if (!Branche.isEmpty()) - // Query.addQueryItem("branche", Branche); - //Query.addQueryItem("version", GetVersion()); - Query.addQueryItem("version", QString::number(VERSION_MJR) + "." + QString::number(VERSION_MIN) + "." + QString::number(VERSION_REV) + "." + QString::number(VERSION_UPD)); - Query.addQueryItem("system", "windows-" + QSysInfo::kernelVersion() + "-" + QSysInfo::currentCpuArchitecture()); - Query.addQueryItem("language", QString::number(m_LanguageId)); - - QString UpdateKey = GetArguments(g_Certificate, L'\n', L':').value("UPDATEKEY"); - if (UpdateKey.isEmpty()) - UpdateKey = theAPI->GetGlobalSettings()->GetText("UpdateKey"); // theConf->GetString("Options/UpdateKey"); - if (!UpdateKey.isEmpty()) - Query.addQueryItem("update_key", UpdateKey); - Query.addQueryItem("auto", bManual ? "0" : "1"); - - QUrl Url("https://sandboxie-plus.com/update.php"); - Url.setQuery(Query); - - QNetworkRequest Request = QNetworkRequest(Url); - Request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); - //Request.setRawHeader("Accept-Encoding", "gzip"); - QNetworkReply* pReply = m_RequestManager->get(Request); - pReply->setProperty("manual", bManual); - connect(pReply, SIGNAL(finished()), this, SLOT(OnUpdateCheck())); -} - -void CSandMan::OnUpdateCheck() -{ - if (m_pUpdateProgress.isNull()) - return; - - QNetworkReply* pReply = qobject_cast(sender()); - bool bManual = pReply->property("manual").toBool(); - QByteArray Reply = pReply->readAll(); - pReply->deleteLater(); - - m_pUpdateProgress->Finish(SB_OK); - m_pUpdateProgress.clear(); - - QVariantMap Data = QJsonDocument::fromJson(Reply).toVariant().toMap(); - if (Data.isEmpty() || Data["error"].toBool()) - { - QString Error = Data.isEmpty() ? tr("server not reachable") : Data["errorMsg"].toString(); - OnLogMessage(tr("Failed to check for updates, error: %1").arg(Error), !bManual); - if (bManual) - QMessageBox::critical(this, "Sandboxie-Plus", tr("Failed to check for updates, error: %1").arg(Error)); - return; - } - - bool bNothing = true; - - QStringList IgnoredUpdates = theConf->GetStringList("Options/IgnoredUpdates"); - - QString UserMsg = Data["userMsg"].toString(); - if (!UserMsg.isEmpty()) - { - QString MsgHash = QCryptographicHash::hash(Data["userMsg"].toByteArray(), QCryptographicHash::Md5).toHex().left(8); - if (!IgnoredUpdates.contains(MsgHash)) - { - QString FullMessage = UserMsg; - QString InfoUrl = Data["infoUrl"].toString(); - if (!InfoUrl.isEmpty()) - FullMessage += tr("

Do you want to go to the info page?

").arg(InfoUrl); - - CCheckableMessageBox mb(this); - mb.setWindowTitle("Sandboxie-Plus"); - QIcon ico(QLatin1String(":/SandMan.png")); - mb.setIconPixmap(ico.pixmap(64, 64)); - //mb.setTextFormat(Qt::RichText); - mb.setText(UserMsg); - mb.setCheckBoxText(tr("Don't show this announcement in the future.")); - - if (!InfoUrl.isEmpty()) { - mb.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No); - mb.setDefaultButton(QDialogButtonBox::Yes); - } - else - mb.setStandardButtons(QDialogButtonBox::Ok); - - mb.exec(); - - if (mb.isChecked()) - theConf->SetValue("Options/IgnoredUpdates", IgnoredUpdates << MsgHash); - - if (mb.clickedStandardButton() == QDialogButtonBox::Yes) - { - QDesktopServices::openUrl(InfoUrl); - } - - bNothing = false; - } - } - - QString VersionStr = Data["version"].toString(); - if (!VersionStr.isEmpty()) //&& VersionStr != GetVersion()) - { - UCHAR myVersion[4] = { VERSION_UPD, VERSION_REV, VERSION_MIN, VERSION_MJR }; // ntohl - ULONG MyVersion = *(ULONG*)&myVersion; - - ULONG Version = 0; - QStringList Nums = VersionStr.split("."); - for (int i = 0, Bits = 24; i < Nums.count() && Bits >= 0; i++, Bits -= 8) - Version |= (Nums[i].toInt() & 0xFF) << Bits; - - if (Version > MyVersion) - if (bManual || !IgnoredUpdates.contains(VersionStr)) // when checked manually always show result - { - bNothing = false; - //QDateTime Updated = QDateTime::fromTime_t(Data["updated"].toULongLong()); - - QString DownloadUrl = Data["downloadUrl"].toString(); - // 'sha256' - // 'signature' - - if (!DownloadUrl.isEmpty() && theConf->GetInt("Options/DownloadUpdates", 0) == 1) - DownloadUpdates(DownloadUrl, bManual); - else - { - QString UpdateMsg = Data["updateMsg"].toString(); - QString UpdateUrl = Data["updateUrl"].toString(); - - QString FullMessage = UpdateMsg.isEmpty() ? tr("

There is a new version of Sandboxie-Plus available.
New version: %1

").arg(VersionStr) : UpdateMsg; - if (!DownloadUrl.isEmpty()) - FullMessage += tr("

Do you want to download the latest version?

"); - else if (!UpdateUrl.isEmpty()) - FullMessage += tr("

Do you want to go to the download page?

").arg(UpdateUrl); - - CCheckableMessageBox mb(this); - mb.setWindowTitle("Sandboxie-Plus"); - QIcon ico(QLatin1String(":/SandMan.png")); - mb.setIconPixmap(ico.pixmap(64, 64)); - //mb.setTextFormat(Qt::RichText); - mb.setText(FullMessage); - mb.setCheckBoxText(tr("Don't show this message anymore.")); - mb.setCheckBoxVisible(!bManual); - - if (!UpdateUrl.isEmpty() || !DownloadUrl.isEmpty()) { - mb.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No); - mb.setDefaultButton(QDialogButtonBox::Yes); - } - else - mb.setStandardButtons(QDialogButtonBox::Ok); - - mb.exec(); - - if (mb.isChecked()) - theConf->SetValue("Options/IgnoredUpdates", IgnoredUpdates << VersionStr); - - if (mb.clickedStandardButton() == QDialogButtonBox::Yes) - { - if (!DownloadUrl.isEmpty()) - DownloadUpdates(DownloadUrl, bManual); - else - QDesktopServices::openUrl(UpdateUrl); - } - } - } - } - - if (bNothing) - { - theConf->SetValue("Options/NextCheckForUpdates", QDateTime::currentDateTime().addDays(7).toTime_t()); - - if (bManual) { - QMessageBox::information(this, "Sandboxie-Plus", tr("No new updates found, your Sandboxie-Plus is up-to-date.\n" - "\nNote: The update check is often behind the latest GitHub release to ensure that only tested updates are offered.")); - } - } -} - -void CSandMan::DownloadUpdates(const QString& DownloadUrl, bool bManual) -{ - QNetworkRequest Request = QNetworkRequest(DownloadUrl); - Request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); - //Request.setRawHeader("Accept-Encoding", "gzip"); - QNetworkReply* pReply = m_RequestManager->get(Request); - pReply->setProperty("manual", bManual); - connect(pReply, SIGNAL(finished()), this, SLOT(OnUpdateDownload())); - connect(pReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(OnUpdateProgress(qint64, qint64))); - - m_pUpdateProgress = CSbieProgressPtr(new CSbieProgress()); - AddAsyncOp(m_pUpdateProgress); - m_pUpdateProgress->ShowMessage(tr("Downloading new version...")); -} - -void CSandMan::OnUpdateProgress(qint64 bytes, qint64 bytesTotal) -{ - if (bytesTotal != 0 && !m_pUpdateProgress.isNull()) - m_pUpdateProgress->Progress(100 * bytes / bytesTotal); -} - -void CSandMan::OnUpdateDownload() -{ - if (m_pUpdateProgress.isNull()) - return; - - QString TempDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation); - if (TempDir.right(1) != "/") - TempDir += "/"; - - m_pUpdateProgress->Progress(-1); - - QNetworkReply* pReply = qobject_cast(sender()); - bool bManual = pReply->property("manual").toBool(); - quint64 Size = pReply->bytesAvailable(); - QString Name = pReply->request().url().fileName(); - if (Name.isEmpty() || Name.right(4).compare(".exe", Qt::CaseInsensitive) != 0) - Name = "Sandboxie-Plus-Install.exe"; - - QString FilePath = TempDir + Name; - - QFile File(FilePath); - if (File.open(QFile::WriteOnly)) { - while (pReply->bytesAvailable() > 0) - File.write(pReply->read(4096)); - File.close(); - } - - pReply->deleteLater(); - - m_pUpdateProgress->Finish(SB_OK); - m_pUpdateProgress.clear(); - - if (File.size() != Size) { - QMessageBox::critical(this, "Sandboxie-Plus", tr("Failed to download update from: %1").arg(pReply->request().url().toString())); - return; - } - - theConf->SetValue("Options/PendingUpdatePackage", FilePath); - UpdateLabel(); - - if (bManual) - InstallUpdate(); -} - -void CSandMan::InstallUpdate() -{ - QString FilePath = theConf->GetString("Options/PendingUpdatePackage"); - if (FilePath.isEmpty()) - return; - - QString Message = tr("

A Sandboxie-Plus update has been downloaded to the following location:

%1

Do you want to begin the installation? If any programs are running sandboxed, they will be terminated.

") - .arg(FilePath).arg("File:///" + Split2(FilePath, "/", true).first); - int Ret = QMessageBox("Sandboxie-Plus", Message, QMessageBox::Information, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape, QMessageBox::Cancel, this).exec(); - if (Ret == QMessageBox::Cancel) { - theConf->DelValue("Options/PendingUpdatePackage"); - UpdateLabel(); - } - if (Ret != QMessageBox::Yes) - return; - - theAPI->TerminateAll(); - - wstring wFile = FilePath.toStdWString(); - - SHELLEXECUTEINFO si = { 0 }; - si.cbSize = sizeof(SHELLEXECUTEINFO); - si.fMask = SEE_MASK_NOCLOSEPROCESS; - si.hwnd = NULL; - si.lpVerb = L"runas"; - si.lpFile = wFile.c_str(); - si.lpParameters = L"/SILENT"; - si.lpDirectory = NULL; - si.nShow = SW_SHOW; - si.hInstApp = NULL; - - if (ShellExecuteEx(&si)) { - theConf->DelValue("Options/PendingUpdatePackage"); - QApplication::quit(); - } -} - -void CSandMan::OnHelp() -{ - if (sender() == m_pSupport) - QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=donate")); - else if (sender() == m_pForum) - QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=sbie-forum")); - else if (sender() == m_pManual) - QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=sbie-docs")); - else - QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=patreon")); -} - -void CSandMan::OnAbout() -{ - if (sender() == m_pAbout) - { - QString AboutCaption = tr( - "

About Sandboxie-Plus

" - "

Version %1

" - "

Copyright (c) 2020-2022 by DavidXanatos

" - ).arg(GetVersion()); - - QString CertInfo; - if (!g_Certificate.isEmpty()) { - CertInfo = tr("This copy of Sandboxie+ is certified for: %1").arg(GetArguments(g_Certificate, L'\n', L':').value("NAME")); - } else { - CertInfo = tr("Sandboxie+ is free for personal and non-commercial use."); - } - - QString AboutText = tr( - "Sandboxie-Plus is an open source continuation of Sandboxie.
" - "Visit sandboxie-plus.com for more information.
" - "
" - "%3
" - "
" - "Driver version: %1
" - "Features: %2
" - "
" - "Icons from icons8.com" - ).arg(theAPI->GetVersion()).arg(theAPI->GetFeatureStr()).arg(CertInfo); - - QMessageBox *msgBox = new QMessageBox(this); - msgBox->setAttribute(Qt::WA_DeleteOnClose); - msgBox->setWindowTitle(tr("About Sandboxie-Plus")); - msgBox->setText(AboutCaption); - msgBox->setInformativeText(AboutText); - - QIcon ico(QLatin1String(":/SandMan.png")); - msgBox->setIconPixmap(ico.pixmap(128, 128)); - - SafeExec(msgBox); - } - else if (sender() == m_pAboutQt) - QMessageBox::aboutQt(this); -} - -void CSandMan::UpdateCertState() -{ - g_CertInfo.State = theAPI->GetCertState(); - - g_CertInfo.about_to_expire = g_CertInfo.expirers_in_sec && g_CertInfo.expirers_in_sec < (60*60*24*30); - if (g_CertInfo.outdated) - OnLogMessage(tr("The supporter certificate is not valid for this build, please get an updated certificate")); - // outdated always implicates it is no longer valid - else if (g_CertInfo.expired) // may be still valid for the current and older builds - OnLogMessage(tr("The supporter certificate has expired%1, please get an updated certificate") - .arg(g_CertInfo.valid ? tr(", but it remains valid for the current build") : "")); - else if(g_CertInfo.about_to_expire) - OnLogMessage(tr("The supporter certificate will expire in %1 days, please get an updated certificate").arg(g_CertInfo.expirers_in_sec / (60*60*24))); - - emit CertUpdated(); -} - -void CSandMan::UpdateCert() -{ - QString UpdateKey; // for now only patreons can update the cert automatically - if(GetArguments(g_Certificate, L'\n', L':').value("type").indexOf("PATREON") == 0) - UpdateKey = GetArguments(g_Certificate, L'\n', L':').value("UPDATEKEY"); - if (UpdateKey.isEmpty()) { - OpenUrl("https://sandboxie-plus.com/go.php?to=sbie-get-cert"); - return; - } - - if (!m_pUpdateProgress.isNull()) - return; - - m_pUpdateProgress = CSbieProgressPtr(new CSbieProgress()); - AddAsyncOp(m_pUpdateProgress); - m_pUpdateProgress->ShowMessage(tr("Checking for certificate...")); - - if (m_RequestManager == NULL) - m_RequestManager = new CNetworkAccessManager(30 * 1000, this); - - - QUrlQuery Query; - Query.addQueryItem("UpdateKey", UpdateKey); - - QUrl Url("https://sandboxie-plus.com/get_cert.php"); - Url.setQuery(Query); - - QNetworkRequest Request = QNetworkRequest(Url); - Request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); - //Request.setRawHeader("Accept-Encoding", "gzip"); - QNetworkReply* pReply = m_RequestManager->get(Request); - connect(pReply, SIGNAL(finished()), this, SLOT(OnCertCheck())); -} - -void CSandMan::OnCertCheck() -{ - if (m_pUpdateProgress.isNull()) - return; - - QNetworkReply* pReply = qobject_cast(sender()); - QByteArray Reply = pReply->readAll(); - int Code = pReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - pReply->deleteLater(); - - m_pUpdateProgress->Finish(SB_OK); - m_pUpdateProgress.clear(); - - if (Code > 299 || Code < 200) { - QMessageBox::critical(this, "Sandboxie-Plus", tr("No certificate found on server!")); - return; - } - - if (Reply.replace("\r\n","\n").compare(g_Certificate.replace("\r\n","\n"), Qt::CaseInsensitive) == 0){ - QMessageBox::information(this, "Sandboxie-Plus", tr("There is no updated certificate available.")); - return; - } - - QString CertPath = theAPI->GetSbiePath() + "\\Certificate.dat"; - QString TempPath = QDir::tempPath() + "/Sbie+Certificate.dat"; - QFile CertFile(TempPath); - if (CertFile.open(QFile::WriteOnly)) { - CertFile.write(Reply); - CertFile.close(); - } - - WindowsMoveFile(TempPath.replace("/", "\\"), CertPath.replace("/", "\\")); - - if (!theAPI->ReloadCert().IsError()) { - CSettingsWindow::LoadCertificate(); - UpdateCertState(); - } - else { // this should not happen - g_Certificate.clear(); - g_CertInfo.State = 0; - } -} - void CSandMan::SetUITheme() { m_ThemeUpdatePending = false; @@ -2953,234 +2573,7 @@ QT_TRANSLATE_NOOP("CSandBox", "Merging folders: %1 >> %2"), QT_TRANSLATE_NOOP("CSandBox", "Finishing Snapshot Merge..."), }; -////////////////////////////////////////////////////////////////////////////////////////// -// WinSpy based window finder -// -#include -#include "Helpers/FindTool.h" +#include "SandManUpdate.cpp" - -typedef enum DEVICE_SCALE_FACTOR { - DEVICE_SCALE_FACTOR_INVALID = 0, - SCALE_100_PERCENT = 100, - SCALE_120_PERCENT = 120, - SCALE_125_PERCENT = 125, - SCALE_140_PERCENT = 140, - SCALE_150_PERCENT = 150, - SCALE_160_PERCENT = 160, - SCALE_175_PERCENT = 175, - SCALE_180_PERCENT = 180, - SCALE_200_PERCENT = 200, - SCALE_225_PERCENT = 225, - SCALE_250_PERCENT = 250, - SCALE_300_PERCENT = 300, - SCALE_350_PERCENT = 350, - SCALE_400_PERCENT = 400, - SCALE_450_PERCENT = 450, - SCALE_500_PERCENT = 500 -} DEVICE_SCALE_FACTOR; - -typedef HRESULT (CALLBACK *P_GetScaleFactorForMonitor)(HMONITOR, DEVICE_SCALE_FACTOR*); - -UINT GetMonitorScaling(HWND hwnd) -{ - static HINSTANCE shcore = LoadLibrary(L"Shcore.dll"); - if (shcore != nullptr) - { - if (auto getScaleFactorForMonitor = - P_GetScaleFactorForMonitor(GetProcAddress(shcore, "GetScaleFactorForMonitor"))) - { - HMONITOR monitor = - MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); - - DEVICE_SCALE_FACTOR Scale; - - getScaleFactorForMonitor(monitor, &Scale); - - return Scale; - } - } - return 100; -} - - -#define IDD_FINDER_TOOL 111 -#define ID_FINDER_TARGET 112 -#define ID_FINDER_EXPLAIN 113 -#define ID_FINDER_RESULT 114 - -struct SFinderWndData { - int Scale; - HFONT hFont; -}; - -#define DS(x) ((x) * WndData.Scale / 100) - -UINT CALLBACK FindProc(HWND hwndTool, UINT uCode, HWND hwnd) -{ - ULONG pid; - if (uCode == WFN_END) - GetWindowThreadProcessId(hwnd, &pid); - else - pid = 0; - - hwndTool = GetParent(hwndTool); - - SFinderWndData &WndData = *(SFinderWndData*)GetWindowLongPtr(hwndTool, 0); - - if (pid && pid != GetCurrentProcessId()) - { - RECT rc; - GetWindowRect(hwndTool, &rc); - if (rc.bottom - rc.top <= DS(150)) - SetWindowPos(hwndTool, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top + DS(70), SWP_SHOWWINDOW | SWP_NOMOVE); - - CBoxedProcessPtr pProcess = theAPI->GetProcessById(pid); - if (!pProcess.isNull()) - { - wstring result = CSandMan::tr("The selected window is running as part of program %1 in sandbox %2").arg(pProcess->GetProcessName()).arg(pProcess->GetBoxName()).toStdWString(); - - SetWindowText(GetDlgItem(hwndTool, ID_FINDER_RESULT), result.c_str()); - //::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_YES_BOXED), SW_SHOW); - } - else - { - wstring result = CSandMan::tr("The selected window is not running as part of any sandboxed program.").toStdWString(); - - SetWindowText(GetDlgItem(hwndTool, ID_FINDER_RESULT), result.c_str()); - //::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_NOT_BOXED), SW_SHOW); - } - ::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_RESULT), SW_SHOW); - } - else - { - RECT rc; - GetWindowRect(hwndTool, &rc); - if (rc.bottom - rc.top > DS(150)) - SetWindowPos(hwndTool, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top - DS(70), SWP_SHOWWINDOW | SWP_NOMOVE); - - //::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_YES_BOXED), SW_HIDE); - //::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_NOT_BOXED), SW_HIDE); - ::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_RESULT), SW_HIDE); - } - - return 0; -} - -// hwnd: All window processes are passed the handle of the window -// that they belong to in hwnd. -// msg: Current message (e.g., WM_*) from the OS. -// wParam: First message parameter, note that these are more or less -// integers, but they are really just "data chunks" that -// you are expected to memcpy as raw data to float, etc. -// lParam: Second message parameter, same deal as above. -LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_CREATE: - { - CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam; - SFinderWndData &WndData = *(SFinderWndData*)createStruct->lpCreateParams; - SetWindowLongPtr(hwnd, 0, (LONG_PTR)&WndData); - - wstring info = CSandMan::tr("Drag the Finder Tool over a window to select it, then release the mouse to check if the window is sandboxed.").toStdWString(); - - CreateWindow(L"Static", L"", SS_BITMAP | SS_NOTIFY | WS_VISIBLE | WS_CHILD, DS(10), DS(10), DS(32), DS(32), hwnd, (HMENU)ID_FINDER_TARGET, NULL, NULL); - CreateWindow(L"Static", info.c_str(), WS_VISIBLE | WS_CHILD, DS(60), DS(10), DS(180), DS(85), hwnd, (HMENU)ID_FINDER_EXPLAIN, NULL, NULL); - CreateWindow(L"Static", L"", WS_CHILD, DS(60), DS(100), DS(180), DS(50), hwnd, (HMENU)ID_FINDER_RESULT, NULL, NULL); - - WndData.hFont = CreateFont(DS(13), 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Tahoma")); - if (WndData.hFont) { - SendMessage(GetDlgItem(hwnd, ID_FINDER_EXPLAIN), WM_SETFONT, (WPARAM)WndData.hFont, TRUE); - SendMessage(GetDlgItem(hwnd, ID_FINDER_RESULT), WM_SETFONT, (WPARAM)WndData.hFont, TRUE); - } - - MakeFinderTool(GetDlgItem(hwnd, ID_FINDER_TARGET), FindProc); - - break; - } - - case WM_CLOSE: - SFinderWndData &WndData = *(SFinderWndData*)GetWindowLongPtr(hwnd, 0); - - if (WndData.hFont) DeleteObject(WndData.hFont); - - //DestroyWindow(hwnd); - PostQuitMessage(0); - break; - } - - return DefWindowProc(hwnd, msg, wParam, lParam); -} - -DWORD WINAPI FinderThreadFunc(LPVOID lpParam) -{ - MSG msg; - WNDCLASS mainWindowClass = { 0 }; - - HINSTANCE hInstance = NULL; - - // You can set the main window name to anything, but - // typically you should prefix custom window classes - // with something that makes it unique. - mainWindowClass.lpszClassName = TEXT("SBp.WndFinder"); - - mainWindowClass.hInstance = hInstance; - mainWindowClass.hbrBackground = GetSysColorBrush(COLOR_3DFACE); - mainWindowClass.lpfnWndProc = WndProc; - mainWindowClass.hCursor = LoadCursor(0, IDC_ARROW); - - mainWindowClass.cbWndExtra = sizeof(void*); // SFinderWndData - - RegisterClass(&mainWindowClass); - - // Notes: - // - The classname identifies the TYPE of the window. Not a C type. - // This is a (TCHAR*) ID that Windows uses internally. - // - The window name is really just the window text, this is - // commonly used for captions, including the title - // bar of the window itself. - // - parentHandle is considered the "owner" of this - // window. MessageBoxes can use HWND_MESSAGE to - // free them of any window. - // - menuHandle: hMenu specifies the child-window identifier, - // an integer value used by a dialog box - // control to notify its parent about events. - // The application determines the child-window - // identifier; it must be unique for all - // child windows with the same parent window. - - SFinderWndData WndData; - WndData.Scale = GetMonitorScaling(MainWndHandle); - - HWND hwnd = CreateWindow(mainWindowClass.lpszClassName, CSandMan::tr("Sandboxie-Plus - Window Finder").toStdWString().c_str() - , WS_SYSMENU | WS_CAPTION | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, DS(275), DS(135), NULL, 0, hInstance, &WndData); - - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return (int)msg.wParam; -} - -void CSandMan::OnWndFinder() -{ - m_pWndFinder->setEnabled(false); - - HANDLE hThread = CreateThread(NULL, 0, FinderThreadFunc, NULL, 0, NULL); - - QWinEventNotifier* finishedNotifier = new QWinEventNotifier(hThread); - finishedNotifier->setEnabled(true); - connect(finishedNotifier, &QWinEventNotifier::activated, this, [finishedNotifier, this, hThread]() { - CloseHandle(hThread); - - m_pWndFinder->setEnabled(true); - - finishedNotifier->setEnabled(false); - finishedNotifier->deleteLater(); - }); -} +#include "SbieFindWnd.cpp" diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index cbd00e99..3930a4e3 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -34,7 +34,7 @@ public: static QString GetVersion(); - SB_PROGRESS RecoverFiles(const QList>& FileList, int Action = 0); + SB_PROGRESS RecoverFiles(const QString& BoxName, const QList>& FileList, int Action = 0); enum EDelMode { eDefault, @@ -81,7 +81,7 @@ protected: SB_STATUS DisconnectSbie(); SB_RESULT(void*) StopSbie(bool andRemove = false); - static void RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QList>& FileList, int Action = 0); + static void RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QString& BoxName, const QList>& FileList, int Action = 0); QIcon GetTrayIcon(bool isConnected = true); QString GetTrayText(bool isConnected = true); @@ -137,6 +137,7 @@ public slots: void OnQueuedRequest(quint32 ClientPid, quint32 ClientTid, quint32 RequestId, const QVariantMap& Data); void OnFileToRecover(const QString& BoxName, const QString& FilePath, const QString& BoxPath, quint32 ProcessId); + void OnFileRecovered(const QString& BoxName, const QString& FilePath, const QString& BoxPath); bool OpenRecovery(const CSandBoxPtr& pBox, bool& DeleteShapshots, bool bCloseEmpty = false); class CRecoveryWindow* ShowRecovery(const CSandBoxPtr& pBox, bool bFind = true); @@ -236,6 +237,7 @@ private: CPanelWidgetEx* m_pMessageLog; CTraceView* m_pTraceView; + CPanelWidgetEx* m_pRecoveryLog; QMenu* m_pMenuFile; @@ -272,6 +274,7 @@ private: QAction* m_pCleanUpProcesses; QAction* m_pCleanUpMsgLog; QAction* m_pCleanUpTrace; + QAction* m_pCleanUpRecovery; QToolButton* m_pCleanUpButton; QAction* m_pKeepTerminated; QAction* m_pShowAllSessions; diff --git a/SandboxiePlus/SandMan/SandMan.pri b/SandboxiePlus/SandMan/SandMan.pri index e4717035..7be3e23f 100644 --- a/SandboxiePlus/SandMan/SandMan.pri +++ b/SandboxiePlus/SandMan/SandMan.pri @@ -49,16 +49,6 @@ SOURCES += ./main.cpp \ ./Helpers/WindowFromPointEx.cpp \ ./Windows/NewBoxWindow.cpp \ ./Windows/OptionsWindow.cpp \ - ./Windows/OptionsAccess.cpp \ - ./Windows/OptionsAdvanced.cpp \ - ./Windows/OptionsForce.cpp \ - ./Windows/OptionsGeneral.cpp \ - ./Windows/OptionsGrouping.cpp \ - ./Windows/OptionsNetwork.cpp \ - ./Windows/OptionsRecovery.cpp \ - ./Windows/OptionsStart.cpp \ - ./Windows/OptionsStop.cpp \ - ./Windows/OptionsTemplates.cpp \ ./Windows/PopUpWindow.cpp \ ./Windows/RecoveryWindow.cpp \ ./Windows/SettingsWindow.cpp \ diff --git a/SandboxiePlus/SandMan/SandMan.vcxproj b/SandboxiePlus/SandMan/SandMan.vcxproj index a0edcccf..7d748a3c 100644 --- a/SandboxiePlus/SandMan/SandMan.vcxproj +++ b/SandboxiePlus/SandMan/SandMan.vcxproj @@ -208,6 +208,18 @@ + + true + true + true + true + + + true + true + true + true + @@ -220,16 +232,66 @@ - - - - - - - - - - + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + diff --git a/SandboxiePlus/SandMan/SandMan.vcxproj.filters b/SandboxiePlus/SandMan/SandMan.vcxproj.filters index 6dba1fc7..285595b6 100644 --- a/SandboxiePlus/SandMan/SandMan.vcxproj.filters +++ b/SandboxiePlus/SandMan/SandMan.vcxproj.filters @@ -162,6 +162,12 @@ SandMan + + SandMan + + + SandMan + diff --git a/SandboxiePlus/SandMan/SandManUpdate.cpp b/SandboxiePlus/SandMan/SandManUpdate.cpp new file mode 100644 index 00000000..ef6a6f9a --- /dev/null +++ b/SandboxiePlus/SandMan/SandManUpdate.cpp @@ -0,0 +1,420 @@ + +void CSandMan::CheckForUpdates(bool bManual) +{ + if (!m_pUpdateProgress.isNull()) + return; + + m_pUpdateProgress = CSbieProgressPtr(new CSbieProgress()); + AddAsyncOp(m_pUpdateProgress); + m_pUpdateProgress->ShowMessage(tr("Checking for updates...")); + + if (m_RequestManager == NULL) + m_RequestManager = new CNetworkAccessManager(30 * 1000, this); + + + QUrlQuery Query; + Query.addQueryItem("software", "sandboxie-plus"); + //QString Branche = theConf->GetString("Options/ReleaseBranche"); + //if (!Branche.isEmpty()) + // Query.addQueryItem("branche", Branche); + //Query.addQueryItem("version", GetVersion()); + Query.addQueryItem("version", QString::number(VERSION_MJR) + "." + QString::number(VERSION_MIN) + "." + QString::number(VERSION_REV) + "." + QString::number(VERSION_UPD)); + Query.addQueryItem("system", "windows-" + QSysInfo::kernelVersion() + "-" + QSysInfo::currentCpuArchitecture()); + Query.addQueryItem("language", QString::number(m_LanguageId)); + + QString UpdateKey = GetArguments(g_Certificate, L'\n', L':').value("UPDATEKEY"); + if (UpdateKey.isEmpty()) + UpdateKey = theAPI->GetGlobalSettings()->GetText("UpdateKey"); // theConf->GetString("Options/UpdateKey"); + if (!UpdateKey.isEmpty()) + Query.addQueryItem("update_key", UpdateKey); + Query.addQueryItem("auto", bManual ? "0" : "1"); + + QUrl Url("https://sandboxie-plus.com/update.php"); + Url.setQuery(Query); + + QNetworkRequest Request = QNetworkRequest(Url); + Request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); + //Request.setRawHeader("Accept-Encoding", "gzip"); + QNetworkReply* pReply = m_RequestManager->get(Request); + pReply->setProperty("manual", bManual); + connect(pReply, SIGNAL(finished()), this, SLOT(OnUpdateCheck())); +} + +void CSandMan::OnUpdateCheck() +{ + if (m_pUpdateProgress.isNull()) + return; + + QNetworkReply* pReply = qobject_cast(sender()); + bool bManual = pReply->property("manual").toBool(); + QByteArray Reply = pReply->readAll(); + pReply->deleteLater(); + + m_pUpdateProgress->Finish(SB_OK); + m_pUpdateProgress.clear(); + + QVariantMap Data = QJsonDocument::fromJson(Reply).toVariant().toMap(); + if (Data.isEmpty() || Data["error"].toBool()) + { + QString Error = Data.isEmpty() ? tr("server not reachable") : Data["errorMsg"].toString(); + OnLogMessage(tr("Failed to check for updates, error: %1").arg(Error), !bManual); + if (bManual) + QMessageBox::critical(this, "Sandboxie-Plus", tr("Failed to check for updates, error: %1").arg(Error)); + return; + } + + bool bNothing = true; + + QStringList IgnoredUpdates = theConf->GetStringList("Options/IgnoredUpdates"); + + QString UserMsg = Data["userMsg"].toString(); + if (!UserMsg.isEmpty()) + { + QString MsgHash = QCryptographicHash::hash(Data["userMsg"].toByteArray(), QCryptographicHash::Md5).toHex().left(8); + if (!IgnoredUpdates.contains(MsgHash)) + { + QString FullMessage = UserMsg; + QString InfoUrl = Data["infoUrl"].toString(); + if (!InfoUrl.isEmpty()) + FullMessage += tr("

Do you want to go to the info page?

").arg(InfoUrl); + + CCheckableMessageBox mb(this); + mb.setWindowTitle("Sandboxie-Plus"); + QIcon ico(QLatin1String(":/SandMan.png")); + mb.setIconPixmap(ico.pixmap(64, 64)); + //mb.setTextFormat(Qt::RichText); + mb.setText(UserMsg); + mb.setCheckBoxText(tr("Don't show this announcement in the future.")); + + if (!InfoUrl.isEmpty()) { + mb.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No); + mb.setDefaultButton(QDialogButtonBox::Yes); + } + else + mb.setStandardButtons(QDialogButtonBox::Ok); + + mb.exec(); + + if (mb.isChecked()) + theConf->SetValue("Options/IgnoredUpdates", IgnoredUpdates << MsgHash); + + if (mb.clickedStandardButton() == QDialogButtonBox::Yes) + { + QDesktopServices::openUrl(InfoUrl); + } + + bNothing = false; + } + } + + QString VersionStr = Data["version"].toString(); + if (!VersionStr.isEmpty()) //&& VersionStr != GetVersion()) + { + UCHAR myVersion[4] = { VERSION_UPD, VERSION_REV, VERSION_MIN, VERSION_MJR }; // ntohl + ULONG MyVersion = *(ULONG*)&myVersion; + + ULONG Version = 0; + QStringList Nums = VersionStr.split("."); + for (int i = 0, Bits = 24; i < Nums.count() && Bits >= 0; i++, Bits -= 8) + Version |= (Nums[i].toInt() & 0xFF) << Bits; + + if (Version > MyVersion) + if (bManual || !IgnoredUpdates.contains(VersionStr)) // when checked manually always show result + { + bNothing = false; + //QDateTime Updated = QDateTime::fromTime_t(Data["updated"].toULongLong()); + + QString DownloadUrl = Data["downloadUrl"].toString(); + // 'sha256' + // 'signature' + + if (!DownloadUrl.isEmpty() && theConf->GetInt("Options/DownloadUpdates", 0) == 1) + DownloadUpdates(DownloadUrl, bManual); + else + { + QString UpdateMsg = Data["updateMsg"].toString(); + QString UpdateUrl = Data["updateUrl"].toString(); + + QString FullMessage = UpdateMsg.isEmpty() ? tr("

There is a new version of Sandboxie-Plus available.
New version: %1

").arg(VersionStr) : UpdateMsg; + if (!DownloadUrl.isEmpty()) + FullMessage += tr("

Do you want to download the latest version?

"); + else if (!UpdateUrl.isEmpty()) + FullMessage += tr("

Do you want to go to the download page?

").arg(UpdateUrl); + + CCheckableMessageBox mb(this); + mb.setWindowTitle("Sandboxie-Plus"); + QIcon ico(QLatin1String(":/SandMan.png")); + mb.setIconPixmap(ico.pixmap(64, 64)); + //mb.setTextFormat(Qt::RichText); + mb.setText(FullMessage); + mb.setCheckBoxText(tr("Don't show this message anymore.")); + mb.setCheckBoxVisible(!bManual); + + if (!UpdateUrl.isEmpty() || !DownloadUrl.isEmpty()) { + mb.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No); + mb.setDefaultButton(QDialogButtonBox::Yes); + } + else + mb.setStandardButtons(QDialogButtonBox::Ok); + + mb.exec(); + + if (mb.isChecked()) + theConf->SetValue("Options/IgnoredUpdates", IgnoredUpdates << VersionStr); + + if (mb.clickedStandardButton() == QDialogButtonBox::Yes) + { + if (!DownloadUrl.isEmpty()) + DownloadUpdates(DownloadUrl, bManual); + else + QDesktopServices::openUrl(UpdateUrl); + } + } + } + } + + if (bNothing) + { + theConf->SetValue("Options/NextCheckForUpdates", QDateTime::currentDateTime().addDays(7).toTime_t()); + + if (bManual) { + QMessageBox::information(this, "Sandboxie-Plus", tr("No new updates found, your Sandboxie-Plus is up-to-date.\n" + "\nNote: The update check is often behind the latest GitHub release to ensure that only tested updates are offered.")); + } + } +} + +void CSandMan::DownloadUpdates(const QString& DownloadUrl, bool bManual) +{ + QNetworkRequest Request = QNetworkRequest(DownloadUrl); + Request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); + //Request.setRawHeader("Accept-Encoding", "gzip"); + QNetworkReply* pReply = m_RequestManager->get(Request); + pReply->setProperty("manual", bManual); + connect(pReply, SIGNAL(finished()), this, SLOT(OnUpdateDownload())); + connect(pReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(OnUpdateProgress(qint64, qint64))); + + m_pUpdateProgress = CSbieProgressPtr(new CSbieProgress()); + AddAsyncOp(m_pUpdateProgress); + m_pUpdateProgress->ShowMessage(tr("Downloading new version...")); +} + +void CSandMan::OnUpdateProgress(qint64 bytes, qint64 bytesTotal) +{ + if (bytesTotal != 0 && !m_pUpdateProgress.isNull()) + m_pUpdateProgress->Progress(100 * bytes / bytesTotal); +} + +void CSandMan::OnUpdateDownload() +{ + if (m_pUpdateProgress.isNull()) + return; + + QString TempDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation); + if (TempDir.right(1) != "/") + TempDir += "/"; + + m_pUpdateProgress->Progress(-1); + + QNetworkReply* pReply = qobject_cast(sender()); + bool bManual = pReply->property("manual").toBool(); + quint64 Size = pReply->bytesAvailable(); + QString Name = pReply->request().url().fileName(); + if (Name.isEmpty() || Name.right(4).compare(".exe", Qt::CaseInsensitive) != 0) + Name = "Sandboxie-Plus-Install.exe"; + + QString FilePath = TempDir + Name; + + QFile File(FilePath); + if (File.open(QFile::WriteOnly)) { + while (pReply->bytesAvailable() > 0) + File.write(pReply->read(4096)); + File.close(); + } + + pReply->deleteLater(); + + m_pUpdateProgress->Finish(SB_OK); + m_pUpdateProgress.clear(); + + if (File.size() != Size) { + QMessageBox::critical(this, "Sandboxie-Plus", tr("Failed to download update from: %1").arg(pReply->request().url().toString())); + return; + } + + theConf->SetValue("Options/PendingUpdatePackage", FilePath); + UpdateLabel(); + + if (bManual) + InstallUpdate(); +} + +void CSandMan::InstallUpdate() +{ + QString FilePath = theConf->GetString("Options/PendingUpdatePackage"); + if (FilePath.isEmpty()) + return; + + QString Message = tr("

A Sandboxie-Plus update has been downloaded to the following location:

%1

Do you want to begin the installation? If any programs are running sandboxed, they will be terminated.

") + .arg(FilePath).arg("File:///" + Split2(FilePath, "/", true).first); + int Ret = QMessageBox("Sandboxie-Plus", Message, QMessageBox::Information, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape, QMessageBox::Cancel, this).exec(); + if (Ret == QMessageBox::Cancel) { + theConf->DelValue("Options/PendingUpdatePackage"); + UpdateLabel(); + } + if (Ret != QMessageBox::Yes) + return; + + theAPI->TerminateAll(); + + wstring wFile = FilePath.toStdWString(); + + SHELLEXECUTEINFO si = { 0 }; + si.cbSize = sizeof(SHELLEXECUTEINFO); + si.fMask = SEE_MASK_NOCLOSEPROCESS; + si.hwnd = NULL; + si.lpVerb = L"runas"; + si.lpFile = wFile.c_str(); + si.lpParameters = L"/SILENT"; + si.lpDirectory = NULL; + si.nShow = SW_SHOW; + si.hInstApp = NULL; + + if (ShellExecuteEx(&si)) { + theConf->DelValue("Options/PendingUpdatePackage"); + QApplication::quit(); + } +} + +void CSandMan::OnHelp() +{ + if (sender() == m_pSupport) + QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=donate")); + else if (sender() == m_pForum) + QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=sbie-forum")); + else if (sender() == m_pManual) + QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=sbie-docs")); + else + QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=patreon")); +} + +void CSandMan::OnAbout() +{ + if (sender() == m_pAbout) + { + QString AboutCaption = tr( + "

About Sandboxie-Plus

" + "

Version %1

" + "

Copyright (c) 2020-2022 by DavidXanatos

" + ).arg(GetVersion()); + + QString CertInfo; + if (!g_Certificate.isEmpty()) { + CertInfo = tr("This copy of Sandboxie+ is certified for: %1").arg(GetArguments(g_Certificate, L'\n', L':').value("NAME")); + } else { + CertInfo = tr("Sandboxie+ is free for personal and non-commercial use."); + } + + QString AboutText = tr( + "Sandboxie-Plus is an open source continuation of Sandboxie.
" + "Visit sandboxie-plus.com for more information.
" + "
" + "%3
" + "
" + "Driver version: %1
" + "Features: %2
" + "
" + "Icons from icons8.com" + ).arg(theAPI->GetVersion()).arg(theAPI->GetFeatureStr()).arg(CertInfo); + + QMessageBox *msgBox = new QMessageBox(this); + msgBox->setAttribute(Qt::WA_DeleteOnClose); + msgBox->setWindowTitle(tr("About Sandboxie-Plus")); + msgBox->setText(AboutCaption); + msgBox->setInformativeText(AboutText); + + QIcon ico(QLatin1String(":/SandMan.png")); + msgBox->setIconPixmap(ico.pixmap(128, 128)); + + SafeExec(msgBox); + } + else if (sender() == m_pAboutQt) + QMessageBox::aboutQt(this); +} + +void CSandMan::UpdateCert() +{ + QString UpdateKey; // for now only patreons can update the cert automatically + if(GetArguments(g_Certificate, L'\n', L':').value("type").indexOf("PATREON") == 0) + UpdateKey = GetArguments(g_Certificate, L'\n', L':').value("UPDATEKEY"); + if (UpdateKey.isEmpty()) { + OpenUrl("https://sandboxie-plus.com/go.php?to=sbie-get-cert"); + return; + } + + if (!m_pUpdateProgress.isNull()) + return; + + m_pUpdateProgress = CSbieProgressPtr(new CSbieProgress()); + AddAsyncOp(m_pUpdateProgress); + m_pUpdateProgress->ShowMessage(tr("Checking for certificate...")); + + if (m_RequestManager == NULL) + m_RequestManager = new CNetworkAccessManager(30 * 1000, this); + + + QUrlQuery Query; + Query.addQueryItem("UpdateKey", UpdateKey); + + QUrl Url("https://sandboxie-plus.com/get_cert.php"); + Url.setQuery(Query); + + QNetworkRequest Request = QNetworkRequest(Url); + Request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); + //Request.setRawHeader("Accept-Encoding", "gzip"); + QNetworkReply* pReply = m_RequestManager->get(Request); + connect(pReply, SIGNAL(finished()), this, SLOT(OnCertCheck())); +} + +void CSandMan::OnCertCheck() +{ + if (m_pUpdateProgress.isNull()) + return; + + QNetworkReply* pReply = qobject_cast(sender()); + QByteArray Reply = pReply->readAll(); + int Code = pReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + pReply->deleteLater(); + + m_pUpdateProgress->Finish(SB_OK); + m_pUpdateProgress.clear(); + + if (Code > 299 || Code < 200) { + QMessageBox::critical(this, "Sandboxie-Plus", tr("No certificate found on server!")); + return; + } + + if (Reply.replace("\r\n","\n").compare(g_Certificate.replace("\r\n","\n"), Qt::CaseInsensitive) == 0){ + QMessageBox::information(this, "Sandboxie-Plus", tr("There is no updated certificate available.")); + return; + } + + QString CertPath = theAPI->GetSbiePath() + "\\Certificate.dat"; + QString TempPath = QDir::tempPath() + "/Sbie+Certificate.dat"; + QFile CertFile(TempPath); + if (CertFile.open(QFile::WriteOnly)) { + CertFile.write(Reply); + CertFile.close(); + } + + WindowsMoveFile(TempPath.replace("/", "\\"), CertPath.replace("/", "\\")); + + if (!theAPI->ReloadCert().IsError()) { + CSettingsWindow::LoadCertificate(); + UpdateCertState(); + } + else { // this should not happen + g_Certificate.clear(); + g_CertInfo.State = 0; + } +} \ No newline at end of file diff --git a/SandboxiePlus/SandMan/SbieFindWnd.cpp b/SandboxiePlus/SandMan/SbieFindWnd.cpp new file mode 100644 index 00000000..a8ff7f37 --- /dev/null +++ b/SandboxiePlus/SandMan/SbieFindWnd.cpp @@ -0,0 +1,232 @@ + +////////////////////////////////////////////////////////////////////////////////////////// +// WinSpy based window finder +// + +#include +#include "Helpers/FindTool.h" + + +typedef enum DEVICE_SCALE_FACTOR { + DEVICE_SCALE_FACTOR_INVALID = 0, + SCALE_100_PERCENT = 100, + SCALE_120_PERCENT = 120, + SCALE_125_PERCENT = 125, + SCALE_140_PERCENT = 140, + SCALE_150_PERCENT = 150, + SCALE_160_PERCENT = 160, + SCALE_175_PERCENT = 175, + SCALE_180_PERCENT = 180, + SCALE_200_PERCENT = 200, + SCALE_225_PERCENT = 225, + SCALE_250_PERCENT = 250, + SCALE_300_PERCENT = 300, + SCALE_350_PERCENT = 350, + SCALE_400_PERCENT = 400, + SCALE_450_PERCENT = 450, + SCALE_500_PERCENT = 500 +} DEVICE_SCALE_FACTOR; + +typedef HRESULT (CALLBACK *P_GetScaleFactorForMonitor)(HMONITOR, DEVICE_SCALE_FACTOR*); + +UINT GetMonitorScaling(HWND hwnd) +{ + static HINSTANCE shcore = LoadLibrary(L"Shcore.dll"); + if (shcore != nullptr) + { + if (auto getScaleFactorForMonitor = + P_GetScaleFactorForMonitor(GetProcAddress(shcore, "GetScaleFactorForMonitor"))) + { + HMONITOR monitor = + MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); + + DEVICE_SCALE_FACTOR Scale; + + getScaleFactorForMonitor(monitor, &Scale); + + return Scale; + } + } + return 100; +} + + +#define IDD_FINDER_TOOL 111 +#define ID_FINDER_TARGET 112 +#define ID_FINDER_EXPLAIN 113 +#define ID_FINDER_RESULT 114 + +struct SFinderWndData { + int Scale; + HFONT hFont; +}; + +#define DS(x) ((x) * WndData.Scale / 100) + +UINT CALLBACK FindProc(HWND hwndTool, UINT uCode, HWND hwnd) +{ + ULONG pid; + if (uCode == WFN_END) + GetWindowThreadProcessId(hwnd, &pid); + else + pid = 0; + + hwndTool = GetParent(hwndTool); + + SFinderWndData &WndData = *(SFinderWndData*)GetWindowLongPtr(hwndTool, 0); + + if (pid && pid != GetCurrentProcessId()) + { + RECT rc; + GetWindowRect(hwndTool, &rc); + if (rc.bottom - rc.top <= DS(150)) + SetWindowPos(hwndTool, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top + DS(70), SWP_SHOWWINDOW | SWP_NOMOVE); + + CBoxedProcessPtr pProcess = theAPI->GetProcessById(pid); + if (!pProcess.isNull()) + { + wstring result = CSandMan::tr("The selected window is running as part of program %1 in sandbox %2").arg(pProcess->GetProcessName()).arg(pProcess->GetBoxName()).toStdWString(); + + SetWindowText(GetDlgItem(hwndTool, ID_FINDER_RESULT), result.c_str()); + //::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_YES_BOXED), SW_SHOW); + } + else + { + wstring result = CSandMan::tr("The selected window is not running as part of any sandboxed program.").toStdWString(); + + SetWindowText(GetDlgItem(hwndTool, ID_FINDER_RESULT), result.c_str()); + //::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_NOT_BOXED), SW_SHOW); + } + ::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_RESULT), SW_SHOW); + } + else + { + RECT rc; + GetWindowRect(hwndTool, &rc); + if (rc.bottom - rc.top > DS(150)) + SetWindowPos(hwndTool, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top - DS(70), SWP_SHOWWINDOW | SWP_NOMOVE); + + //::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_YES_BOXED), SW_HIDE); + //::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_NOT_BOXED), SW_HIDE); + ::ShowWindow(GetDlgItem(hwndTool, ID_FINDER_RESULT), SW_HIDE); + } + + return 0; +} + +// hwnd: All window processes are passed the handle of the window +// that they belong to in hwnd. +// msg: Current message (e.g., WM_*) from the OS. +// wParam: First message parameter, note that these are more or less +// integers, but they are really just "data chunks" that +// you are expected to memcpy as raw data to float, etc. +// lParam: Second message parameter, same deal as above. +LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_CREATE: + { + CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam; + SFinderWndData &WndData = *(SFinderWndData*)createStruct->lpCreateParams; + SetWindowLongPtr(hwnd, 0, (LONG_PTR)&WndData); + + wstring info = CSandMan::tr("Drag the Finder Tool over a window to select it, then release the mouse to check if the window is sandboxed.").toStdWString(); + + CreateWindow(L"Static", L"", SS_BITMAP | SS_NOTIFY | WS_VISIBLE | WS_CHILD, DS(10), DS(10), DS(32), DS(32), hwnd, (HMENU)ID_FINDER_TARGET, NULL, NULL); + CreateWindow(L"Static", info.c_str(), WS_VISIBLE | WS_CHILD, DS(60), DS(10), DS(180), DS(85), hwnd, (HMENU)ID_FINDER_EXPLAIN, NULL, NULL); + CreateWindow(L"Static", L"", WS_CHILD, DS(60), DS(100), DS(180), DS(50), hwnd, (HMENU)ID_FINDER_RESULT, NULL, NULL); + + WndData.hFont = CreateFont(DS(13), 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Tahoma")); + if (WndData.hFont) { + SendMessage(GetDlgItem(hwnd, ID_FINDER_EXPLAIN), WM_SETFONT, (WPARAM)WndData.hFont, TRUE); + SendMessage(GetDlgItem(hwnd, ID_FINDER_RESULT), WM_SETFONT, (WPARAM)WndData.hFont, TRUE); + } + + MakeFinderTool(GetDlgItem(hwnd, ID_FINDER_TARGET), FindProc); + + break; + } + + case WM_CLOSE: + SFinderWndData &WndData = *(SFinderWndData*)GetWindowLongPtr(hwnd, 0); + + if (WndData.hFont) DeleteObject(WndData.hFont); + + //DestroyWindow(hwnd); + PostQuitMessage(0); + break; + } + + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +DWORD WINAPI FinderThreadFunc(LPVOID lpParam) +{ + MSG msg; + WNDCLASS mainWindowClass = { 0 }; + + HINSTANCE hInstance = NULL; + + // You can set the main window name to anything, but + // typically you should prefix custom window classes + // with something that makes it unique. + mainWindowClass.lpszClassName = TEXT("SBp.WndFinder"); + + mainWindowClass.hInstance = hInstance; + mainWindowClass.hbrBackground = GetSysColorBrush(COLOR_3DFACE); + mainWindowClass.lpfnWndProc = WndProc; + mainWindowClass.hCursor = LoadCursor(0, IDC_ARROW); + + mainWindowClass.cbWndExtra = sizeof(void*); // SFinderWndData + + RegisterClass(&mainWindowClass); + + // Notes: + // - The classname identifies the TYPE of the window. Not a C type. + // This is a (TCHAR*) ID that Windows uses internally. + // - The window name is really just the window text, this is + // commonly used for captions, including the title + // bar of the window itself. + // - parentHandle is considered the "owner" of this + // window. MessageBoxes can use HWND_MESSAGE to + // free them of any window. + // - menuHandle: hMenu specifies the child-window identifier, + // an integer value used by a dialog box + // control to notify its parent about events. + // The application determines the child-window + // identifier; it must be unique for all + // child windows with the same parent window. + + SFinderWndData WndData; + WndData.Scale = GetMonitorScaling(MainWndHandle); + + HWND hwnd = CreateWindow(mainWindowClass.lpszClassName, CSandMan::tr("Sandboxie-Plus - Window Finder").toStdWString().c_str() + , WS_SYSMENU | WS_CAPTION | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, DS(275), DS(135), NULL, 0, hInstance, &WndData); + + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return (int)msg.wParam; +} + +void CSandMan::OnWndFinder() +{ + m_pWndFinder->setEnabled(false); + + HANDLE hThread = CreateThread(NULL, 0, FinderThreadFunc, NULL, 0, NULL); + + QWinEventNotifier* finishedNotifier = new QWinEventNotifier(hThread); + finishedNotifier->setEnabled(true); + connect(finishedNotifier, &QWinEventNotifier::activated, this, [finishedNotifier, this, hThread]() { + CloseHandle(hThread); + + m_pWndFinder->setEnabled(true); + + finishedNotifier->setEnabled(false); + finishedNotifier->deleteLater(); + }); +} diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 07bf3789..d033ec11 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -314,8 +314,10 @@ void CSbieView::Refresh() } if (!Added.isEmpty()) { - foreach(const QVariant &ID, Added) - m_Groups[""].append(ID.toString()); + foreach(const QVariant& ID, Added) { + if(ID.type() == QVariant::String) + m_Groups[""].append(ID.toString()); + } QString Grouping = CSbieView__SerializeGroup(m_Groups); theAPI->GetUserSettings()->SetText("BoxDisplayOrder", Grouping); diff --git a/SandboxiePlus/SandMan/Windows/FileBrowserWindow.cpp b/SandboxiePlus/SandMan/Windows/FileBrowserWindow.cpp index b2dcdbd8..cda11636 100644 --- a/SandboxiePlus/SandMan/Windows/FileBrowserWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/FileBrowserWindow.cpp @@ -223,7 +223,7 @@ void CFileBrowserWindow::OnFileMenu(const QPoint&) } } - SB_PROGRESS Status = theGUI->RecoverFiles(FileList, 0); + SB_PROGRESS Status = theGUI->RecoverFiles(m_pBox->GetName(), FileList, 0); if (Status.GetStatus() == OP_ASYNC) theGUI->AddAsyncOp(Status.GetValue()); diff --git a/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp b/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp index e82d6ce9..c3632020 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp @@ -69,7 +69,7 @@ void COptionsWindow::CreateAdvanced() void COptionsWindow::LoadAdvanced() { ui.chkPreferExternalManifest->setChecked(m_pBox->GetBool("PreferExternalManifest", false)); - ui.chkNestedJobs->setChecked(m_pBox->GetBool("AllowBoxedJobs", true)); + ui.chkNestedJobs->setChecked(m_pBox->GetBool("AllowBoxedJobs", false)); ui.chkUseSbieWndStation->setChecked(m_pBox->GetBool("UseSbieWndStation", true)); ui.chkAddToJob->setChecked(!m_pBox->GetBool("NoAddProcessToJob", false)); @@ -179,7 +179,7 @@ void COptionsWindow::SaveAdvanced() WriteAdvancedCheck(ui.chkAddToJob, "NoAddProcessToJob", "", "y"); WriteAdvancedCheck(ui.chkProtectSCM, "UnrestrictedSCM", "", "y"); - WriteAdvancedCheck(ui.chkNestedJobs, "AllowBoxedJobs", "", "n"); + WriteAdvancedCheck(ui.chkNestedJobs, "AllowBoxedJobs", "y", ""); WriteAdvancedCheck(ui.chkRestrictServices, "RunServicesAsSystem", "", "y"); WriteAdvancedCheck(ui.chkElevateRpcss, "RunRpcssAsSystem", "y", ""); WriteAdvancedCheck(ui.chkProtectSystem, "ExposeBoxedSystem", "", "y"); diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp index 1cfe5324..8029131c 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp @@ -799,6 +799,16 @@ void COptionsWindow::SaveIniSection() LoadIniSection(); } +#include "OptionsAccess.cpp" +#include "OptionsAdvanced.cpp" +#include "OptionsForce.cpp" +#include "OptionsGeneral.cpp" +#include "OptionsGrouping.cpp" +#include "OptionsNetwork.cpp" +#include "OptionsRecovery.cpp" +#include "OptionsStart.cpp" +#include "OptionsStop.cpp" +#include "OptionsTemplates.cpp" #include diff --git a/SandboxiePlus/SandMan/Windows/PopUpWindow.cpp b/SandboxiePlus/SandMan/Windows/PopUpWindow.cpp index cfe6f92d..d49ccc73 100644 --- a/SandboxiePlus/SandMan/Windows/PopUpWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/PopUpWindow.cpp @@ -380,7 +380,7 @@ void CPopUpWindow::OnRecoverFile(int Action) QList> FileList; FileList.append(qMakePair(pEntry->m_BoxPath, RecoveryFolder + "\\" + FileName)); - SB_PROGRESS Status = theGUI->RecoverFiles(FileList, Action); + SB_PROGRESS Status = theGUI->RecoverFiles(pEntry->m_BoxName, FileList, Action); if (Status.GetStatus() == OP_ASYNC) theGUI->AddAsyncOp(Status.GetValue()); diff --git a/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp b/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp index 0542f4f6..4c730cbf 100644 --- a/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp @@ -481,7 +481,7 @@ void CRecoveryWindow::RecoverFiles(bool bBrowse, QString RecoveryFolder) } - SB_PROGRESS Status = theGUI->RecoverFiles(FileList); + SB_PROGRESS Status = theGUI->RecoverFiles(m_pBox->GetName(), FileList); if (Status.GetStatus() == OP_ASYNC) { connect(Status.GetValue().data(), SIGNAL(Finished()), this, SLOT(FindFiles())); diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index 643e9735..f8ccff3e 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -2,7 +2,7 @@ #define VERSION_MJR 1 #define VERSION_MIN 1 -#define VERSION_REV 1 +#define VERSION_REV 2 #define VERSION_UPD 0 #ifndef STR From be560fadff76d7adf2bcdcdf32bcb738a04ec7db Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Wed, 8 Jun 2022 21:30:29 +0200 Subject: [PATCH 03/19] 1.1.2 --- Sandboxie/core/dll/advapi.c | 72 +++++++++++--------------------- Sandboxie/core/dll/gui.c | 6 --- Sandboxie/core/dll/guienum.c | 1 - Sandboxie/core/svc/GuiServer.cpp | 31 ++------------ Sandboxie/core/svc/GuiServer.h | 2 +- Sandboxie/core/svc/GuiWire.h | 2 - Sandboxie/install/Templates.ini | 7 ++-- 7 files changed, 32 insertions(+), 89 deletions(-) diff --git a/Sandboxie/core/dll/advapi.c b/Sandboxie/core/dll/advapi.c index 2ed9b798..8065a4e2 100644 --- a/Sandboxie/core/dll/advapi.c +++ b/Sandboxie/core/dll/advapi.c @@ -112,11 +112,8 @@ typedef BOOL (*P_SaferComputeTokenFromLevel)( typedef ULONG (*P_GetEffectiveRightsFromAcl)( PACL pacl, void *pTrustee, PACCESS_MASK pAccessRights); -//typedef BOOL (*P_EnumWindowStations) (WINSTAENUMPROC lpEnumFunc, LPARAM lParam); -//typedef HANDLE (*P_OpenWindowStationW) (LPCWSTR lpszWinSta, BOOL fInherit, ACCESS_MASK dwDesiredAccess); -// -//typedef BOOL (*P_EnumDesktopsW) (HWINSTA hwinsta, DESKTOPENUMPROCW lpEnumFunc, LPARAM lParam); -//typedef HANDLE (*P_OpenDesktopW) (LPCWSTR lpszDesktop, DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess); +typedef BOOL (*P_EnumWindowStations) (_In_ WINSTAENUMPROC lpEnumFunc, _In_ LPARAM lParam); +typedef HANDLE (*P_OpenWindowStationW) (LPCWSTR lpszWinSta, BOOL fInherit, ACCESS_MASK dwDesiredAccess); //--------------------------------------------------------------------------- @@ -158,12 +155,8 @@ typedef ULONG (*P_GetEffectiveRightsFromAcl)( P_SaferComputeTokenFromLevel __sys_SaferComputeTokenFromLevel = NULL; P_GetEffectiveRightsFromAcl __sys_GetEffectiveRightsFromAclW = NULL; - - //P_EnumWindowStations __sys_EnumWindowStationsW = NULL; - //P_OpenWindowStationW __sys_OpenWindowStationW = NULL; - -//extern P_EnumDesktopsW __sys_EnumDesktopsW; -//extern P_OpenDesktopW __sys_OpenDesktopW; + P_EnumWindowStations __sys_EnumWindowStationsW = NULL; + P_OpenWindowStationW __sys_OpenWindowStationW = NULL; static HMODULE AdvApi_Module = NULL; @@ -496,8 +489,12 @@ _FX ULONG AdvApi_CreateRestrictedToken( } -/*HANDLE Sandboxie_WinSta = 0; -HANDLE Sandboxie_Desktop = 0; + +HANDLE Sandboxie_WinSta = 0; + +BOOL CALLBACK myEnumWindowStationProc( + _In_ LPTSTR lpszWindowStation, + _In_ LPARAM lParam); // Get Sandbox Dummy WindowStation Handle BOOL CALLBACK myEnumWindowStationProc( @@ -514,37 +511,6 @@ BOOL CALLBACK myEnumWindowStationProc( return TRUE; } -BOOL CALLBACK myEnumDesktopsProc( - _In_ LPTSTR lpszDesktop, - _In_ LPARAM lParam) -{ - if ((!lpszDesktop) || (!__sys_OpenDesktopW)) { - return FALSE; - } - if (!_wcsnicmp(lpszDesktop, L"Sandbox", 7)) { - const ACCESS_MASK DESKTOP_ALL_ACCESS = 0x1FF; // see WinUser.h - Sandboxie_Desktop = __sys_OpenDesktopW(lpszDesktop, 0, FALSE, DESKTOP_ALL_ACCESS); - return FALSE; - } - return TRUE; -} - - -_FX VOID OpenWinSta() -{ - if (!Sandboxie_WinSta) { - __sys_EnumWindowStationsW = (P_EnumWindowStations)Ldr_GetProcAddrNew(L"User32.dll", L"EnumWindowStationsW", "EnumWindowStationsW"); - __sys_OpenWindowStationW = (P_OpenWindowStationW)Ldr_GetProcAddrNew(L"User32.dll", L"OpenWindowStationW", "OpenWindowStationW"); - if (__sys_EnumWindowStationsW) { - __sys_EnumWindowStationsW(myEnumWindowStationProc, 0); - - if (Sandboxie_WinSta) { - if (__sys_EnumDesktopsW) - __sys_EnumDesktopsW(Sandboxie_WinSta, myEnumDesktopsProc, 0); - } - } - } -}*/ // Chrome 52+ now needs to be able to create a WindowStation and Desktop for its sandbox // GetSecurityInfo will fail when chrome tries to do a DACL read on the default WindowStation. @@ -552,8 +518,6 @@ _FX VOID OpenWinSta() // this will allow chrome to create the required WindowStation and Desktop. See comment in // GuiServer.cpp: GuiServer::GetWindowStationAndDesktopName. -extern HANDLE Sandboxie_WinSta; - _FX DWORD AdvApi_GetSecurityInfo( HANDLE handle, SE_OBJECT_TYPE ObjectType, @@ -568,7 +532,13 @@ _FX DWORD AdvApi_GetSecurityInfo( rc = __sys_GetSecurityInfo(handle, ObjectType, SecurityInfo, psidOwner, psidGroup, pDacl, pSacl, ppSecurityDescriptor); if (rc && ObjectType == SE_WINDOW_OBJECT && SecurityInfo == DACL_SECURITY_INFORMATION) { - //OpenWinSta(); + __sys_EnumWindowStationsW = (P_EnumWindowStations)Ldr_GetProcAddrNew(L"User32.dll", L"EnumWindowStationsW", "EnumWindowStationsW"); + __sys_OpenWindowStationW = (P_OpenWindowStationW)Ldr_GetProcAddrNew(L"User32.dll", L"OpenWindowStationW", "OpenWindowStationW"); + if (!Sandboxie_WinSta) { + if (__sys_EnumWindowStationsW) { + rc = __sys_EnumWindowStationsW(myEnumWindowStationProc, 0); + } + } rc = __sys_GetSecurityInfo(Sandboxie_WinSta, ObjectType, SecurityInfo, psidOwner, psidGroup, pDacl, pSacl, ppSecurityDescriptor); } return rc; @@ -783,7 +753,13 @@ _FX DWORD Ntmarta_GetSecurityInfo( rc = __sys_Ntmarta_GetSecurityInfo(handle, ObjectType, SecurityInfo, psidOwner, psidGroup, pDacl, pSacl, ppSecurityDescriptor); if (rc && ObjectType == SE_WINDOW_OBJECT && SecurityInfo == DACL_SECURITY_INFORMATION) { - //OpenWinSta(); + __sys_EnumWindowStationsW = (P_EnumWindowStations)Ldr_GetProcAddrNew(L"User32.dll", L"EnumWindowStationsW", "EnumWindowStationsW"); + __sys_OpenWindowStationW = (P_OpenWindowStationW)Ldr_GetProcAddrNew(L"User32.dll", L"OpenWindowStationW", "OpenWindowStationW"); + if (!Sandboxie_WinSta) { + if (__sys_EnumWindowStationsW) { + rc = __sys_EnumWindowStationsW(myEnumWindowStationProc, 0); + } + } rc = __sys_Ntmarta_GetSecurityInfo(Sandboxie_WinSta, ObjectType, SecurityInfo, psidOwner, psidGroup, pDacl, pSacl, ppSecurityDescriptor); } return rc; diff --git a/Sandboxie/core/dll/gui.c b/Sandboxie/core/dll/gui.c index fc886c89..6f9d94cb 100644 --- a/Sandboxie/core/dll/gui.c +++ b/Sandboxie/core/dll/gui.c @@ -821,9 +821,6 @@ _FX BOOL DisallowWin32kSystemCallsIsOn() extern P_NtSetInformationThread __sys_NtSetInformationThread; -HANDLE Sandboxie_WinSta = NULL; -HANDLE Sandboxie_Desktop = NULL; - _FX BOOLEAN Gui_ConnectToWindowStationAndDesktop(HMODULE User32) { static HDESK _ProcessDesktop = NULL; @@ -903,9 +900,6 @@ _FX BOOLEAN Gui_ConnectToWindowStationAndDesktop(HMODULE User32) errlvl = 2; else { - Sandboxie_WinSta = (HANDLE)rpl->hsbie_winsta; - Sandboxie_Desktop = (HANDLE)rpl->hsbie_desk; - // // locate windowstation and desktop functions in user32 dll // diff --git a/Sandboxie/core/dll/guienum.c b/Sandboxie/core/dll/guienum.c index e85d46e3..6a96779f 100644 --- a/Sandboxie/core/dll/guienum.c +++ b/Sandboxie/core/dll/guienum.c @@ -175,7 +175,6 @@ static BOOLEAN Gui_D3D9_Loaded = FALSE; static ULONG64 Gui_GetShellWindow_LastTicks = 0; -static BOOLEAN Winsta_Hack = FALSE; //--------------------------------------------------------------------------- // Gui_InitEnum diff --git a/Sandboxie/core/svc/GuiServer.cpp b/Sandboxie/core/svc/GuiServer.cpp index 1a341403..576bea0c 100644 --- a/Sandboxie/core/svc/GuiServer.cpp +++ b/Sandboxie/core/svc/GuiServer.cpp @@ -605,7 +605,7 @@ void GuiServer::RunSlave(const WCHAR *cmdline) // create window station // - if (! pThis->GetWindowStationAndDesktopName(NULL, NULL, NULL)) + if (! pThis->GetWindowStationAndDesktopName(NULL)) return; // @@ -1190,7 +1190,7 @@ HANDLE GuiServer::GetJobObject(const WCHAR *boxname) //--------------------------------------------------------------------------- -bool GuiServer::GetWindowStationAndDesktopName(WCHAR *out_name, HANDLE* out_winsta, HANDLE* out_desk) +bool GuiServer::GetWindowStationAndDesktopName(WCHAR *out_name) { static HWINSTA _hWinSta = NULL; static HDESK _hDesk = NULL; @@ -1205,8 +1205,6 @@ bool GuiServer::GetWindowStationAndDesktopName(WCHAR *out_name, HANDLE* out_wins if (out_name) { wcscpy(out_name, _CombinedName); - if (out_winsta) *out_winsta = _hWinSta; - if (out_desk) *out_desk = _hDesk; return true; } @@ -1275,8 +1273,6 @@ bool GuiServer::GetWindowStationAndDesktopName(WCHAR *out_name, HANDLE* out_wins else { - if (out_winsta) *out_winsta = _hWinSta; - if (! SetProcessWindowStation(_hWinSta)) errlvl = 0x62; else { @@ -1289,9 +1285,6 @@ bool GuiServer::GetWindowStationAndDesktopName(WCHAR *out_name, HANDLE* out_wins const ACCESS_MASK DESKTOP_ALL_ACCESS = 0x1FF; // see WinUser.h _hDesk = CreateDesktop(desktop_name, NULL, NULL, 0, DESKTOP_ALL_ACCESS | WRITE_OWNER, &sa); - - if (out_desk) *out_desk = _hDesk; - if (! _hDesk) errlvl = 0x63; @@ -1474,9 +1467,7 @@ ULONG GuiServer::GetWindowStationSlave(SlaveArgs *args) GUI_GET_WINDOW_STATION_RPL *rpl = (GUI_GET_WINDOW_STATION_RPL *)args->rpl_buf; - HANDLE sbie_winsta; - HANDLE sbie_desk; - if (! GetWindowStationAndDesktopName(rpl->name, &sbie_winsta, &sbie_desk)) { + if (! GetWindowStationAndDesktopName(rpl->name)) { status = -1; errlvl = 0x73; goto finish; @@ -1533,22 +1524,6 @@ ULONG GuiServer::GetWindowStationSlave(SlaveArgs *args) goto finish; } - if (! DuplicateHandle(NtCurrentProcess(), sbie_winsta, - hProcess, (HANDLE *)&rpl->hsbie_winsta, - WINSTA_ALL_ACCESS | STANDARD_RIGHTS_REQUIRED, FALSE, 0)) { - status = GetLastError(); - errlvl = 0x85; - goto finish; - } - - if (! DuplicateHandle(NtCurrentProcess(), sbie_desk, - hProcess, (HANDLE *)&rpl->hsbie_desk, - 0, FALSE, DUPLICATE_SAME_ACCESS)) { - status = GetLastError(); - errlvl = 0x86; - goto finish; - } - #ifdef _WIN64 // diff --git a/Sandboxie/core/svc/GuiServer.h b/Sandboxie/core/svc/GuiServer.h index 1536a34b..49993d23 100644 --- a/Sandboxie/core/svc/GuiServer.h +++ b/Sandboxie/core/svc/GuiServer.h @@ -80,7 +80,7 @@ protected: HANDLE GetJobObject(const WCHAR *boxname); - bool GetWindowStationAndDesktopName(WCHAR *out_name, HANDLE* out_winsta, HANDLE* out_desk); + bool GetWindowStationAndDesktopName(WCHAR *out_name); protected: diff --git a/Sandboxie/core/svc/GuiWire.h b/Sandboxie/core/svc/GuiWire.h index 678a1d9c..3eb5d47d 100644 --- a/Sandboxie/core/svc/GuiWire.h +++ b/Sandboxie/core/svc/GuiWire.h @@ -94,8 +94,6 @@ struct tagGUI_GET_WINDOW_STATION_RPL ULONG64 hwinsta; ULONG64 hdesk; WCHAR name[96]; - ULONG64 hsbie_winsta; - ULONG64 hsbie_desk; }; typedef struct tagGUI_GET_WINDOW_STATION_RPL GUI_GET_WINDOW_STATION_RPL; diff --git a/Sandboxie/install/Templates.ini b/Sandboxie/install/Templates.ini index d31ae613..e2a8eb72 100644 --- a/Sandboxie/install/Templates.ini +++ b/Sandboxie/install/Templates.ini @@ -640,9 +640,10 @@ OpenFilePath=msedge.exe,%Tmpl.Edge%\* Tmpl.Title=#4342,Microsoft Edge Tmpl.Class=WebBrowser Tmpl.Url=https://www.microsoft.com/en-us/edge -Tmpl.Scan=s -Tmpl.ScanProduct=Microsoft Edge -Tmpl.ScanService=edgeupdate +# Let it be enabled manually, seams to cause issues on other systems. +#Tmpl.Scan=s +#Tmpl.ScanProduct=Microsoft Edge +#Tmpl.ScanService=edgeupdate PreferExternalManifest=msedge.exe,y # From 1e7210fe4059cc8f2b5b3ed679477d379b735341 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Wed, 8 Jun 2022 21:54:41 +0200 Subject: [PATCH 04/19] 1.1.2 --- Sandboxie/core/dll/sysinfo.c | 2 +- Sandboxie/core/drv/process.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sandboxie/core/dll/sysinfo.c b/Sandboxie/core/dll/sysinfo.c index 5b4babe8..a8a15809 100644 --- a/Sandboxie/core/dll/sysinfo.c +++ b/Sandboxie/core/dll/sysinfo.c @@ -133,7 +133,7 @@ _FX BOOLEAN SysInfo_Init(void) SysInfo_UseSbieJob = !Gui_OpenAllWinClasses && !SbieApi_QueryConfBool(NULL, L"NoAddProcessToJob", FALSE); if (Dll_OsBuild >= 8400) - SysInfo_CanUseJobs = SbieApi_QueryConfBool(NULL, L"AllowBoxedJobs", FALSE); + SysInfo_CanUseJobs = SbieApi_QueryConfBool(NULL, L"AllowBoxedJobs", TRUE); SBIEDLL_HOOK(SysInfo_, NtCreateJobObject); SBIEDLL_HOOK(SysInfo_, NtOpenJobObject); diff --git a/Sandboxie/core/drv/process.c b/Sandboxie/core/drv/process.c index 2e9f7e09..642a1f72 100644 --- a/Sandboxie/core/drv/process.c +++ b/Sandboxie/core/drv/process.c @@ -1348,7 +1348,7 @@ _FX BOOLEAN Process_NotifyProcess_Create( // boxed job to a process will not interfere with the job assigned by SbieSvc // - new_proc->can_use_jobs = Conf_Get_Boolean(new_proc->box->name, L"AllowBoxedJobs", 0, FALSE); + new_proc->can_use_jobs = Conf_Get_Boolean(new_proc->box->name, L"AllowBoxedJobs", 0, TRUE); } // From 744e725c9bac70539f8b9d96a19a6371e5444204 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Wed, 8 Jun 2022 21:54:41 +0200 Subject: [PATCH 05/19] 1.1.2 --- Sandboxie/core/dll/sysinfo.c | 2 +- Sandboxie/core/drv/process.c | 2 +- SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sandboxie/core/dll/sysinfo.c b/Sandboxie/core/dll/sysinfo.c index 5b4babe8..a8a15809 100644 --- a/Sandboxie/core/dll/sysinfo.c +++ b/Sandboxie/core/dll/sysinfo.c @@ -133,7 +133,7 @@ _FX BOOLEAN SysInfo_Init(void) SysInfo_UseSbieJob = !Gui_OpenAllWinClasses && !SbieApi_QueryConfBool(NULL, L"NoAddProcessToJob", FALSE); if (Dll_OsBuild >= 8400) - SysInfo_CanUseJobs = SbieApi_QueryConfBool(NULL, L"AllowBoxedJobs", FALSE); + SysInfo_CanUseJobs = SbieApi_QueryConfBool(NULL, L"AllowBoxedJobs", TRUE); SBIEDLL_HOOK(SysInfo_, NtCreateJobObject); SBIEDLL_HOOK(SysInfo_, NtOpenJobObject); diff --git a/Sandboxie/core/drv/process.c b/Sandboxie/core/drv/process.c index 2e9f7e09..642a1f72 100644 --- a/Sandboxie/core/drv/process.c +++ b/Sandboxie/core/drv/process.c @@ -1348,7 +1348,7 @@ _FX BOOLEAN Process_NotifyProcess_Create( // boxed job to a process will not interfere with the job assigned by SbieSvc // - new_proc->can_use_jobs = Conf_Get_Boolean(new_proc->box->name, L"AllowBoxedJobs", 0, FALSE); + new_proc->can_use_jobs = Conf_Get_Boolean(new_proc->box->name, L"AllowBoxedJobs", 0, TRUE); } // diff --git a/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp b/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp index c3632020..e82d6ce9 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp @@ -69,7 +69,7 @@ void COptionsWindow::CreateAdvanced() void COptionsWindow::LoadAdvanced() { ui.chkPreferExternalManifest->setChecked(m_pBox->GetBool("PreferExternalManifest", false)); - ui.chkNestedJobs->setChecked(m_pBox->GetBool("AllowBoxedJobs", false)); + ui.chkNestedJobs->setChecked(m_pBox->GetBool("AllowBoxedJobs", true)); ui.chkUseSbieWndStation->setChecked(m_pBox->GetBool("UseSbieWndStation", true)); ui.chkAddToJob->setChecked(!m_pBox->GetBool("NoAddProcessToJob", false)); @@ -179,7 +179,7 @@ void COptionsWindow::SaveAdvanced() WriteAdvancedCheck(ui.chkAddToJob, "NoAddProcessToJob", "", "y"); WriteAdvancedCheck(ui.chkProtectSCM, "UnrestrictedSCM", "", "y"); - WriteAdvancedCheck(ui.chkNestedJobs, "AllowBoxedJobs", "y", ""); + WriteAdvancedCheck(ui.chkNestedJobs, "AllowBoxedJobs", "", "n"); WriteAdvancedCheck(ui.chkRestrictServices, "RunServicesAsSystem", "", "y"); WriteAdvancedCheck(ui.chkElevateRpcss, "RunRpcssAsSystem", "y", ""); WriteAdvancedCheck(ui.chkProtectSystem, "ExposeBoxedSystem", "", "y"); From 3f784238d160b20266ccbfcb59bc6bee4c213d70 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Thu, 9 Jun 2022 20:26:36 +0200 Subject: [PATCH 06/19] 1.1.2 --- Sandboxie/core/dll/advapi.c | 4 ++-- Sandboxie/core/dll/guienum.c | 4 ++-- Sandboxie/core/dll/sxs.c | 9 +++++++++ Sandboxie/install/Templates.ini | 9 ++++----- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Sandboxie/core/dll/advapi.c b/Sandboxie/core/dll/advapi.c index 8065a4e2..050cbe25 100644 --- a/Sandboxie/core/dll/advapi.c +++ b/Sandboxie/core/dll/advapi.c @@ -240,7 +240,7 @@ _FX BOOLEAN AdvApi_Init(HMODULE module) // only hook SetSecurityInfo if this is Chrome. Outlook 2013 uses delayed loading and will cause infinite callbacks // Starting with Win 10, we only want to hook ntmarta!SetSecurityInfo. Do NOT hook advapi!SetSecurityInfo. Delay loading for advapi will cause infinite recursion. // Note: the infinite recursion issue has been resolved int 5.43 - if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { + if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_MOZILLA_FIREFOX) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { SetSecurityInfo = __sys_SetSecurityInfo; GetSecurityInfo = __sys_GetSecurityInfo; SBIEDLL_HOOK(AdvApi_, SetSecurityInfo); @@ -700,7 +700,7 @@ _FX BOOLEAN Ntmarta_Init(HMODULE module) #define GETPROC2(x,s) __sys_Ntmarta_##x##s = (P_##x) Ldr_GetProcAddrNew(DllName_ntmarta, L#x L#s,#x #s); GETPROC2(GetSecurityInfo, ); - if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { + if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_MOZILLA_FIREFOX) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { GetSecurityInfo = __sys_Ntmarta_GetSecurityInfo; if (GetSecurityInfo) diff --git a/Sandboxie/core/dll/guienum.c b/Sandboxie/core/dll/guienum.c index 6a96779f..0c1b1f82 100644 --- a/Sandboxie/core/dll/guienum.c +++ b/Sandboxie/core/dll/guienum.c @@ -632,7 +632,7 @@ _FX HDESK Gui_CreateDesktopW( if (rc) return rc; - if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) + if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_MOZILLA_FIREFOX) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { //Call the system CreateDesktopW without a security context. //This works in tandem with the Ntmarta_GetSecurityInfo hook (see in advapi.c). @@ -666,7 +666,7 @@ _FX HDESK Gui_CreateDesktopA( if (rc) return rc; - if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) + if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_MOZILLA_FIREFOX) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { rc = __sys_CreateDesktopA(lpszDesktop, NULL, NULL, dwFlags, dwDesiredAccess, NULL); if (rc) diff --git a/Sandboxie/core/dll/sxs.c b/Sandboxie/core/dll/sxs.c index 77c2642b..22d70e00 100644 --- a/Sandboxie/core/dll/sxs.c +++ b/Sandboxie/core/dll/sxs.c @@ -2007,6 +2007,15 @@ _FX ULONG Sxs_CheckManifestForCreateProcess(const WCHAR *DosPath) _FX BOOLEAN Sxs_PreferExternal(THREAD_DATA *TlsData) { + // + // KB5014019 breaks edge, it seams making edge start its child processes with + // PreferExternalManifest fixes the issue, but the main process must be loaded normally + // hence we have ExternalManifestHack that checks the parent and not the target + // + + if (Config_GetSettingsForImageName_bool(L"ExternalManifestHack", FALSE)) + return TRUE; + if (!TlsData->proc_image_path) return FALSE; diff --git a/Sandboxie/install/Templates.ini b/Sandboxie/install/Templates.ini index e2a8eb72..672bcd14 100644 --- a/Sandboxie/install/Templates.ini +++ b/Sandboxie/install/Templates.ini @@ -640,11 +640,10 @@ OpenFilePath=msedge.exe,%Tmpl.Edge%\* Tmpl.Title=#4342,Microsoft Edge Tmpl.Class=WebBrowser Tmpl.Url=https://www.microsoft.com/en-us/edge -# Let it be enabled manually, seams to cause issues on other systems. -#Tmpl.Scan=s -#Tmpl.ScanProduct=Microsoft Edge -#Tmpl.ScanService=edgeupdate -PreferExternalManifest=msedge.exe,y +Tmpl.Scan=s +Tmpl.ScanProduct=Microsoft Edge +Tmpl.ScanService=edgeupdate +ExternalManifestHack=msedge.exe,y # # Vivaldi From 2d0f626aab47578960a3d2bbce9c73bde0643c3c Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Thu, 9 Jun 2022 20:30:52 +0200 Subject: [PATCH 07/19] Update SbieView.cpp --- SandboxiePlus/SandMan/Views/SbieView.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index d033ec11..daab1716 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -315,8 +315,11 @@ void CSbieView::Refresh() if (!Added.isEmpty()) { foreach(const QVariant& ID, Added) { - if(ID.type() == QVariant::String) - m_Groups[""].append(ID.toString()); + if (ID.type() == QVariant::String) { + QString id = ID.toString(); + if (id.left(1) == "!") id.remove(0, 1); // remove group group marker "!" + m_Groups[""].append(id); + } } QString Grouping = CSbieView__SerializeGroup(m_Groups); From e8ef63259293a55c8bb1f99dd81e0869dc459697 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Thu, 9 Jun 2022 21:00:41 +0200 Subject: [PATCH 08/19] Update sysinfo.c --- Sandboxie/core/dll/sysinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sandboxie/core/dll/sysinfo.c b/Sandboxie/core/dll/sysinfo.c index a8a15809..5eca1bca 100644 --- a/Sandboxie/core/dll/sysinfo.c +++ b/Sandboxie/core/dll/sysinfo.c @@ -130,7 +130,7 @@ _FX BOOLEAN SysInfo_Init(void) } extern BOOLEAN Gui_OpenAllWinClasses; - SysInfo_UseSbieJob = !Gui_OpenAllWinClasses && !SbieApi_QueryConfBool(NULL, L"NoAddProcessToJob", FALSE); + SysInfo_UseSbieJob = !Gui_OpenAllWinClasses && !SbieApi_QueryConfBool(NULL, L"NoAddProcessToJob", TRUE); if (Dll_OsBuild >= 8400) SysInfo_CanUseJobs = SbieApi_QueryConfBool(NULL, L"AllowBoxedJobs", TRUE); From a72637dfa84434652c577105c668a39185d43875 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Thu, 9 Jun 2022 21:29:18 +0200 Subject: [PATCH 09/19] Update sysinfo.c --- Sandboxie/core/dll/sysinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sandboxie/core/dll/sysinfo.c b/Sandboxie/core/dll/sysinfo.c index 5eca1bca..a8a15809 100644 --- a/Sandboxie/core/dll/sysinfo.c +++ b/Sandboxie/core/dll/sysinfo.c @@ -130,7 +130,7 @@ _FX BOOLEAN SysInfo_Init(void) } extern BOOLEAN Gui_OpenAllWinClasses; - SysInfo_UseSbieJob = !Gui_OpenAllWinClasses && !SbieApi_QueryConfBool(NULL, L"NoAddProcessToJob", TRUE); + SysInfo_UseSbieJob = !Gui_OpenAllWinClasses && !SbieApi_QueryConfBool(NULL, L"NoAddProcessToJob", FALSE); if (Dll_OsBuild >= 8400) SysInfo_CanUseJobs = SbieApi_QueryConfBool(NULL, L"AllowBoxedJobs", TRUE); From e26d98744c31dde3a16835433062a3fb4e51cb38 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Thu, 9 Jun 2022 22:15:11 +0200 Subject: [PATCH 10/19] Update guienum.c --- Sandboxie/core/dll/guienum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sandboxie/core/dll/guienum.c b/Sandboxie/core/dll/guienum.c index 0c1b1f82..0e1af8c4 100644 --- a/Sandboxie/core/dll/guienum.c +++ b/Sandboxie/core/dll/guienum.c @@ -642,7 +642,7 @@ _FX HDESK Gui_CreateDesktopW( //the sandboxie restricted token by dropping the security context. This won't //work without the GetSecurityInfo hook. rc = __sys_CreateDesktopW(lpszDesktop, NULL, NULL, dwFlags, dwDesiredAccess, NULL); - if (rc) + //if (rc) return rc; } @@ -669,7 +669,7 @@ _FX HDESK Gui_CreateDesktopA( if ((Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME) || (Dll_ImageType == DLL_IMAGE_MOZILLA_FIREFOX) || (Dll_ImageType == DLL_IMAGE_ACROBAT_READER) || Config_GetSettingsForImageName_bool(L"UseSbieDeskHack", FALSE)) { rc = __sys_CreateDesktopA(lpszDesktop, NULL, NULL, dwFlags, dwDesiredAccess, NULL); - if (rc) + //if (rc) return rc; } From 39835729ab00ddb6ae42a91dc86b51b689eba27d Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Sat, 11 Jun 2022 11:26:45 +0200 Subject: [PATCH 11/19] Update sxs.c --- Sandboxie/core/dll/sxs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sandboxie/core/dll/sxs.c b/Sandboxie/core/dll/sxs.c index 22d70e00..979a33c4 100644 --- a/Sandboxie/core/dll/sxs.c +++ b/Sandboxie/core/dll/sxs.c @@ -2007,6 +2007,9 @@ _FX ULONG Sxs_CheckManifestForCreateProcess(const WCHAR *DosPath) _FX BOOLEAN Sxs_PreferExternal(THREAD_DATA *TlsData) { + if (!TlsData->proc_image_path) + return FALSE; + // // KB5014019 breaks edge, it seams making edge start its child processes with // PreferExternalManifest fixes the issue, but the main process must be loaded normally @@ -2016,9 +2019,6 @@ _FX BOOLEAN Sxs_PreferExternal(THREAD_DATA *TlsData) if (Config_GetSettingsForImageName_bool(L"ExternalManifestHack", FALSE)) return TRUE; - if (!TlsData->proc_image_path) - return FALSE; - WCHAR *ptr1 = wcsrchr(TlsData->proc_image_path, L'\\'); WCHAR value[16]; From 27b68dec727bc99a20d7b9dd5dd9943397a9d144 Mon Sep 17 00:00:00 2001 From: Zerorigin <36463444+Zerorigin@users.noreply.github.com> Date: Sat, 11 Jun 2022 17:47:36 +0800 Subject: [PATCH 12/19] lupdate sandman_zh_CN.ts --- SandboxiePlus/SandMan/sandman_zh_CN.ts | 525 +++++++++++++------------ 1 file changed, 273 insertions(+), 252 deletions(-) diff --git a/SandboxiePlus/SandMan/sandman_zh_CN.ts b/SandboxiePlus/SandMan/sandman_zh_CN.ts index 9fad23e6..8b2f8858 100644 --- a/SandboxiePlus/SandMan/sandman_zh_CN.ts +++ b/SandboxiePlus/SandMan/sandman_zh_CN.ts @@ -118,7 +118,7 @@ Note: this option is immutable - + 注意:此选项是不可撤销的 @@ -378,13 +378,13 @@ 请输入一则命令 + + - - Group: %1 组: %1 @@ -968,7 +968,7 @@ Full path: %4 Close and Disable Immediate Recovery for this box - + 关闭并禁用此沙盒的立即恢复功能 @@ -985,22 +985,22 @@ Full path: %4 CSandBox - + Waiting for folder: %1 正在等待文件夹: %1 - + Deleting folder: %1 正在删除文件夹: %1 - + Merging folders: %1 &gt;&gt; %2 正在合并文件夹: %1 &gt;&gt; %2 - + Finishing Snapshot Merge... 正在完成快照合并... @@ -1072,322 +1072,337 @@ Full path: %4 CSandMan - + Sandboxie-Plus v%1 Sandboxie-Plus v%1 - + Reset Columns 重置列 - + Copy Cell 复制此格 - + Copy Row 复制此行 - + Copy Panel 复制此表 - + Time|Message 时间|消息 - + Sbie Messages 沙盒消息 - + Trace Log 跟踪日志 - + Show/Hide 显示/隐藏 - + &Sandbox 沙盒(&S) - + Create New Box 新建沙盒 - + Create Box Group 新建沙盒组 - + Terminate All Processes 终止所有进程 - + Window Finder 检查窗口是否在沙盒中运行 - + &Maintenance 维护(&M) - + Connect 连接 - + Disconnect 断开 - + Stop All 停止所有 - + &Advanced 高级(&A) - + Install Driver 安装驱动 - + Start Driver 启动驱动 - + Stop Driver 停止驱动 - + Uninstall Driver 卸载驱动 - + Install Service 安装服务 - + Start Service 启动服务 - + Stop Service 停止服务 - + Uninstall Service 卸载服务 - + Setup Wizard 设置指南 - + Uninstall All 全部卸载 - + Exit 退出 - + &View 视图(&V) - + Simple View 简易视图 - + Advanced View 高级视图 - + Always on Top 窗口置顶 - + Show Hidden Boxes 显示隐藏沙盒 - + Show All Sessions 显示所有会话的进程 - + Refresh View 刷新视图 - + Clean Up 清理 - + Cleanup Processes 清理所有记录 - + Cleanup Message Log 清理消息日志 - + Cleanup Trace Log 清理跟踪日志 - + + Cleanup Recovery Log + 清理恢复日志 + + + Keep terminated 保留终止的进程 - + &Options 选项(&O) - + Global Settings 全局设置 - + Reset all hidden messages 重置所有已隐藏消息 - + Reset all GUI options 重置所有图形界面设置选项 - + Edit ini file 编辑配置文件 - + Reload ini file 重载配置文件 - + Trace Logging 启用跟踪日志 - + &Help 帮助(&H) - + Support Sandboxie-Plus with a Donation 捐赠支持 Sandboxie-Plus - + Visit Support Forum 访问用户支持论坛 - + Online Documentation 在线文档 - + Check for Updates 检查更新 - + About the Qt Framework 关于 Qt 框架 - - + + About Sandboxie-Plus 关于 Sandboxie-Plus - + Cleanup 清理 - + <a href="sbie://update/package" style="color: red;">There is a new build of Sandboxie-Plus available</a> <a href="sbie://update/package" style="color: red;">Sandboxie-Plus 存在可供选择的新构建更新</a> - + Click to install update 应用更新 - + <a href="https://sandboxie-plus.com/go.php?to=patreon">Support Sandboxie-Plus on Patreon</a> <a href="https://sandboxie-plus.com/go.php?to=patreon">在 Patreon 上捐赠 Sandboxie-Plus</a> - + Click to open web browser 在浏览器打开捐赠页面 - + + Time|Box Name|File Path + 时间|沙盒名称|文件路径 + + + + Recovery Log + 恢复日志 + + + Do you want to close Sandboxie Manager? 确定要关闭 Sandboxie 管理器? - + Sandboxie-Plus was running in portable mode, now it has to clean up the created services. This will prompt for administrative privileges. Do you want to do the clean up? @@ -1396,32 +1411,32 @@ Do you want to do the clean up? 是否确认清理? - - - - - - + + + + + + Don't show this message again. 不再显示此消息 - + This box provides enhanced security isolation, it is suitable to test untrusted software. 此类沙盒提供增强的安全隔离,它适用于测试不受信任的软件 - + This box provides standard isolation, it is suitable to run your software to enhance security. 此类沙盒提供标准的隔离,它适用于以安全的方式来运行你的软件 - + This box does not enforce isolation, it is intended to be used as an application compartment for software virtualization only. 此类沙盒不执行隔离,它的目的是将一个应用程序虚拟化 - + This box prevents access to all user data locations, except explicitly granted in the Resource Access options. @@ -1430,134 +1445,134 @@ This box prevents access to all user data locations, except explicitly granted i 此类沙盒将限制沙盒内程序对沙盒外数据的访问,除非在资源访问选项中明确授权 - + Unknown operation '%1' requested via command line 来自命令行的未知操作请求 '%1' - + - Driver/Service NOT Running! - 驱动程序/服务未运行! - + - Deleting Sandbox Content - 正在删除沙盒内容 - + Executing OnBoxDelete: %1 在删除沙盒时执行: %1 - + Auto Deleting %1 Content 自动删除 %1 的内容 - + Auto deleting content of %1 自动删除 %1 的内容 - - - + + + Sandboxie-Plus - Error Sandboxie-Plus - 错误 - + Failed to stop all Sandboxie components 停止全部的 Sandboxie 组件失败 - + Failed to start required Sandboxie components 启动所需的 Sandboxie 组件失败 - + Maintenance operation Successful 维护操作成功 - + Sandboxie config has been reloaded 已重载沙盒配置文件 - + <p>A Sandboxie-Plus update has been downloaded to the following location:</p><p><a href="%2">%1</a></p><p>Do you want to begin the installation? If any programs are running sandboxed, they will be terminated.</p> <p>Sandboxie-Plus 更新包已下载到:</p><p><a href="%2">%1</a></p><p>是否立即安装?(任何在沙盒中运行的程序都将被自动终止)</p> - + The supporter certificate is not valid for this build, please get an updated certificate 此赞助者凭据对该版本沙盒无效,请获取可用的新凭据 - + The supporter certificate has expired%1, please get an updated certificate 此赞助者凭据已过期%1,请获取可用的新凭据 - + , but it remains valid for the current build ,但它对当前构建的沙盒版本仍然有效 - + The supporter certificate will expire in %1 days, please get an updated certificate 此赞助者凭据将在 %1 天后过期,请获取可用的新凭据 - + Checking for certificate... 检索凭据... - + No certificate found on server! 未在服务器检索到凭据! - + There is no updated certificate available. 目前没有可用的凭据更新 - + The selected feature set is only available to project supporters. Processes started in a box with this feature set enabled without a supporter certificate will be terminated after 5 minutes.<br /><a href="https://sandboxie-plus.com/go.php?to=sbie-get-cert">Become a project supporter</a>, and receive a <a href="https://sandboxie-plus.com/go.php?to=sbie-cert">supporter certificate</a> 选定的特性只对项目赞助者可用。如果没有赞助者凭据,在启用该特性的沙盒里启动的进程,将在 5 分钟后将被终止。<br /><a href="https://sandboxie-plus.com/go.php?to=sbie-get-cert">成为项目赞助者</a>,以获得<a href="https://sandboxie-plus.com/go.php?to=sbie-cert">赞助者凭据</a> - + Error Status: 0x%1 (%2) 错误状态: 0x%1 (%2) - + Unknown 未知 - + Failed to remove old box data files 无法删除旧沙盒中的数据文件 - + The operation was canceled by the user 该操作已被用户取消 - + Unknown Error Status: 0x%1 未知错误状态: 0x%1 - + No new updates found, your Sandboxie-Plus is up-to-date. Note: The update check is often behind the latest GitHub release to ensure that only tested updates are offered. @@ -1566,32 +1581,32 @@ Note: The update check is often behind the latest GitHub release to ensure that 注意: 更新检查通常落后于 GitHub 释出的版本,以确保只提供经过测试的更新 - + <h3>About Sandboxie-Plus</h3><p>Version %1</p><p>Copyright (c) 2020-2022 by DavidXanatos</p> <h3>关于 Sandboxie-Plus</h3><p>版本 %1</p><p>Copyright (c) 2020-2022 by DavidXanatos</p> - + This copy of Sandboxie+ is certified for: %1 此 Sandboxie+ 副本已授权给: %1 - + Sandboxie+ is free for personal and non-commercial use. Sandboxie+ 可免费用于个人和非商业用途 - + Sandboxie-Plus is an open source continuation of Sandboxie.<br />Visit <a href="https://sandboxie-plus.com">sandboxie-plus.com</a> for more information.<br /><br />%3<br /><br />Driver version: %1<br />Features: %2<br /><br />Icons from <a href="https://icons8.com">icons8.com</a> Sandboxie-Plus 是著名程序 Sandboxie 自开源以来的一个延续<br />访问 <a href="https://sandboxie-plus.com">sandboxie-plus.com</a> 来了解更多信息<br /><br />%3<br /><br />驱动版本: %1<br />特性: %2<br /><br />图标来源: <a href="https://icons8.com">icons8.com</a> - + Default sandbox not found; creating: %1 未找到默认沙盒,正在创建:%1 - + Do you want to check if there is a new version of Sandboxie-Plus? 您是否想检查有无 Sandboxie-Plus 新版本发布? @@ -1601,28 +1616,28 @@ Note: The update check is often behind the latest GitHub release to ensure that 警告: %1 中的 Sandboxie-Plus.ini 不能被写入,设置将不会被保存 - - + + Pause Forcing Programs 停用必沙程序规则 - + Some compatibility templates (%1) are missing, probably deleted, do you want to remove them from all boxes? 部分兼容性模板(%1)丢失,可能已被删除,是否要在所有沙盒中移除? - + Cleaned up removed templates... 已清理缺失的模板... - + - Portable - 便携版 - + Sandboxie-Plus was started in portable mode, do you want to put the Sandbox folder into its parent directory? Yes will choose: %1 No will choose: %2 @@ -1631,380 +1646,380 @@ No will choose: %2 “否”将选择目录: %2 - + - NOT connected - 未连接 - + The program %1 started in box %2 will be terminated in 5 minutes because the box was configured to use features exclusively available to project supporters. 在沙盒 %2 中启动的程序 %1 将在 5 分钟之后自动终止,因为此沙盒被配置为使用项目赞助者的特供功能 - + The box %1 is configured to use features exclusively available to project supporters, these presets will be ignored. 沙盒 %1 被配置为使用项目赞助者专有的沙盒类型,这些预设选项将被忽略 - + <br /><a href="https://sandboxie-plus.com/go.php?to=sbie-get-cert">Become a project supporter</a>, and receive a <a href="https://sandboxie-plus.com/go.php?to=sbie-cert">supporter certificate</a> <br /><a href="https://sandboxie-plus.com/go.php?to=sbie-get-cert">成为项目赞助者</a>,以获得<a href="https://sandboxie-plus.com/go.php?to=sbie-cert">赞助者凭据</a> - + PID %1: 进程 PID %1: - + %1 (%2): %1 (%2): - + Recovering file %1 to %2 恢复文件 %1 到 %2 - + The file %1 already exists, do you want to overwrite it? 文件 %1 已存在,要覆盖它吗? - + Do this for all files! 对所有文件都执行此操作! - + Failed to recover some files: 部分文件恢复失败: - + Only Administrators can change the config. 仅管理员可更改该配置 - + Please enter the configuration password. 请输入配置保护密码 - + Login Failed: %1 登录失败:%1 - + Do you want to terminate all processes in all sandboxes? 确定要终止所有沙盒中的所有进程吗? - + Terminate all without asking 终止所有且不再询问 - + Sandboxie-Plus was started in portable mode and it needs to create necessary services. This will prompt for administrative privileges. Sandboxie-Plus 正以便携模式启动,需要创建所需的服务,这将会寻求管理员权限 - + CAUTION: Another agent (probably SbieCtrl.exe) is already managing this Sandboxie session, please close it first and reconnect to take over. 警告:另一代理程序 (可能是 SbieCtrl.exe) 已接管当前 Sandboxie 会话,请将其关闭,然后尝试重新连接以接管控制 - + Executing maintenance operation, please wait... 正在执行操作维护,请稍候... - + Do you also want to reset hidden message boxes (yes), or only all log messages (no)? 请确认是否要重置已隐藏的消息框(选“是”),或者仅重置所有日志消息(选“否”)? - + The changes will be applied automatically whenever the file gets saved. 每次该文件被保存时,更改将自动应用 - + The changes will be applied automatically as soon as the editor is closed. 编辑器被关闭后,更改将很快自动应用 - + Administrator rights are required for this operation. 此操作需要管理员权限 - + Failed to execute: %1 执行失败:%1 - + Failed to connect to the driver 连接驱动程序失败 - + Failed to communicate with Sandboxie Service: %1 无法与 Sandboxie 服务通信:%1 - + An incompatible Sandboxie %1 was found. Compatible versions: %2 发现不兼容的 Sandboxie %1,其它兼容的版本:%2 - + Can't find Sandboxie installation path. 无法找到 Sandboxie 的安装路径 - + Failed to copy configuration from sandbox %1: %2 复制沙盒配置 %1: %2 失败 - + A sandbox of the name %1 already exists 名为 %1 的沙盒已存在 - + Failed to delete sandbox %1: %2 删除沙盒 %1: %2 失败 - + The sandbox name can not be longer than 32 characters. 沙盒名称不能超过 32 个字符 - + The sandbox name can not be a device name. 沙盒名称不能为设备名称 - + The sandbox name can contain only letters, digits and underscores which are displayed as spaces. 沙盒名称只能包含字母、数字和下划线(显示为空格) - + Failed to terminate all processes 终止所有进程失败 - + Delete protection is enabled for the sandbox 该沙盒已启用删除保护 - + All sandbox processes must be stopped before the box content can be deleted 在删除沙盒内容之前,必须先停止沙盒内的所有进程 - + Error deleting sandbox folder: %1 删除沙盒文件夹出错:%1 - + A sandbox must be emptied before it can be deleted. 沙盒被删除前必须清空 - + Failed to move directory '%1' to '%2' 移动目录 '%1' 到 '%2' 失败 - + This Snapshot operation can not be performed while processes are still running in the box. 因有进程正在沙盒中运行,此快照操作无法完成 - + Failed to create directory for new snapshot 创建新快照的目录失败 - + Installation Directory: %1 安装目录: %1 - + Sandboxie-Plus Version: %1 (%2) Sandboxie-Plus 版本: %1 (%2) - + Current Config: %1 当前配置: %1 - + Data Directory: %1 数据存放目录: %1 - + Please enter the duration, in seconds, for disabling Forced Programs rules. 请输入「停用必沙程序规则」的持续时间 (单位: 秒) - + Maintenance operation failed (%1) 维护作业执行失败 (%1) - + Failed to copy box data files 复制沙盒数据文件失败 - + Snapshot not found 没有找到快照 - + Error merging snapshot directories '%1' with '%2', the snapshot has not been fully merged. 合并快照目录 '%1' 和 '%2' 出错,快照没有被完全合并 - + Failed to remove old snapshot directory '%1' 移除旧快照的目录 '%1' 失败 - + Can't remove a snapshot that is shared by multiple later snapshots 无法移除被多个后续快照所共享的快照 - + You are not authorized to update configuration in section '%1' 您未被授权在 '%1' 更新配置 - + Failed to set configuration setting %1 in section %2: %3 在 %2: %3 中设定配置设置 %1 失败 - + Can not create snapshot of an empty sandbox 无法为空的沙盒创建快照 - + A sandbox with that name already exists 已存在同名沙盒 - + The config password must not be longer than 64 characters 配置保护密码长度不能超过 64 个字符 - + Operation failed for %1 item(s). %1 项操作失败 - + Do you want to open %1 in a sandboxed (yes) or unsandboxed (no) Web browser? 是否在沙盒中的浏览器打开链接 %1 ? - + Remember choice for later. 记住选择供之后使用 - + Checking for updates... 正在检查更新... - + server not reachable 无法连接到服务器 - - + + Failed to check for updates, error: %1 检查更新失败,错误:%1 - + <p>Do you want to go to the <a href="%1">info page</a>?</p> <p>您是否要前往< "%1">信息页</a>?</p> - + Don't show this announcement in the future. 今后不再显示此公告 - + <p>There is a new version of Sandboxie-Plus available.<br /><font color='red'>New version:</font> <b>%1</b></p> <p>有新版 Sandboxie-Plus 可用,<br /><font color='red'>新版本:</font><b>%1</b></p> - + <p>Do you want to download the latest version?</p> <p>是否下载最新版本?</p> - + <p>Do you want to go to the <a href="%1">download page</a>?</p> <p>是否要打开<a href="%1">下载页面</a>?</p> - + Don't show this message anymore. 不再显示此消息 - + Downloading new version... 正在下载新版本... - + Failed to download update from: %1 从 %1 下载更新文件时失败了 - + The selected window is running as part of program %1 in sandbox %2 选择的窗口正作为程序 %1 的一部分,并运行在沙盒 %2 中 - + The selected window is not running as part of any sandboxed program. 选择的窗口并未作为任何沙盒化程序的一部分而运行 - + Drag the Finder Tool over a window to select it, then release the mouse to check if the window is sandboxed. 拖拽准星到被选窗口上,松开鼠标检查窗口是否来自沙盒化的程序 - + Sandboxie-Plus - Window Finder Sandboxie-Plus - 窗口探查器 @@ -2405,45 +2420,45 @@ No will choose: %2 设置引导进程 - + File root: %1 文件根目录: %1 - + Registry root: %1 注册表根: %1 - + IPC root: %1 IPC 根: %1 - + Options: 选项: - + [None] [无] - + Please enter a new group name 请输入新的组名 - + Do you really want to remove the selected group(s)? 确定要移除选中的组吗? @@ -2523,129 +2538,129 @@ No will choose: %2 下移 - + Please enter a new name for the Group. 为此组指定新的名称 - + Move entries by (negative values move up, positive values move down): 将项目移动的距离(负数向上移动,正数向下移动): - + A group can not be its own parent. 组不能是自己的父级 - + This name is already used for a Box Group. 名称已被用于现有的其它沙盒组 - + This name is already used for a Sandbox. 名称已被用于现有的其它沙盒 - - + + Don't show this message again. 不再显示此消息 - - - + + + This Sandbox is empty. 此沙盒是空的 - + WARNING: The opened registry editor is not sandboxed, please be careful and only do changes to the pre-selected sandbox locations. 警告:打开的注册表编辑器未沙盒化,请审慎且仅对预先选定的沙盒节点进行修改 - + Don't show this warning in future 不再显示此警告 - + Please enter a new name for the duplicated Sandbox. 请为此复制的沙盒输入一个新名称 - + %1 Copy 沙盒名称只能包含字母、数字和下划线,不应对此处的文本进行翻译! %1 Copy - + Please enter a new name for the Sandbox. 请为该沙盒输入新名称 - + Do you really want to remove the selected sandbox(es)?<br /><br />Warning: The box content will also be deleted! 确定要删除选中的沙盒?<br /><br />警告:沙盒内的内容也将被删除! - + This Sandbox is already empty. 此沙盒已清空 - + Do you want to delete the content of the selected sandbox? 确定要删除选中沙盒的内容吗? - - + + Also delete all Snapshots 同时删除所有快照 - + Do you really want to delete the content of all selected sandboxes? 你真的想删除所有选定的沙盒的内容吗? - + Do you want to terminate all processes in the selected sandbox(es)? 确定要终止所选沙盒中的所有进程吗? - - + + Terminate without asking 终止且不再询问 - - + + Create Shortcut to sandbox %1 为沙盒 %1 创建快捷方式 - + Do you want to %1 %2? 确定要%1 %2 吗? - + the selected processes 选中的进程 - + This box does not have Internet restrictions in place, do you want to enable them? 此沙盒无互联网限制,确定启用吗? - + This sandbox is disabled, do you want to enable it? 此沙盒已禁用,确定启用吗? @@ -3059,32 +3074,32 @@ No will choose: %2 Configure <b>Sandboxie-Plus</b> UI - + 配置 <b>Sandboxie-Plus</b> 用户界面 Select the user interface style you prefer. - + 选择你喜欢的用户界面风格 &Advanced UI for experts - + 适合熟手的高级视图(&A) &Simple UI for beginners - + 适合新手的简易视图(&S) Use Bright Mode - + 使用浅色主题 Use Dark Mode - + 使用深色主题 @@ -3092,22 +3107,28 @@ No will choose: %2 Configure <b>Sandboxie-Plus</b> network filtering - + 配置 <b>Sandboxie-Plus</b> 的网络过滤功能 Sandboxie can use the Windows Filtering Platform (WFP) to restrict network access. - + 沙盒可以使用 Windows 筛选平台 (WFP) 来限制网络访问 Using WFP allows Sandboxie to reliably enforce IP/Port based rules for network access. Unlike system level application firewalls, Sandboxie can use different rules in each box for the same application. If you already have a good and reliable application firewall and do not need per box rules, you can leave this option unchecked. Without WFP enabled, Sandboxie will still be able to reliably and entirely block processes from accessing the network. However, this can cause the process to crash, as the driver blocks the required network device endpoints. Even with WFP disabled, Sandboxie offers to set IP/Port based rules, however these will be applied in user mode only and not be enforced by the driver. Hence, without WFP enabled, an intentionally malicious process could bypass those rules, but not the entire network block. - + 启用 WFP 使 Sandboxie 能够可靠地执行基于 IP/端口 的网络访问规则。 +与系统层级的应用防火墙不同,Sandboxie 可以针对同一应用在不同的沙盒内设置不同的规则。 +如果你已有一个更友好、更可靠的应用防火墙,并且不需要针对同一应用在不同沙盒设置不同的规则,则可不勾选此选项。 +如果不启用 WFP,Sandboxie 仍然能够可靠地完全阻止进程访问网络。 +然而,这可能会导致进程崩溃,因为驱动程序会阻止程序访问请求的网络设备端点。 +即使禁用 WFP,Sandboxie 也将提供基于 IP/端口 的规则过滤功能,但此时规则只能在用户态下应用,而无法被驱动程序强制执行。 +因此,如果不启用 WFP,某些恶意程序可能可以绕过这些规则,但不能绕过整个网络区块。 Enable Windows Filtering Platform (WFP) support - + 启用 Windows 筛选平台 (WFP) 功能支持 @@ -3953,7 +3974,7 @@ The process match level has a higher priority than the specificity and describes Allow use of nested job objects (works on Windows 8 and later) Allow use of nested job objects (experimental, works on Windows 8 and later) - 允许使用嵌套作业对象 (job object) (实验性,适用于 Windows 8 及更高版本) + 允许使用嵌套作业对象(job object) (仅适用于 Windows 8 及更高版本) @@ -4296,7 +4317,7 @@ Please note that this values are currently user specific and saved globally for QObject - + Drive %1 磁盘 %1 @@ -4304,27 +4325,27 @@ Please note that this values are currently user specific and saved globally for QPlatformTheme - + OK 确定 - + Apply 应用 - + Cancel 取消 - + &Yes 是(&Y) - + &No 否(&N) From bab9bc38b4c510892e454e549e49fb71eefff97b Mon Sep 17 00:00:00 2001 From: isaak654 Date: Sat, 11 Jun 2022 14:49:33 +0200 Subject: [PATCH 13/19] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2687725..55155653 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -169,7 +169,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Changed - EnableObjectFiltering is now set enabled by default, and replaces Sbie's old process/thread handle filter -- the $: syntax now accepts a wildcard $:* no more specialized wildcards though +- the `$:` syntax now accepts a wildcard `$:*` no more specialized wildcards, though ### Fixed - fixed NtGetNextProcess being fully disabled instead of properly filtered From f61ac60b2e88af275b7b6f7f9c1dd704c5d8141b Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Mon, 13 Jun 2022 20:12:53 +0200 Subject: [PATCH 14/19] 1.1.2 --- CHANGELOG.md | 33 +++++- Sandboxie/core/dll/custom.c | 40 +++++++ SandboxiePlus/QSbieAPI/SbieAPI.cpp | 14 ++- SandboxiePlus/QSbieAPI/SbieAPI.h | 8 +- SandboxiePlus/SandMan/BoxMonitor.cpp | 103 ++++++++++++++---- SandboxiePlus/SandMan/BoxMonitor.h | 16 ++- SandboxiePlus/SandMan/Models/SbieModel.cpp | 4 +- .../SandMan/Resources/Actions/Refresh.png | Bin 0 -> 2297 bytes SandboxiePlus/SandMan/Resources/SandMan.qrc | 1 + SandboxiePlus/SandMan/SandMan.cpp | 41 ++++--- SandboxiePlus/SandMan/SandMan.h | 4 +- SandboxiePlus/SandMan/SbiePlusAPI.cpp | 41 +++++-- SandboxiePlus/SandMan/SbiePlusAPI.h | 8 +- SandboxiePlus/SandMan/Views/SbieView.cpp | 29 ++++- SandboxiePlus/SandMan/Views/SbieView.h | 2 + .../SandMan/Windows/RecoveryWindow.cpp | 10 +- .../SandMan/Windows/RecoveryWindow.h | 3 +- 17 files changed, 286 insertions(+), 71 deletions(-) create mode 100644 SandboxiePlus/SandMan/Resources/Actions/Refresh.png diff --git a/CHANGELOG.md b/CHANGELOG.md index 55155653..fe0b22c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,31 @@ This project adheres to [Semantic Versioning](http://semver.org/). + +## [1.1.2 / 5.56.2] - 2022-06-?? + +### Added +- added missing file recovery log from sbiectrl to sandman [#425](https://github.com/sandboxie-plus/Sandboxie/issues/425) +- Imminent recovery window will now auto close when all files are recovered [#1498](https://github.com/sandboxie-plus/Sandboxie/issues/1498) +- the imminent recovery window of sandman is now by default alway on top like in sbiectrl this can be disabled with "Options/RecoveryOnTop=n" [#1465](https://github.com/sandboxie-plus/Sandboxie/issues/1465) +- added option to toggle Imminent recovery from the presets sub menu [#1653](https://github.com/sandboxie-plus/Sandboxie/issues/1653) +- added option to disable file recovery and or message pop up globally +- added per box refresh opzion [#1945](https://github.com/sandboxie-plus/Sandboxie/issues/1945) + +### Changed +- desktop security workaround used for chrome, firefox and acrobat can now be enabled for all processes using "UseSbieDeskHack=y" +- inproved double click behavioure [#1935](https://github.com/sandboxie-plus/Sandboxie/issues/1935) +- box size info is refreshed on file recovery + +### Fixed +- fixed issue with unnececery sandboxie config reloads introduced in 1.1.1 +- fixed issue with recovery window focus [#1374](https://github.com/sandboxie-plus/Sandboxie/issues/1374) +- fixed issues with desktop objects introduced in 1.1.1 [#1934](https://github.com/sandboxie-plus/Sandboxie/issues/1934) +- fixed issues with edge startup boost using a gpo preset + + + + ## [1.1.1 / 5.56.1] - 2022-06-07 ### Added @@ -169,7 +194,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Changed - EnableObjectFiltering is now set enabled by default, and replaces Sbie's old process/thread handle filter -- the `$:` syntax now accepts a wildcard `$:*` no more specialized wildcards, though +- the $: syntax now accepts a wildcard $:* no more specialized wildcards though ### Fixed - fixed NtGetNextProcess being fully disabled instead of properly filtered @@ -1013,8 +1038,8 @@ Fixed issue with Windows 7 ### Changed - replaced the Process List used by the driver with a much faster Hash Map implementation --- Note: this change provides an almost static system call speed of 1.2µs regardless of the running process count --- The old list, with 100 programs running required 4.5µs; with 200: 12µs; and with 300: 18µs per syscall +-- Note: this change provides an almost static system call speed of 1.2s regardless of the running process count +-- The old list, with 100 programs running required 4.5s; with 200: 12s; and with 300: 18s per syscall -- Note: some of the slowdown was also affecting non-sandboxed applications due to how the driver handles certain callbacks - replaced the per-process Thread List used by the driver with a much faster Hash Map implementation - replaced configuration section list with a hash map to improve configuration performance, and increased line limit to 100000 @@ -1641,7 +1666,7 @@ Fixed issue with Windows 7 - added text filter to templates view - added new compatibility templates: -- Windows 10 core UI component: OpenIpcPath=\BaseNamedObjects\[CoreUI]-* solving issues with Chinese Input and Emojis [#120](https://github.com/sandboxie-plus/Sandboxie/issues/120) [#88](https://github.com/sandboxie-plus/Sandboxie/issues/88) --- Firefox Quantum, access to Windows’ FontCachePort for compatibility with Windows 7 +-- Firefox Quantum, access to Windows's FontCachePort for compatibility with Windows 7 - added experimental debug option "OriginalToken=y" which lets sandboxed processes retain their original unrestricted token -- This option is comparable with "OpenToken=y" and is intended only for testing and debugging, it BREAKS most SECURITY guarantees (!) - added debug option "NoSandboxieDesktop=y" it disables the desktop proxy mechanism diff --git a/Sandboxie/core/dll/custom.c b/Sandboxie/core/dll/custom.c index 9dce878f..ad8d5b42 100644 --- a/Sandboxie/core/dll/custom.c +++ b/Sandboxie/core/dll/custom.c @@ -41,6 +41,7 @@ static BOOLEAN DisableRecycleBin(void); static BOOLEAN DisableWinRS(void); static BOOLEAN DisableWerFaultUI(void); static BOOLEAN EnableMsiDebugging(void); +static BOOLEAN DisableEdgeBoost(void); static BOOLEAN Custom_EnableBrowseNewProcess(void); static BOOLEAN Custom_DisableBHOs(void); static BOOLEAN Custom_OpenWith(void); @@ -87,6 +88,7 @@ _FX BOOLEAN CustomizeSandbox(void) DisableWinRS(); DisableWerFaultUI(); EnableMsiDebugging(); + DisableEdgeBoost(); Custom_EnableBrowseNewProcess(); DeleteShellAssocKeys(0); Custom_DisableBHOs(); @@ -461,6 +463,44 @@ _FX BOOLEAN EnableMsiDebugging(void) } +//--------------------------------------------------------------------------- +// DisableEdgeBoost +// +// Disable esge startup boost +//--------------------------------------------------------------------------- + + +_FX BOOLEAN DisableEdgeBoost(void) +{ + NTSTATUS status; + OBJECT_ATTRIBUTES objattrs; + UNICODE_STRING uni; + HANDLE hKeyRoot; + HANDLE hKeyEdge; + + // Open HKLM + RtlInitUnicodeString(&uni, Custom_PrefixHKLM); + InitializeObjectAttributes(&objattrs, &uni, OBJ_CASE_INSENSITIVE, NULL, NULL); + if (NtOpenKey(&hKeyRoot, KEY_READ, &objattrs) == STATUS_SUCCESS) + { + // open/create WER parent key + RtlInitUnicodeString(&uni, L"SOFTWARE\\Policies\\Microsoft\\Edge"); + InitializeObjectAttributes(&objattrs, &uni, OBJ_CASE_INSENSITIVE, hKeyRoot, NULL); + if (Key_OpenOrCreateIfBoxed(&hKeyEdge, KEY_ALL_ACCESS, &objattrs) == STATUS_SUCCESS) + { + DWORD StartupBoostEnabled = 0; + RtlInitUnicodeString(&uni, L"StartupBoostEnabled"); + status = NtSetValueKey(hKeyEdge, &uni, 0, REG_DWORD, &StartupBoostEnabled, sizeof(StartupBoostEnabled)); + + NtClose(hKeyEdge); + } + NtClose(hKeyRoot); + } + + return TRUE; +} + + //--------------------------------------------------------------------------- // Custom_OpenWith // diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.cpp b/SandboxiePlus/QSbieAPI/SbieAPI.cpp index 85ea9635..f1fc7898 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.cpp +++ b/SandboxiePlus/QSbieAPI/SbieAPI.cpp @@ -1145,6 +1145,7 @@ SB_STATUS CSbieAPI::ReloadBoxes(bool bForceUpdate) { pBox = CSandBoxPtr(NewSandBox(BoxName, this)); m_SandBoxes.insert(BoxName.toLower(), pBox); + emit BoxAdded(pBox); } UpdateBoxPaths(pBox); @@ -1153,8 +1154,11 @@ SB_STATUS CSbieAPI::ReloadBoxes(bool bForceUpdate) pBox->UpdateDetails(); } - foreach(const QString& BoxName, OldSandBoxes.keys()) - m_SandBoxes.remove(BoxName); + foreach(const QString & BoxName, OldSandBoxes.keys()) { + CSandBoxPtr pBox = m_SandBoxes.take(BoxName); + pBox->SetBoxPaths(QString(), QString(), QString()); + emit BoxRemoved(pBox); + } return SB_OK; } @@ -1419,7 +1423,7 @@ SB_STATUS CSbieAPI::UpdateProcesses(bool bKeep, bool bAllSessions) if (pBox->m_ActiveProcessCount == 0) { pBox->m_ActiveProcessCount = 1; pBox->OpenBox(); - emit BoxOpened(pBox->GetName()); + emit BoxOpened(pBox); } pProcess->m_pBox = pBox.data(); @@ -1459,7 +1463,7 @@ SB_STATUS CSbieAPI::UpdateProcesses(bool bKeep, bool bAllSessions) pBox->m_ActiveProcessCount = ActiveProcessCount; if (WasBoxClosed) { pBox->CloseBox(); - emit BoxClosed(pBox->GetName()); + emit BoxClosed(pBox); } } } @@ -2337,7 +2341,7 @@ CBoxedProcessPtr CSbieAPI::OnProcessBoxed(quint32 ProcessId, const QString& Path if (pBox->m_ActiveProcessCount == 0) { pBox->m_ActiveProcessCount = 1; pBox->OpenBox(); - emit BoxOpened(pBox->GetName()); + emit BoxOpened(pBox); } pProcess = CBoxedProcessPtr(NewBoxedProcess(ProcessId, pBox.data())); diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.h b/SandboxiePlus/QSbieAPI/SbieAPI.h index 68f30f61..62c73242 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.h +++ b/SandboxiePlus/QSbieAPI/SbieAPI.h @@ -158,8 +158,12 @@ signals: void LogSbieMessage(quint32 MsgCode, const QStringList& MsgData, quint32 ProcessId); void ProcessBoxed(quint32 ProcessId, const QString& Path, const QString& Box, quint32 ParentId); void FileToRecover(const QString& BoxName, const QString& FilePath, const QString& BoxPath, quint32 ProcessId); - void BoxOpened(const QString& BoxName); - void BoxClosed(const QString& BoxName); + + void BoxAdded(const CSandBoxPtr& pBox); + void BoxOpened(const CSandBoxPtr& pBox); + void BoxClosed(const CSandBoxPtr& pBox); + void BoxRemoved(const CSandBoxPtr& pBox); + void NotAuthorized(bool bLoginRequired, bool &bRetry); void QueuedRequest(quint32 ClientPid, quint32 ClientTid, quint32 RequestId, const QVariantMap& Data); diff --git a/SandboxiePlus/SandMan/BoxMonitor.cpp b/SandboxiePlus/SandMan/BoxMonitor.cpp index 1182c28a..a662ef61 100644 --- a/SandboxiePlus/SandMan/BoxMonitor.cpp +++ b/SandboxiePlus/SandMan/BoxMonitor.cpp @@ -5,14 +5,11 @@ CBoxMonitor::CBoxMonitor() { m_bTerminate = false; - start(); } CBoxMonitor::~CBoxMonitor() { - m_bTerminate = true; - if (!wait(10 * 1000)) - terminate(); + Stop(); } void CBoxMonitor::Notify(const wstring& strDirectory) @@ -25,7 +22,7 @@ void CBoxMonitor::Notify(const wstring& strDirectory) quint64 CBoxMonitor::CounDirSize(const QString& Directory, SBox* Box) { quint64 TotalSize = 0; - if (Box->pBox.isNull() || m_bTerminate) + if (m_bTerminate || Box->pBox.isNull()) return TotalSize; QDir Dir(Directory); @@ -44,6 +41,8 @@ void CBoxMonitor::run() { while (!m_bTerminate) { + Sleep(1000); + m_Mutex.lock(); QList Keys = m_Boxes.keys(); m_Mutex.unlock(); @@ -62,12 +61,14 @@ void CBoxMonitor::run() if (MinScanInterval > 30 * 60 * 1000) MinScanInterval = 30 * 60 * 1000; - if (Box->Changed && (Box->Closed || Box->LastScan == 0 || (CurTick - Box->LastScan) > MinScanInterval)) { + if ((Box->Changed && (!Box->IsWatched || Box->LastScan == 0 || (CurTick - Box->LastScan) > MinScanInterval)) || Box->ForceUpdate) { qDebug() << "Rescanning:" << Key << "(" + QDateTime::currentDateTime().toString() + ")"; quint64 ScanStart = GetCurTick(); + Box->ScanDuration = -1; + Box->TotalSize = CounDirSize(Key, Box); Box->ScanDuration = GetCurTick() - ScanStart; @@ -79,6 +80,7 @@ void CBoxMonitor::run() ); Box->Changed = false; + Box->ForceUpdate = false; } m_Mutex.lock(); @@ -86,14 +88,12 @@ void CBoxMonitor::run() m_Boxes.remove(Key); m_Mutex.unlock(); } - - Sleep(1000); } } void CBoxMonitor::UpdateBox(const QString& Path) { - // Note: this functin runs in the main thread + // Note: this private functin runs in the main thread m_Mutex.lock(); SBox Box = m_Boxes.value(Path); @@ -103,27 +103,86 @@ void CBoxMonitor::UpdateBox(const QString& Path) Box.pBox->SetSize(Box.TotalSize); } -void CBoxMonitor::AddBox(CSandBoxPlus* pBox, bool AndWatch) +void CBoxMonitor::WatchBox(CSandBoxPlus* pBox) { QMutexLocker Lock(&m_Mutex); + if (!isRunning()) start(); - m_Boxes[pBox->GetFileRoot()].pBox = pBox; + SBox& Box = m_Boxes[pBox->GetFileRoot()]; + Box.pBox = pBox; - if (AndWatch) { - m_Boxes[pBox->GetFileRoot()].Closed = false; - AddDirectory(pBox->GetFileRoot().toStdWString().c_str(), true, FILE_NOTIFY_CHANGE_SIZE); - } - else - m_Boxes[pBox->GetFileRoot()].Changed = true; + Box.IsWatched = true; + AddDirectory(pBox->GetFileRoot().toStdWString().c_str(), true, FILE_NOTIFY_CHANGE_SIZE); } -void CBoxMonitor::CloseBox(CSandBoxPlus* pBox, bool AndClear) +void CBoxMonitor::ScanBox(CSandBoxPlus* pBox) { QMutexLocker Lock(&m_Mutex); + if (!isRunning()) start(); - if(AndClear) - m_Boxes[pBox->GetFileRoot()].pBox.clear(); - m_Boxes[pBox->GetFileRoot()].Closed = true; + SBox& Box = m_Boxes[pBox->GetFileRoot()]; + Box.pBox = pBox; - DetachDirectory(pBox->GetFileRoot().toStdWString().c_str()); + Box.ForceUpdate = true; +} + +void CBoxMonitor::CloseBox(CSandBoxPlus* pBox) +{ + QMutexLocker Lock(&m_Mutex); + if (!isRunning()) return; + + SBox& Box = m_Boxes[pBox->GetFileRoot()]; + + if(Box.IsWatched) + DetachDirectory(pBox->GetFileRoot().toStdWString().c_str()); + Box.IsWatched = false; + + //Box.Changed = true; +} + +void CBoxMonitor::RemoveBox(CSandBoxPlus* pBox) +{ + QMutexLocker Lock(&m_Mutex); + if (!isRunning()) return; + + auto I = m_Boxes.find(pBox->GetFileRoot()); + if (I == m_Boxes.end()) + return; + + if(I->IsWatched) + DetachDirectory(pBox->GetFileRoot().toStdWString().c_str()); + I->pBox.clear(); +} + +bool CBoxMonitor::IsScanPending(const CSandBoxPlus* pBox) +{ + QMutexLocker Lock(&m_Mutex); + if (!isRunning()) false; + + auto I = m_Boxes.find(pBox->GetFileRoot()); + if (I == m_Boxes.end()) + return false; + + return (I->Changed && !I->IsWatched) || I->ForceUpdate || I->ScanDuration == -1; +} + +void CBoxMonitor::Stop() +{ + QMutexLocker Lock(&m_Mutex); + if (!isRunning()) return; + + m_bTerminate = true; + + if (!wait(10 * 1000)) { + terminate(); + qDebug() << "Failed to stop monitor thread, terminating!!!"; + } + + while (!m_Boxes.isEmpty()) { + SBox Box = m_Boxes.take(m_Boxes.firstKey()); + if(Box.IsWatched && Box.pBox) + DetachDirectory(Box.pBox->GetFileRoot().toStdWString().c_str()); + } + + m_bTerminate = false; } \ No newline at end of file diff --git a/SandboxiePlus/SandMan/BoxMonitor.h b/SandboxiePlus/SandMan/BoxMonitor.h index 3862c557..596d64ab 100644 --- a/SandboxiePlus/SandMan/BoxMonitor.h +++ b/SandboxiePlus/SandMan/BoxMonitor.h @@ -14,8 +14,14 @@ public: virtual void run(); - void AddBox(CSandBoxPlus* pBox, bool AndWatch = false); - void CloseBox(CSandBoxPlus* pBox, bool AndClear = false); + void WatchBox(CSandBoxPlus* pBox); + void ScanBox(CSandBoxPlus* pBox); + void CloseBox(CSandBoxPlus* pBox); + void RemoveBox(CSandBoxPlus* pBox); + + bool IsScanPending(const CSandBoxPlus* pBox); + + void Stop(); private slots: void UpdateBox(const QString& Path); @@ -25,16 +31,18 @@ protected: struct SBox { SBox() { + ForceUpdate = false; Changed = false; - Closed = false; + IsWatched = false; LastScan = 0; ScanDuration = 0; TotalSize = 0; } QPointer pBox; + bool ForceUpdate; bool Changed; - bool Closed; + bool IsWatched; quint64 LastScan; quint64 ScanDuration; diff --git a/SandboxiePlus/SandMan/Models/SbieModel.cpp b/SandboxiePlus/SandMan/Models/SbieModel.cpp index 59c1aa43..3f50f932 100644 --- a/SandboxiePlus/SandMan/Models/SbieModel.cpp +++ b/SandboxiePlus/SandMan/Models/SbieModel.cpp @@ -233,7 +233,7 @@ QList CSbieModel::Sync(const QMap& BoxList, cons { case eName: Value = pBox->GetName(); break; case eStatus: Value = pBox.objectCast()->GetStatusStr(); break; - case eInfo: Value = bWatchSize ? pBox.objectCast()->GetSize() : 0; break; + case eInfo: Value = pBox.objectCast()->IsEmptyCached() ? -2 : (bWatchSize ? pBox.objectCast()->GetSize() : 0); break; case ePath: Value = pBox->GetFileRoot(); break; } @@ -248,7 +248,7 @@ QList CSbieModel::Sync(const QMap& BoxList, cons switch (section) { case eName: ColValue.Formatted = Value.toString().replace("_", " "); break; - case eInfo: ColValue.Formatted = Value.toULongLong() > 0 ? FormatSize(Value.toULongLong()) : ""; break; + case eInfo: ColValue.Formatted = Value.toULongLong() == -2 ? tr("Empty") : (Value.toULongLong() > 0 ? FormatSize(Value.toULongLong()) : ""); break; } } diff --git a/SandboxiePlus/SandMan/Resources/Actions/Refresh.png b/SandboxiePlus/SandMan/Resources/Actions/Refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..dcd67c440ec9e3e3a13e48c8f6f8c2536e8cf234 GIT binary patch literal 2297 zcmV?iFj8D5Mr8=q*X|yCPFc7 z2}Nx~C0Z$zLYpRS`Ou&|nn+QbG)mM^rG(HtTL`Vf8vzyqECXqvX@KwuI5sv08?U|Z zz4x5yhuv%TVX(n#K6xbT+SWNU^E-29&YXLJVHuWTxt>ryl{Gx;on&{*$J}nd+v(xa zO2XN&)qADsxFZBmNPt@fa7F-!4M_)AoxISQFWZ9#Ir^NdN)+Pd($U6)WtFB60Hi@^ z+~UEZtv;|pun9mD3_*aPUZWDAeWt=+fBtFf2ZQzFra^W;=O0s95&K~5)c9=O&IAR3 zf%fw{wy*Ug(5k~O7`g`71YjeE5E&p~1{4EIQQeOZwQU*8BO0Jc={Cxd~wA&>*By;CbD#TrYiOgGD< z6RZGb61J@IqxqN<9-WgQ8lY={E*Lg}HXGp-2^a(f3G4*Z7!bw)a4M$vI{fW}&XECu z?DxAQ2-}l_Ix-3$LqcD=nSvUXY4vX zQ$%g=-&YUwMxD2$`&~>B3Mau3tN>zs#S$9%c2(O)EZe9I$l%xIi!2np&^LMNwh3BmWOJ6vET9u?tV71X-ihcBbNNe78w^rjH z+^^P5iPTs*VL|kCXxRO30h~IYvXfZ&!-lq_g9WgJBo?GESh6CLWxo>4%b;jkR~s4u zzN=r5eXHCfC(evN-dmm0R%g$L1wcZaa@&o2mK?r(F<%gYwHU_=cce#wnR4v20+XcA zkd`{)T1rbss|}t4sX-VzGqk2=rVgmzy(Apk%q)TNhoR)lQ(tguyqXBR%9 zmZs0`Ga~zb=Pj+C7^$@my7bj(-0ous;YZ6qZEnpc1d{5%3wg~bAdw(G*x+7Lw<&Zf zXA$~R=q}(_91cajtB`tjwAj$}h2u|8{IB(3z9Bl-Vl*V~WJSH5LbiRoU@G?W3w_P+ z6Qpun{NY|@R+uGl`lvHv6Y}YNLjZtCppGR`uj3L5S@u~02v4HLjeH*N>fh}^DO^zp5tGMUEN*cnRNTslK?nu#$)}0j3_kcrcbn#U1_&P zR-L?XYN$Ypeui%UavZV#{`TA9oxvW>$k<+~AFoT!?H9zRp*npcQd=w(5G_LmaV_cY zv0cngc$R=m=keKNb3mL9<;|+w){5ly%ovEoqSVA$5rG0Uz?VHX=N!@P%9(yyvTC?A zscYz6&lF`+SGpfo+oEa8kv%pCge7ryZ`Io>+-hNP#z~*@g_v`8QqDgTQHrP6Z7bmk zs&ME%&lDmqN-sE8bc}=+%^sTrV#X<)+3x_5fYZe_L+^T~XpD-C>Y2*hxPf5y*c^~Z zSe)sjQA1&YIr0|xo*_=Vs!C6C>vw5TQ});#kl+=4e@5L-!FaqwnnR)Ca*D?PS#{enF5M&NvVi{9N=!jB&tt0jet0kJINvV_0JJsRH)Xd4sq!b#8){-D@zGF#n1*_pompSESu@LX9E|1of`4TxTQY5a)j-Y2DkaHFS$l6*;Vj2`E z^JYky7p&y-KmK3h%X~qsn>})diqQdRYSQfS!JL~Z6mb5Md7dCd3uNRDk0HRL!c8H^tcSLQ26X7&)EBFC ziE3pFg^5K100uy@HiuW-s2_O% z5&JdbmFeFH8P-QmT#beV5{lq+8n|~t0DhO5c2N@C7PRjVN9fUcyTUj1DmE|o*Vk^Z zd{h%yO5l3{XuTi|NRJ+ TuO|oz00000NkvXXu0mjf-JwU^ literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/SandMan.qrc b/SandboxiePlus/SandMan/Resources/SandMan.qrc index a716bc30..fecee6dd 100644 --- a/SandboxiePlus/SandMan/Resources/SandMan.qrc +++ b/SandboxiePlus/SandMan/Resources/SandMan.qrc @@ -69,6 +69,7 @@ IconOffCx.png Actions/Monitor.png SideLogo.png + Actions/Refresh.png Boxes/sandbox-b-empty.png diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 3a71d48f..8581d650 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -134,7 +134,7 @@ CSandMan::CSandMan(QWidget *parent) theAPI = new CSbiePlusAPI(this); connect(theAPI, SIGNAL(StatusChanged()), this, SLOT(OnStatusChanged())); - connect(theAPI, SIGNAL(BoxClosed(const QString&)), this, SLOT(OnBoxClosed(const QString&))); + connect(theAPI, SIGNAL(BoxClosed(const CSandBoxPtr&)), this, SLOT(OnBoxClosed(const CSandBoxPtr&))); m_RequestManager = NULL; @@ -322,6 +322,10 @@ void CSandMan::CreateMenus() m_pWndFinder = m_pMenuFile->addAction(CSandMan::GetIcon("finder"), tr("Window Finder"), this, SLOT(OnWndFinder())); m_pDisableForce = m_pMenuFile->addAction(tr("Pause Forcing Programs"), this, SLOT(OnDisableForce())); m_pDisableForce->setCheckable(true); + m_pDisableRecovery = m_pMenuFile->addAction(tr("Disable File Recovery")); + m_pDisableRecovery->setCheckable(true); + m_pDisableMessages = m_pMenuFile->addAction(tr("Disable Message PopUp")); + m_pDisableMessages->setCheckable(true); m_pMenuFile->addSeparator(); m_pMaintenance = m_pMenuFile->addMenu(CSandMan::GetIcon("Maintenance"), tr("&Maintenance")); m_pConnect = m_pMaintenance->addAction(CSandMan::GetIcon("Connect"), tr("Connect"), this, SLOT(OnMaintenance())); @@ -369,7 +373,7 @@ void CSandMan::CreateMenus() m_pMenuView->addSeparator(); - m_pRefreshAll = m_pMenuView->addAction(CSandMan::GetIcon("Recover"), tr("Refresh View"), this, SLOT(OnRefresh())); + m_pRefreshAll = m_pMenuView->addAction(CSandMan::GetIcon("Refresh"), tr("Refresh View"), this, SLOT(OnRefresh())); m_pRefreshAll->setShortcut(QKeySequence("F5")); m_pRefreshAll->setShortcutContext(Qt::WidgetWithChildrenShortcut); this->addAction(m_pRefreshAll); @@ -600,6 +604,8 @@ void CSandMan::CreateTrayMenu() m_pTrayMenu->addAction(m_pEmptyAll); m_pDisableForce2 = m_pTrayMenu->addAction(tr("Pause Forcing Programs"), this, SLOT(OnDisableForce2())); m_pDisableForce2->setCheckable(true); + m_pTrayMenu->addAction(m_pDisableRecovery); + m_pTrayMenu->addAction(m_pDisableMessages); m_pTrayMenu->addSeparator(); /*QWidgetAction* pBoxWidget = new QWidgetAction(m_pTrayMenu); @@ -1064,12 +1070,8 @@ finish: return Ret; } -void CSandMan::OnBoxClosed(const QString& BoxName) +void CSandMan::OnBoxClosed(const CSandBoxPtr& pBox) { - CSandBoxPtr pBox = theAPI->GetBoxByName(BoxName); - if (!pBox) - return; - if (!pBox->GetBool("NeverDelete", false) && pBox->GetBool("AutoDelete", false) && !pBox->IsEmpty()) { bool DeleteShapshots = false; @@ -1078,7 +1080,7 @@ void CSandMan::OnBoxClosed(const QString& BoxName) return; if(theConf->GetBool("Options/AutoBoxOpsNotify", false)) - OnLogMessage(tr("Auto deleting content of %1").arg(BoxName), true); + OnLogMessage(tr("Auto deleting content of %1").arg(pBox->GetName()), true); if (theConf->GetBool("Options/UseAsyncBoxOps", false)) { @@ -1218,6 +1220,8 @@ void CSandMan::OnStatusChanged() m_pBoxView->Clear(); theAPI->WatchIni(false); + + theAPI->StopMonitor(); } m_pSupport->setVisible(g_Certificate.isEmpty()); @@ -1314,9 +1318,10 @@ void CSandMan::OnLogMessage(const QString& Message, bool bNotify) void CSandMan::OnLogSbieMessage(quint32 MsgCode, const QStringList& MsgData, quint32 ProcessId) { - if ((MsgCode & 0xFFFF) == 2198) // file migration progress + if ((MsgCode & 0xFFFF) == 2198 ) // file migration progress { - m_pPopUpWindow->ShowProgress(MsgCode, MsgData, ProcessId); + if (!m_pDisableMessages->isChecked()) + m_pPopUpWindow->ShowProgress(MsgCode, MsgData, ProcessId); return; } @@ -1326,7 +1331,7 @@ void CSandMan::OnLogSbieMessage(quint32 MsgCode, const QStringList& MsgData, qui m_MissingTemplates.append(MsgData[2]); } - if ((MsgCode & 0xFFFF) == 6004) // certificat error + if ((MsgCode & 0xFFFF) == 6004) // certificate error { static quint64 iLastCertWarning = 0; if (iLastCertWarning + 60 < QDateTime::currentDateTime().toTime_t()) { // reset after 60 seconds @@ -1378,7 +1383,7 @@ void CSandMan::OnLogSbieMessage(quint32 MsgCode, const QStringList& MsgData, qui if ((MsgCode & 0xFFFF) == 2111) // process open denided return; // dont pop that one up - if(MsgCode != 0 && theConf->GetBool("Options/ShowNotifications", true)) + if(MsgCode != 0 && theConf->GetBool("Options/ShowNotifications", true) && !m_pDisableMessages->isChecked()) m_pPopUpWindow->AddLogMessage(Message, MsgCode, MsgData, ProcessId); } @@ -1433,7 +1438,7 @@ void CSandMan::OnQueuedRequest(quint32 ClientPid, quint32 ClientTid, quint32 Req void CSandMan::OnFileToRecover(const QString& BoxName, const QString& FilePath, const QString& BoxPath, quint32 ProcessId) { CSandBoxPtr pBox = theAPI->GetBoxByName(BoxName); - if (!pBox.isNull() && pBox.objectCast()->IsRecoverySuspended()) + if ((!pBox.isNull() && pBox.objectCast()->IsRecoverySuspended()) || m_pDisableRecovery->isChecked()) return; if (theConf->GetBool("Options/InstantRecovery", true)) @@ -1477,16 +1482,16 @@ CRecoveryWindow* CSandMan::ShowRecovery(const CSandBoxPtr& pBox, bool bFind) auto pBoxEx = pBox.objectCast(); if (!pBoxEx) return false; if (pBoxEx->m_pRecoveryWnd == NULL) { - pBoxEx->m_pRecoveryWnd = new CRecoveryWindow(pBox); + pBoxEx->m_pRecoveryWnd = new CRecoveryWindow(pBox, bFind == false); connect(pBoxEx->m_pRecoveryWnd, &CRecoveryWindow::Closed, [pBoxEx]() { pBoxEx->m_pRecoveryWnd = NULL; }); pBoxEx->m_pRecoveryWnd->show(); } - else { + /*else { pBoxEx->m_pRecoveryWnd->setWindowState((pBoxEx->m_pRecoveryWnd->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); //SetForegroundWindow((HWND)pBoxEx->m_pRecoveryWnd->winId()); - } + }*/ if(bFind) pBoxEx->m_pRecoveryWnd->FindFiles(); return pBoxEx->m_pRecoveryWnd; @@ -1580,6 +1585,10 @@ void CSandMan::OnFileRecovered(const QString& BoxName, const QString& FilePath, m_pRecoveryLog->GetTree()->addTopLevelItem(pItem); m_pRecoveryLog->GetView()->verticalScrollBar()->setValue(m_pRecoveryLog->GetView()->verticalScrollBar()->maximum()); + + CSandBoxPtr pBox = theAPI->GetBoxByName(BoxName); + if (pBox) + pBox.objectCast()->UpdateSize(); } int CSandMan::ShowQuestion(const QString& question, const QString& checkBoxText, bool* checkBoxSetting, int buttons, int defaultButton) diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 3930a4e3..99acb08c 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -154,7 +154,7 @@ public slots: void OnAsyncProgress(int Progress); void OnCancelAsync(); - void OnBoxClosed(const QString& BoxName); + void OnBoxClosed(const CSandBoxPtr& pBox); void CheckForUpdates(bool bManual = true); void DownloadUpdates(const QString& DownloadUrl, bool bManual); @@ -247,6 +247,8 @@ private: QAction* m_pWndFinder; QAction* m_pDisableForce; QAction* m_pDisableForce2; + QAction* m_pDisableRecovery; + QAction* m_pDisableMessages; QMenu* m_pMaintenance; QAction* m_pConnect; QAction* m_pDisconnect; diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.cpp b/SandboxiePlus/SandMan/SbiePlusAPI.cpp index c8311cbc..490e8bca 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.cpp +++ b/SandboxiePlus/SandMan/SbiePlusAPI.cpp @@ -81,6 +81,11 @@ bool CSbiePlusAPI::IsRunningAsAdmin() return true; } +void CSbiePlusAPI::StopMonitor() +{ + m_BoxMonitor->Stop(); +} + /////////////////////////////////////////////////////////////////////////////// // CSandBoxPlus // @@ -163,18 +168,32 @@ void CSandBoxPlus::UpdateDetails() void CSandBoxPlus::SetBoxPaths(const QString& FilePath, const QString& RegPath, const QString& IpcPath) { + bool bPathChanged = (FilePath != m_FilePath); + + if (bPathChanged && !m_FilePath.isEmpty()) + ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->RemoveBox(this); + CSandBox::SetBoxPaths(FilePath, RegPath, IpcPath); + + if (m_FilePath.isEmpty()) { + m_IsEmpty = true; + return; + } + m_IsEmpty = IsEmpty(); - if (theConf->GetBool("Options/WatchBoxSize", false) && m_TotalSize == -1) - ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->AddBox(this); + if (bPathChanged && theConf->GetBool("Options/WatchBoxSize", false) && m_TotalSize == -1) + ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->ScanBox(this); + + if (theConf->GetBool("Options/ScanStartMenu", true)) + ScanStartMenu(); } void CSandBoxPlus::UpdateSize() { m_TotalSize = -1; if(theConf->GetBool("Options/WatchBoxSize", false)) - ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->AddBox(this); + ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->ScanBox(this); m_IsEmpty = IsEmpty(); } @@ -185,6 +204,11 @@ void CSandBoxPlus::SetSize(quint64 Size) theConf->SetValue("SizeCache/" + m_Name, Size); } +bool CSandBoxPlus::IsSizePending() const +{ + return ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->IsScanPending(this); +} + void CSandBoxPlus::OpenBox() { CSandBox::OpenBox(); @@ -192,7 +216,7 @@ void CSandBoxPlus::OpenBox() m_IsEmpty = false; if (theConf->GetBool("Options/WatchBoxSize", false)) - ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->AddBox(this, true); + ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->WatchBox(this); } void CSandBoxPlus::CloseBox() @@ -202,11 +226,14 @@ void CSandBoxPlus::CloseBox() m_SuspendRecovery = false; ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->CloseBox(this); + + if (theConf->GetBool("Options/ScanStartMenu", true)) + ScanStartMenu(); } SB_PROGRESS CSandBoxPlus::CleanBox() { - ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->CloseBox(this, true); + ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->RemoveBox(this); SB_PROGRESS Status = CSandBox::CleanBox(); @@ -242,8 +269,8 @@ QString CSandBoxPlus::GetStatusStr() const QStringList Status; - if (m_IsEmpty) - Status.append(tr("Empty")); + //if (m_IsEmpty) + // Status.append(tr("Empty")); if (m_bApplicationCompartment) Status.append(tr("Application Compartment")); diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.h b/SandboxiePlus/SandMan/SbiePlusAPI.h index f0d7dd2e..67ff611e 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.h +++ b/SandboxiePlus/SandMan/SbiePlusAPI.h @@ -19,6 +19,8 @@ public: virtual bool IsBusy() const { return m_JobCount > 0; } + virtual void StopMonitor(); + protected: friend class CSandBoxPlus; @@ -80,9 +82,12 @@ public: virtual void SetLeaderProgram(const QString& ProgName, bool bSet); virtual int IsLeaderProgram(const QString& ProgName); + virtual bool IsEmptyCached() const { return m_IsEmpty; } + virtual void UpdateSize(); virtual quint64 GetSize() const { if(m_TotalSize == -1) return 0; return m_TotalSize; } virtual void SetSize(quint64 Size); //{ m_TotalSize = Size; } + virtual bool IsSizePending() const; virtual bool IsRecoverySuspended() const { return m_SuspendRecovery; } virtual void SetSuspendRecovery(bool bSet = true) { m_SuspendRecovery = bSet; } @@ -107,7 +112,7 @@ public: class COptionsWindow* m_pOptionsWnd; class CRecoveryWindow* m_pRecoveryWnd; - bool IsBusy() const { return !m_JobQueue.isEmpty(); } + bool IsBusy() const { return IsSizePending() || !m_JobQueue.isEmpty(); } SB_STATUS DeleteContentAsync(bool DeleteShapshots = true, bool bOnAutoDelete = false); public slots: @@ -118,6 +123,7 @@ public slots: protected: friend class CSbiePlusAPI; + virtual bool CheckUnsecureConfig() const; virtual bool TestProgramGroup(const QString& Group, const QString& ProgName); diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index daab1716..a06b4c58 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -111,6 +111,7 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent) m_pMenuContent->addSeparator(); m_pMenuExplore = m_pMenuContent->addAction(CSandMan::GetIcon("Explore"), tr("Explore Content"), this, SLOT(OnSandBoxAction())); m_pMenuRegEdit = m_pMenuContent->addAction(CSandMan::GetIcon("RegEdit"), tr("Open Registry"), this, SLOT(OnSandBoxAction())); + m_pMenuRefresh = m_pMenu->addAction(CSandMan::GetIcon("Refresh"), tr("Refresh Info"), this, SLOT(OnSandBoxAction())); m_pMenuSnapshots = m_pMenu->addAction(CSandMan::GetIcon("Snapshots"), tr("Snapshots Manager"), this, SLOT(OnSandBoxAction())); m_pMenuRecover = m_pMenu->addAction(CSandMan::GetIcon("Recover"), tr("Recover Files"), this, SLOT(OnSandBoxAction())); m_pMenuCleanUp = m_pMenu->addAction(CSandMan::GetIcon("Erase"), tr("Delete Content"), this, SLOT(OnSandBoxAction())); @@ -133,6 +134,10 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent) m_pMenuPresetsINet->setCheckable(true); m_pMenuPresetsShares = m_pMenuPresets->addAction(tr("Allow Network Shares"), this, SLOT(OnSandBoxAction())); m_pMenuPresetsShares->setCheckable(true); + + m_pMenuPresets->addSeparator(); + m_pMenuPresetsRecovery = m_pMenuPresets->addAction(tr("Imminent Recovery"), this, SLOT(OnSandBoxAction())); + m_pMenuPresetsRecovery->setCheckable(true); m_pMenuDuplicate = m_pMenu->addAction(CSandMan::GetIcon("Duplicate"), tr("Duplicate Sandbox"), this, SLOT(OnSandBoxAction())); m_pMenuRename = m_pMenu->addAction(CSandMan::GetIcon("Rename"), tr("Rename Sandbox"), this, SLOT(OnSandBoxAction())); @@ -197,6 +202,7 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent) m_pMenu2->addAction(m_pMenuCleanUp); m_pMenu2->addSeparator(); m_pMenu2->addAction(m_pMenuOptions); + m_pMenu2->addMenu(m_pMenuPresets); QByteArray Columns = theConf->GetBlob("MainWindow/BoxTree_Columns"); if (Columns.isEmpty()) @@ -454,6 +460,7 @@ bool CSbieView::UpdateMenu() m_pMenuPresetsFakeAdmin->setChecked(pBox && pBox->GetBool("DropAdminRights", false) && pBox->GetBool("FakeAdminRights", false)); m_pMenuPresetsINet->setChecked(pBox && pBox.objectCast()->IsINetBlocked()); m_pMenuPresetsShares->setChecked(pBox && pBox.objectCast()->HasSharesAccess()); + m_pMenuPresetsRecovery->setChecked(pBox && pBox->GetBool("AutoRecover", false)); m_pMenuBrowse->setEnabled(iSandBoxeCount == 1); m_pMenuExplore->setEnabled(iSandBoxeCount == 1); @@ -886,6 +893,8 @@ void CSbieView::OnSandBoxAction(QAction* Action) SandBoxes.first().objectCast()->SetINetBlock(m_pMenuPresetsINet->isChecked()); else if (Action == m_pMenuPresetsShares) SandBoxes.first().objectCast()->SetAllowShares(m_pMenuPresetsShares->isChecked()); + else if (Action == m_pMenuPresetsRecovery) + m_pMenuPresetsRecovery->setChecked(SandBoxes.first()->SetBool("AutoRecover", m_pMenuPresetsRecovery->isChecked())); else if (Action == m_pMenuOptions) { OnDoubleClicked(m_pSbieTree->selectedRows().first()); @@ -914,6 +923,15 @@ void CSbieView::OnSandBoxAction(QAction* Action) SetForegroundWindow((HWND)pFileBrowserWindow->winId()); } } + else if (Action == m_pMenuRefresh) + { + foreach(const CSandBoxPtr& pBox, SandBoxes) + { + pBox.objectCast()->UpdateSize(); + if (theConf->GetBool("Options/ScanStartMenu", true)) + pBox.objectCast()->ScanStartMenu(); + } + } else if (Action == m_pMenuExplore) { if (SandBoxes.first()->IsEmpty()) { @@ -1286,11 +1304,14 @@ void CSbieView::OnDoubleClicked(const QModelIndex& index) if (pBox.isNull()) return; - if (index.column() == CSbieModel::ePath) - OnSandBoxAction(m_pMenuExplore); + if ((QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) == 0) { - if (index.column() != CSbieModel::eName) - return; + if (index.column() == CSbieModel::ePath) + OnSandBoxAction(m_pMenuExplore); + } + + //if (index.column() != CSbieModel::eName) + // return; if (!pBox->IsEnabled()) { diff --git a/SandboxiePlus/SandMan/Views/SbieView.h b/SandboxiePlus/SandMan/Views/SbieView.h index b85344da..f39eb4ac 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.h +++ b/SandboxiePlus/SandMan/Views/SbieView.h @@ -119,12 +119,14 @@ private: QAction* m_pMenuPresetsFakeAdmin; QAction* m_pMenuPresetsINet; QAction* m_pMenuPresetsShares; + QAction* m_pMenuPresetsRecovery; QAction* m_pMenuOptions; QAction* m_pMenuSnapshots; QAction* m_pMenuEmptyBox; QMenu* m_pMenuContent; QAction* m_pMenuExplore; QAction* m_pMenuBrowse; + QAction* m_pMenuRefresh; QAction* m_pMenuRegEdit; QAction* m_pMenuRecover; QAction* m_pMenuCleanUp; diff --git a/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp b/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp index 4c730cbf..8e3de40d 100644 --- a/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp @@ -13,9 +13,11 @@ #endif -CRecoveryWindow::CRecoveryWindow(const CSandBoxPtr& pBox, QWidget *parent) +CRecoveryWindow::CRecoveryWindow(const CSandBoxPtr& pBox, bool bImminent, QWidget *parent) : QDialog(parent) { + m_bImminent = bImminent; + Qt::WindowFlags flags = windowFlags(); flags |= Qt::CustomizeWindowHint; //flags &= ~Qt::WindowContextHelpButtonHint; @@ -28,7 +30,7 @@ CRecoveryWindow::CRecoveryWindow(const CSandBoxPtr& pBox, QWidget *parent) //setWindowState(Qt::WindowActive); SetForegroundWindow((HWND)QWidget::winId()); - bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false); + bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false) || (bImminent && theConf->GetBool("Options/RecoveryOnTop", true)); this->setWindowFlag(Qt::WindowStaysOnTopHint, bAlwaysOnTop); if (!bAlwaysOnTop) { @@ -302,6 +304,9 @@ int CRecoveryWindow::FindFiles() Count += FindFiles(Folder); } + if (m_bImminent && m_FileMap.isEmpty()) + this->close(); + m_pFileModel->Sync(m_FileMap); ui.treeFiles->expandAll(); return Count; @@ -504,6 +509,7 @@ void CRecoveryWindow::OnCloseUntil() void CRecoveryWindow::OnAutoDisable() { + m_pBox.objectCast()->SetSuspendRecovery(); m_pBox->SetBool("AutoRecover", false); close(); } diff --git a/SandboxiePlus/SandMan/Windows/RecoveryWindow.h b/SandboxiePlus/SandMan/Windows/RecoveryWindow.h index 355da118..7d9a8c84 100644 --- a/SandboxiePlus/SandMan/Windows/RecoveryWindow.h +++ b/SandboxiePlus/SandMan/Windows/RecoveryWindow.h @@ -36,7 +36,7 @@ class CRecoveryWindow : public QDialog Q_OBJECT public: - CRecoveryWindow(const CSandBoxPtr& pBox, QWidget *parent = Q_NULLPTR); + CRecoveryWindow(const CSandBoxPtr& pBox, bool bImminent = false, QWidget *parent = Q_NULLPTR); ~CRecoveryWindow(); bool IsDeleteShapshots() { return m_DeleteShapshots; } @@ -85,6 +85,7 @@ protected: bool m_bTargetsChanged; bool m_bReloadPending; bool m_DeleteShapshots; + bool m_bImminent; private: Ui::RecoveryWindow ui; From e768d47e5bab8684c7acc5d4026c9549a2229c3c Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Mon, 13 Jun 2022 20:49:53 +0200 Subject: [PATCH 15/19] 1.1.2 --- SandboxiePlus/SandMan/SbiePlusAPI.cpp | 8 +------- SandboxiePlus/SandMan/Views/SbieView.cpp | 4 +--- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.cpp b/SandboxiePlus/SandMan/SbiePlusAPI.cpp index 490e8bca..2bbee777 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.cpp +++ b/SandboxiePlus/SandMan/SbiePlusAPI.cpp @@ -184,9 +184,6 @@ void CSandBoxPlus::SetBoxPaths(const QString& FilePath, const QString& RegPath, if (bPathChanged && theConf->GetBool("Options/WatchBoxSize", false) && m_TotalSize == -1) ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->ScanBox(this); - - if (theConf->GetBool("Options/ScanStartMenu", true)) - ScanStartMenu(); } void CSandBoxPlus::UpdateSize() @@ -226,9 +223,6 @@ void CSandBoxPlus::CloseBox() m_SuspendRecovery = false; ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->CloseBox(this); - - if (theConf->GetBool("Options/ScanStartMenu", true)) - ScanStartMenu(); } SB_PROGRESS CSandBoxPlus::CleanBox() @@ -614,4 +608,4 @@ void CSandBoxPlus::OnCancelAsync() QSharedPointer pJob = m_JobQueue.first(); CSbieProgressPtr pProgress = pJob->GetProgress(); pProgress->Cancel(); -} \ No newline at end of file +} diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index a06b4c58..5d81dc69 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -928,8 +928,6 @@ void CSbieView::OnSandBoxAction(QAction* Action) foreach(const CSandBoxPtr& pBox, SandBoxes) { pBox.objectCast()->UpdateSize(); - if (theConf->GetBool("Options/ScanStartMenu", true)) - pBox.objectCast()->ScanStartMenu(); } } else if (Action == m_pMenuExplore) @@ -1544,4 +1542,4 @@ void CSbieView::OnRemoveItem() OnSandBoxAction(m_pMenuRemove); else if (!GetSelectedGroups().isEmpty()) OnGroupAction(m_pDelGroupe); -} \ No newline at end of file +} From 838ce6553f83e097f9870607a03749eb7d8d0623 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Tue, 14 Jun 2022 19:43:23 +0200 Subject: [PATCH 16/19] 1.1.3 --- SandboxiePlus/SandMan/SandMan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 8581d650..8bd6b983 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -1467,7 +1467,7 @@ bool CSandMan::OpenRecovery(const CSandBoxPtr& pBox, bool& DeleteShapshots, bool // todo: resuse window? } - CRecoveryWindow* pRecoveryWindow = new CRecoveryWindow(pBox, this); + CRecoveryWindow* pRecoveryWindow = new CRecoveryWindow(pBox, false, this); if (pRecoveryWindow->FindFiles() == 0 && bCloseEmpty) { delete pRecoveryWindow; } From d8e5371465896ff2d894c7f31a08b401188621af Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Tue, 14 Jun 2022 19:45:52 +0200 Subject: [PATCH 17/19] 1.1.3 --- CHANGELOG.md | 10 +++++++++- Sandboxie/common/my_version.h | 4 ++-- SandboxiePlus/version.h | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe0b22c1..bc40d7f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,15 @@ This project adheres to [Semantic Versioning](http://semver.org/). -## [1.1.2 / 5.56.2] - 2022-06-?? +## [1.1.3 / 5.56.3] - 2022-06-?? + +### Fixed +- fixed issue with recovery window on delete [#1948](https://github.com/sandboxie-plus/Sandboxie/issues/1948) + + + + +## [1.1.2 / 5.56.2] - 2022-06-14 ### Added - added missing file recovery log from sbiectrl to sandman [#425](https://github.com/sandboxie-plus/Sandboxie/issues/425) diff --git a/Sandboxie/common/my_version.h b/Sandboxie/common/my_version.h index 9ba754d6..f11aef3a 100644 --- a/Sandboxie/common/my_version.h +++ b/Sandboxie/common/my_version.h @@ -21,8 +21,8 @@ #ifndef _MY_VERSION_H #define _MY_VERSION_H -#define MY_VERSION_BINARY 5,56,2 -#define MY_VERSION_STRING "5.56.2" +#define MY_VERSION_BINARY 5,56,3 +#define MY_VERSION_STRING "5.56.3" #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 diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index f8ccff3e..949091f0 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -2,7 +2,7 @@ #define VERSION_MJR 1 #define VERSION_MIN 1 -#define VERSION_REV 2 +#define VERSION_REV 3 #define VERSION_UPD 0 #ifndef STR From a00f150ca3940b0d3dd876ac70b53f603dbaeae4 Mon Sep 17 00:00:00 2001 From: isaak654 Date: Tue, 14 Jun 2022 20:08:32 +0200 Subject: [PATCH 18/19] Rename Imminent to Immediate Recovery For greater consistency with other strings --- CHANGELOG.md | 6 +++--- SandboxiePlus/SandMan/Views/SbieView.cpp | 2 +- SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp | 8 ++++---- SandboxiePlus/SandMan/Windows/RecoveryWindow.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc40d7f4..37fdc78b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,9 +19,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - added missing file recovery log from sbiectrl to sandman [#425](https://github.com/sandboxie-plus/Sandboxie/issues/425) -- Imminent recovery window will now auto close when all files are recovered [#1498](https://github.com/sandboxie-plus/Sandboxie/issues/1498) -- the imminent recovery window of sandman is now by default alway on top like in sbiectrl this can be disabled with "Options/RecoveryOnTop=n" [#1465](https://github.com/sandboxie-plus/Sandboxie/issues/1465) -- added option to toggle Imminent recovery from the presets sub menu [#1653](https://github.com/sandboxie-plus/Sandboxie/issues/1653) +- Immediate recovery window will now auto close when all files are recovered [#1498](https://github.com/sandboxie-plus/Sandboxie/issues/1498) +- the Immediate recovery window of sandman is now by default alway on top like in sbiectrl this can be disabled with "Options/RecoveryOnTop=n" [#1465](https://github.com/sandboxie-plus/Sandboxie/issues/1465) +- added option to toggle Immediate recovery from the presets sub menu [#1653](https://github.com/sandboxie-plus/Sandboxie/issues/1653) - added option to disable file recovery and or message pop up globally - added per box refresh opzion [#1945](https://github.com/sandboxie-plus/Sandboxie/issues/1945) diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 5d81dc69..85e6a5fc 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -136,7 +136,7 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent) m_pMenuPresetsShares->setCheckable(true); m_pMenuPresets->addSeparator(); - m_pMenuPresetsRecovery = m_pMenuPresets->addAction(tr("Imminent Recovery"), this, SLOT(OnSandBoxAction())); + m_pMenuPresetsRecovery = m_pMenuPresets->addAction(tr("Immediate Recovery"), this, SLOT(OnSandBoxAction())); m_pMenuPresetsRecovery->setCheckable(true); m_pMenuDuplicate = m_pMenu->addAction(CSandMan::GetIcon("Duplicate"), tr("Duplicate Sandbox"), this, SLOT(OnSandBoxAction())); diff --git a/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp b/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp index 8e3de40d..061762d4 100644 --- a/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp @@ -13,10 +13,10 @@ #endif -CRecoveryWindow::CRecoveryWindow(const CSandBoxPtr& pBox, bool bImminent, QWidget *parent) +CRecoveryWindow::CRecoveryWindow(const CSandBoxPtr& pBox, bool bImmediate, QWidget *parent) : QDialog(parent) { - m_bImminent = bImminent; + m_bImmediate = bImmediate; Qt::WindowFlags flags = windowFlags(); flags |= Qt::CustomizeWindowHint; @@ -30,7 +30,7 @@ CRecoveryWindow::CRecoveryWindow(const CSandBoxPtr& pBox, bool bImminent, QWidge //setWindowState(Qt::WindowActive); SetForegroundWindow((HWND)QWidget::winId()); - bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false) || (bImminent && theConf->GetBool("Options/RecoveryOnTop", true)); + bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false) || (bImmediate && theConf->GetBool("Options/RecoveryOnTop", true)); this->setWindowFlag(Qt::WindowStaysOnTopHint, bAlwaysOnTop); if (!bAlwaysOnTop) { @@ -304,7 +304,7 @@ int CRecoveryWindow::FindFiles() Count += FindFiles(Folder); } - if (m_bImminent && m_FileMap.isEmpty()) + if (m_bImmediate && m_FileMap.isEmpty()) this->close(); m_pFileModel->Sync(m_FileMap); diff --git a/SandboxiePlus/SandMan/Windows/RecoveryWindow.h b/SandboxiePlus/SandMan/Windows/RecoveryWindow.h index 7d9a8c84..80c55520 100644 --- a/SandboxiePlus/SandMan/Windows/RecoveryWindow.h +++ b/SandboxiePlus/SandMan/Windows/RecoveryWindow.h @@ -36,7 +36,7 @@ class CRecoveryWindow : public QDialog Q_OBJECT public: - CRecoveryWindow(const CSandBoxPtr& pBox, bool bImminent = false, QWidget *parent = Q_NULLPTR); + CRecoveryWindow(const CSandBoxPtr& pBox, bool bImmediate = false, QWidget *parent = Q_NULLPTR); ~CRecoveryWindow(); bool IsDeleteShapshots() { return m_DeleteShapshots; } @@ -85,7 +85,7 @@ protected: bool m_bTargetsChanged; bool m_bReloadPending; bool m_DeleteShapshots; - bool m_bImminent; + bool m_bImmediate; private: Ui::RecoveryWindow ui; From 1c22889f320b8771b2aa271462f97cbc73a2a275 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Tue, 14 Jun 2022 20:58:13 +0200 Subject: [PATCH 19/19] 1.1.3 --- CHANGELOG.md | 6 +++--- SandboxiePlus/SandMan/Views/SbieView.cpp | 2 +- SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp | 10 +++++----- SandboxiePlus/SandMan/Windows/RecoveryWindow.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc40d7f4..21fda902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,9 +19,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - added missing file recovery log from sbiectrl to sandman [#425](https://github.com/sandboxie-plus/Sandboxie/issues/425) -- Imminent recovery window will now auto close when all files are recovered [#1498](https://github.com/sandboxie-plus/Sandboxie/issues/1498) -- the imminent recovery window of sandman is now by default alway on top like in sbiectrl this can be disabled with "Options/RecoveryOnTop=n" [#1465](https://github.com/sandboxie-plus/Sandboxie/issues/1465) -- added option to toggle Imminent recovery from the presets sub menu [#1653](https://github.com/sandboxie-plus/Sandboxie/issues/1653) +- immediate recovery window will now auto close when all files are recovered [#1498](https://github.com/sandboxie-plus/Sandboxie/issues/1498) +- the immediate recovery window of sandman is now by default alway on top like in sbiectrl this can be disabled with "Options/RecoveryOnTop=n" [#1465](https://github.com/sandboxie-plus/Sandboxie/issues/1465) +- added option to toggle immediate recovery from the presets sub menu [#1653](https://github.com/sandboxie-plus/Sandboxie/issues/1653) - added option to disable file recovery and or message pop up globally - added per box refresh opzion [#1945](https://github.com/sandboxie-plus/Sandboxie/issues/1945) diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 5d81dc69..85e6a5fc 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -136,7 +136,7 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent) m_pMenuPresetsShares->setCheckable(true); m_pMenuPresets->addSeparator(); - m_pMenuPresetsRecovery = m_pMenuPresets->addAction(tr("Imminent Recovery"), this, SLOT(OnSandBoxAction())); + m_pMenuPresetsRecovery = m_pMenuPresets->addAction(tr("Immediate Recovery"), this, SLOT(OnSandBoxAction())); m_pMenuPresetsRecovery->setCheckable(true); m_pMenuDuplicate = m_pMenu->addAction(CSandMan::GetIcon("Duplicate"), tr("Duplicate Sandbox"), this, SLOT(OnSandBoxAction())); diff --git a/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp b/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp index 8e3de40d..5ba21daa 100644 --- a/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp @@ -13,10 +13,10 @@ #endif -CRecoveryWindow::CRecoveryWindow(const CSandBoxPtr& pBox, bool bImminent, QWidget *parent) +CRecoveryWindow::CRecoveryWindow(const CSandBoxPtr& pBox, bool bImmediate, QWidget *parent) : QDialog(parent) { - m_bImminent = bImminent; + m_bImmediate = bImmediate; Qt::WindowFlags flags = windowFlags(); flags |= Qt::CustomizeWindowHint; @@ -30,7 +30,7 @@ CRecoveryWindow::CRecoveryWindow(const CSandBoxPtr& pBox, bool bImminent, QWidge //setWindowState(Qt::WindowActive); SetForegroundWindow((HWND)QWidget::winId()); - bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false) || (bImminent && theConf->GetBool("Options/RecoveryOnTop", true)); + bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false) || (bImmediate && theConf->GetBool("Options/RecoveryOnTop", true)); this->setWindowFlag(Qt::WindowStaysOnTopHint, bAlwaysOnTop); if (!bAlwaysOnTop) { @@ -304,7 +304,7 @@ int CRecoveryWindow::FindFiles() Count += FindFiles(Folder); } - if (m_bImminent && m_FileMap.isEmpty()) + if (m_bImmediate && m_FileMap.isEmpty()) this->close(); m_pFileModel->Sync(m_FileMap); @@ -550,4 +550,4 @@ void CRecoveryCounter::run() } while (!Folders.isEmpty()); emit Count(fileCount, folderCount, totalSize); -} +} \ No newline at end of file diff --git a/SandboxiePlus/SandMan/Windows/RecoveryWindow.h b/SandboxiePlus/SandMan/Windows/RecoveryWindow.h index 7d9a8c84..80c55520 100644 --- a/SandboxiePlus/SandMan/Windows/RecoveryWindow.h +++ b/SandboxiePlus/SandMan/Windows/RecoveryWindow.h @@ -36,7 +36,7 @@ class CRecoveryWindow : public QDialog Q_OBJECT public: - CRecoveryWindow(const CSandBoxPtr& pBox, bool bImminent = false, QWidget *parent = Q_NULLPTR); + CRecoveryWindow(const CSandBoxPtr& pBox, bool bImmediate = false, QWidget *parent = Q_NULLPTR); ~CRecoveryWindow(); bool IsDeleteShapshots() { return m_DeleteShapshots; } @@ -85,7 +85,7 @@ protected: bool m_bTargetsChanged; bool m_bReloadPending; bool m_DeleteShapshots; - bool m_bImminent; + bool m_bImmediate; private: Ui::RecoveryWindow ui;