diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index fb00d00c..e79e1062 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -82,10 +82,10 @@ public: if (theGUI) theGUI->UpdateDrives(); } - /*else if ((msg->wParam & 0xFF80) == 0xAA00 && msg->lParam == 'xobs') + /*else if ((msg->wParam & 0xFF80) == 0xAA00 && msg->lParam == 'xobs') { UCHAR driveNumber = (UCHAR)(msg->wParam & 0x1F); - if (driveNumber < 26) { + if (driveNumber < 26) { } } else if (msg->wParam == DBT_DEVNODES_CHANGED) // hardware changed @@ -374,8 +374,8 @@ void CSandMan::CreateUI() // Clear old ToolBar references. m_pNewBoxButton = nullptr; m_pCleanUpButton = nullptr; - m_pEditIniButton = nullptr; - + m_pEditIniButton = nullptr; + int iViewMode = theConf->GetInt("Options/ViewMode", 1); if(iViewMode == 2) @@ -418,7 +418,7 @@ void CSandMan::CreateUI() int iUsePizza = theConf->GetInt("Options/UseBackground", 2); if (iUsePizza == 2) iUsePizza = theConf->GetInt("Options/ViewMode", 1) == 2 ? 1 : 0; - if (iUsePizza) + if (iUsePizza) { QPalette pizzaPalete = GetBoxView()->GetTree()->palette(); // QPalette pizzaPalete = QApplication::palette(); SetPaleteTexture(pizzaPalete, QPalette::Base, QImage(":/Assets/background.png")); @@ -507,7 +507,7 @@ void CSandMan::CreateMenus(bool bAdvanced) m_pNewBox = m_pMenuFile->addAction(CSandMan::GetIcon("NewBox"), tr("Create New Box"), this, SLOT(OnSandBoxAction())); m_pNewGroup = m_pMenuFile->addAction(CSandMan::GetIcon("Group"), tr("Create Box Group"), this, SLOT(OnSandBoxAction())); m_pImportBox = m_pMenuFile->addAction(CSandMan::GetIcon("UnPackBox"), tr("Import Box"), this, SLOT(OnSandBoxAction())); - + m_pImportBox->setEnabled(CArchive::IsInit()); m_pMenuFile->addSeparator(); m_pRunBoxed = m_pMenuFile->addAction(CSandMan::GetIcon("Run"), tr("Run Sandboxed"), this, SLOT(OnSandBoxAction())); @@ -515,7 +515,7 @@ void CSandMan::CreateMenus(bool bAdvanced) m_pLockAll = m_pMenuFile->addAction(CSandMan::GetIcon("LockClosed"), tr("Lock All Encrypted Boxes"), this, SLOT(OnLockAll())); m_pMenuFile->addSeparator(); m_pWndFinder = m_pMenuFile->addAction(CSandMan::GetIcon("finder"), tr("Is Window Sandboxed?"), this, SLOT(OnWndFinder())); - + if(bAdvanced || theGUI->IsFullyPortable()) CreateMaintenanceMenu(); else { @@ -536,7 +536,7 @@ void CSandMan::CreateMenus(bool bAdvanced) m_pSetupWizard = NULL; //m_pUpdateCore = NULL; } - + m_pMenuFile->addSeparator(); m_pRestart = m_pMenuFile->addAction(CSandMan::GetIcon("Exit"), tr("Restart As Admin"), this, SLOT(OnRestartAsAdmin())); m_pExit = m_pMenuFile->addAction(CSandMan::GetIcon("Exit"), tr("Exit"), this, SLOT(OnExit())); @@ -599,7 +599,7 @@ void CSandMan::CreateMenus(bool bAdvanced) m_pEnableMonitoring->setCheckable(true); if (!bAdvanced) m_pMenuView->addAction(CSandMan::GetIcon("Recover"), tr("Recovery Log"), this, SLOT(OnRecoveryLog())); - + m_pMenuOptions = m_pMenuBar->addMenu(tr("&Options")); m_pMenuSettings = m_pMenuOptions->addAction(CSandMan::GetIcon("Settings"), tr("Global Settings"), this, SLOT(OnSettings())); @@ -665,7 +665,7 @@ void CSandMan::CreateOldMenus() //m_pDisableRecovery->setCheckable(true); m_pDisableRecovery = NULL; //m_pDisableMessages = m_pMenuFile->addAction(tr("Disable Message Popup")); - //m_pDisableMessages->setCheckable(true); + //m_pDisableMessages->setCheckable(true); m_pDisableMessages = NULL; m_pMenuFile->addSeparator(); m_pWndFinder = m_pMenuFile->addAction(CSandMan::GetIcon("finder"), tr("Is Window Sandboxed?"), this, SLOT(OnWndFinder())); @@ -799,7 +799,7 @@ QSet CSandMan::GetToolBarItemsConfig() QSet validSet; - for (auto item : GetAvailableToolBarActions()) { + for (auto item : GetAvailableToolBarActions()) { if (!item.scriptName.isEmpty()) validSet.insert(item.scriptName); } @@ -926,7 +926,7 @@ void CSandMan::CreateToolBarConfigMenu(const QList& actions, cons } } - m_pToolBar->setContextMenuPolicy(Qt::CustomContextMenu); + m_pToolBar->setContextMenuPolicy(Qt::CustomContextMenu); QObject::connect(m_pToolBar, &QToolBar::customContextMenuRequested, this, [&](const QPoint& p) { m_pToolBarContextMenu->exec(mapToGlobal(p)); @@ -937,7 +937,7 @@ void CSandMan::CreateToolBarConfigMenu(const QList& actions, cons void CSandMan::CreateToolBar(bool rebuild) { // Assumes UI is in Advanced-Mode and menus have been built. - + auto pOldToolBar = m_pToolBar; m_pToolBar = new QToolBar(); m_pMainLayout->insertWidget(0, m_pToolBar); @@ -986,7 +986,7 @@ void CSandMan::CreateToolBar(bool rebuild) but->setToolTip(tr("Cleanup")); but->setText(tr("Cleanup")); but->setPopupMode(QToolButton::MenuButtonPopup); - but->setMenu(m_pCleanUpMenu); + but->setMenu(m_pCleanUpMenu); QObject::connect(but, SIGNAL(clicked(bool)), this, SLOT(OnCleanUp())); m_pCleanUpButton = but; m_pToolBar->addWidget(but); @@ -1082,7 +1082,7 @@ void CSandMan::UpdateLabel() //auto neon = new CNeonEffect(10, 4, 180); // 140 //m_pLabel->setGraphicsEffect(NULL); } - else if (g_Certificate.isEmpty()) + else if (g_Certificate.isEmpty()) { LabelText = tr("Support Sandboxie-Plus on Patreon"); LabelTip = tr("Click to open web browser"); @@ -1169,7 +1169,7 @@ void CSandMan::CreateView(int iViewMode) else m_pRecoveryLogWnd = NULL; - if (iViewMode == 2) + if (iViewMode == 2) { m_pViewStack = new QStackedLayout(); m_pViewStack->addWidget(m_pBoxView); @@ -1206,7 +1206,7 @@ void CSandMan::CreateView(int iViewMode) m_pViewStack = NULL; m_pBoxCombo = NULL; - if (iViewMode == 1) + if (iViewMode == 1) { m_pLogSplitter = new QSplitter(); m_pLogSplitter->setOrientation(Qt::Vertical); @@ -1217,7 +1217,7 @@ void CSandMan::CreateView(int iViewMode) m_pPanelSplitter->setOrientation(Qt::Horizontal); if (iViewMode == 1) m_pLogSplitter->addWidget(m_pPanelSplitter); - else + else m_pMainLayout->addWidget(m_pPanelSplitter); m_pPanelSplitter->addWidget(m_pBoxView); @@ -1236,7 +1236,7 @@ void CSandMan::CreateView(int iViewMode) m_pMessageLog->GetTree()->setItemDelegate(new CTreeItemDelegate()); m_pMessageLog->GetTree()->setAlternatingRowColors(theConf->GetBool("Options/AltRowColors", false)); - + //m_pMessageLog->GetView()->setItemDelegate(theGUI->GetItemDelegate()); ((QTreeWidgetEx*)m_pMessageLog->GetView())->setHeaderLabels(tr("Time|Message").split("|")); ((QTreeWidgetEx*)m_pMessageLog->GetView())->setColumnFixed(1, true); @@ -1380,9 +1380,9 @@ void CSandMan::closeEvent(QCloseEvent *e) void CSandMan::changeEvent(QEvent* e) { - if (e->type() == QEvent::WindowStateChange) + if (e->type() == QEvent::WindowStateChange) { - if (isMinimized()) + if (isMinimized()) { if (m_bOnTop) { m_bOnTop = false; @@ -1403,16 +1403,16 @@ void CSandMan::changeEvent(QEvent* e) } } } - QMainWindow::changeEvent(e); + QMainWindow::changeEvent(e); } void CSandMan::commitData(QSessionManager& manager) { - //if (manager.allowsInteraction()) + //if (manager.allowsInteraction()) //{ // manager.cancel(); // return; - //} + //} m_pBoxView->SaveState(); m_pFileView->SaveState(); @@ -1458,7 +1458,7 @@ QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse/*, bool bOut*/) *c = rgb; } //} - + QPixmap result(32, 32); result.fill(Qt::transparent); // force alpha channel QPainter painter(&result); @@ -1474,8 +1474,8 @@ QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse/*, bool bOut*/) painter.drawPixmap(0, 0, FrameDM); else painter.drawPixmap(0, 0, Frame); - if (inUse) - { + if (inUse) + { //rgb = change_hsv_c(rgb, -60, 2, 1); // yellow -> red my_rgb rgb1 = { (double)qRed(rgb), (double)qGreen(rgb), (double)qBlue(rgb) }; @@ -1551,7 +1551,7 @@ QString CSandMan::GetBoxDescription(int boxType) break; case CSandBoxPlus::eDefaultPlus: case CSandBoxPlus::eDefault: - Info = tr("This box provides standard isolation, it is suitable to run your software to enhance security."); + Info = tr("This box provides standard isolation, it is suitable to run your software to enhance security."); break; case CSandBoxPlus::eAppBoxPlus: case CSandBoxPlus::eAppBox: @@ -1561,7 +1561,7 @@ QString CSandMan::GetBoxDescription(int boxType) Info = tr("This box will be encrypted and access to sandboxed processes will be guarded."); break; } - + if(boxType == CSandBoxPlus::eHardenedPlus || boxType == CSandBoxPlus::eDefaultPlus || boxType == CSandBoxPlus::eAppBoxPlus) Info.append(tr("

This box prevents access to all user data locations, except explicitly granted in the Resource Access options.")); @@ -1578,7 +1578,7 @@ bool CSandMan::IsFullyPortable() } bool CSandMan::KeepTerminated() -{ +{ if (CWizardEngine::GetInstanceCount() > 0) return true; return m_pKeepTerminated && m_pKeepTerminated->isChecked(); @@ -1694,7 +1694,7 @@ SB_RESULT(quint32) CSandMan::RunStart(const QString& BoxName, const QString& Com { auto pBoxEx = theAPI->GetBoxByName(BoxName).objectCast(); if (pBoxEx && pBoxEx->UseImageFile() && pBoxEx->GetMountRoot().isEmpty()){ - + SB_STATUS Status = ImBoxMount(pBoxEx, true); if (Status.IsError()) return Status; @@ -1754,7 +1754,7 @@ void CSandMan::timerEvent(QTimerEvent* pEvent) m_pDisableForce->setChecked(bForceProcessDisabled); m_pDisableForce2->setChecked(bForceProcessDisabled); - if (m_pTraceView) + if (m_pTraceView) { bool bIsMonitoring = theAPI->IsMonitoring(); m_pEnableMonitoring->setChecked(bIsMonitoring); @@ -1774,7 +1774,7 @@ void CSandMan::timerEvent(QTimerEvent* pEvent) ActiveProcesses++; } } - else + else ActiveProcesses = Processes.count(); @@ -1870,7 +1870,7 @@ void CSandMan::timerEvent(QTimerEvent* pEvent) QSharedPointer Section; if (I.key() == "GlobalSettings") Section = theAPI->GetGlobalSettings(); - else + else Section = theAPI->GetBoxByName(I.key()); if (!Section) continue; @@ -1888,7 +1888,7 @@ void CSandMan::timerEvent(QTimerEvent* pEvent) } } -void CSandMan::UpdateDrives() +void CSandMan::UpdateDrives() { static bool UpdatePending = false; if (!UpdatePending) { @@ -1907,7 +1907,7 @@ void CSandMan::UpdateDrives() qDebug() << "=============="; for (auto I = volumes.begin(); I != volumes.end(); ++I) { for (auto J = I->mountPoints.begin(); J != I->mountPoints.end(); ++J) { - + QString Device; bool bOnUSB = false; for (auto J = I->disks.begin(); J != I->disks.end(); ++J) { @@ -2037,7 +2037,7 @@ SB_STATUS CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, boo } if (Mode != eForDelete) { - + // // schedule async OnBoxDelete triggers and clean up // @@ -2049,7 +2049,7 @@ SB_STATUS CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, boo m_iDeletingContent++; if (Mode != eForDelete) { - + // // execute OnBoxDelete triggers // @@ -2066,7 +2066,7 @@ SB_STATUS CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, boo } } } - + { // // delete content synchronously @@ -2198,7 +2198,7 @@ void CSandMan::SyncStartMenu() EnumBoxLinks(BoxLinks, "Desktop", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), false); QMap Boxes = theAPI->GetAllBoxes(); - foreach(const CSandBoxPtr & pBox, Boxes) + foreach(const CSandBoxPtr & pBox, Boxes) { CSandBoxPlus* pBoxEx = (CSandBoxPlus*)pBox.data(); @@ -2300,7 +2300,7 @@ void CSandMan::OnBoxClosed(const CSandBoxPtr& pBox) void CSandMan::OnBoxCleaned(CSandBoxPlus* pBoxEx) { - if (pBoxEx->GetBool("AutoRemove", false)) + if (pBoxEx->GetBool("AutoRemove", false)) { if (theConf->GetBool("Options/AutoBoxOpsNotify", false)) OnLogMessage(tr("Auto removing sandbox %1").arg(pBoxEx->GetName()), true); @@ -2317,7 +2317,7 @@ void CSandMan::OnStatusChanged() #else QString appTitle = tr("Sandboxie-Plus v%1").arg(GetVersion()); #endif - + bool bConnected = theAPI->IsConnected(); m_pConnect->setEnabled(!bConnected); m_pDisconnect->setEnabled(bConnected); @@ -2333,7 +2333,7 @@ void CSandMan::OnStatusChanged() OnLogMessage(tr("Data Directory: %1").arg(QString(theConf->GetConfigDir()).replace("/","\\"))); //statusBar()->showMessage(tr("Driver version: %1").arg(theAPI->GetVersion())); - + //appTitle.append(tr(" - Driver: v%1").arg(theAPI->GetVersion())); if (bPortable) { @@ -2347,7 +2347,7 @@ void CSandMan::OnStatusChanged() QString NtBoxRoot = theAPI->GetGlobalSettings()->GetText("FileRootPath", "\\??\\%SystemDrive%\\Sandbox\\%USER%\\%SANDBOX%", false, false).replace("GlobalSettings", "[BoxName]"); bool State = false; - PortableRootDir = CCheckableMessageBox::question(this, "Sandboxie-Plus", + PortableRootDir = CCheckableMessageBox::question(this, "Sandboxie-Plus", tr("Sandboxie-Plus was started in portable mode, do you want to put the Sandbox folder into its parent directory?\nYes will choose: %1\nNo will choose: %2") .arg(BoxPath + "\\[BoxName]") .arg(theAPI->Nt2DosPath(NtBoxRoot)) @@ -2407,7 +2407,7 @@ void CSandMan::OnStatusChanged() theAPI->SetSecureParam("UsageFlags", &UsageFlags, sizeof(UsageFlags)); } } - + g_FeatureFlags = theAPI->GetFeatureFlags(); SB_STATUS Status = theAPI->ReloadBoxes(true); @@ -2447,20 +2447,20 @@ void CSandMan::OnStatusChanged() } int DynData = theAPI->IsDyndataActive(); - if (DynData != 1) + if (DynData != 1) { RTL_OSVERSIONINFOEXW versionInfo; memset(&versionInfo, 0, sizeof(RTL_OSVERSIONINFOEXW)); versionInfo.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW); NTSTATUS(WINAPI *RtlGetVersion)(PRTL_OSVERSIONINFOEXW); *(void**)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll.dll"), "RtlGetVersion"); - if (RtlGetVersion != NULL) + if (RtlGetVersion != NULL) RtlGetVersion(&versionInfo); else GetVersionExW((LPOSVERSIONINFOW)&versionInfo); // since windows 10 this one is lying RtlGetVersion(&versionInfo); - if (DynData == 0) + if (DynData == 0) { QString Message = tr("Your Windows build %1 exceeds the current support capabilities of your Sandboxie version, " "resulting in the disabling of token-based security isolation. Consequently, all applications will operate in application compartment mode without secure isolation.\r\n" @@ -2537,7 +2537,7 @@ void CSandMan::CheckCompat(QObject* receiver, const char* member) return; } } - + m_SbieTemplates->RunCheck(); qDebug() << "Template Check took" << timer->elapsed() << "ms"; @@ -2625,7 +2625,7 @@ void CSandMan::CheckSupport() return; static bool ReminderShown = false; - if (!ReminderShown && (g_CertInfo.expired || (g_CertInfo.expirers_in_sec > 0 && g_CertInfo.expirers_in_sec < (60 * 60 * 24 * 30))) && !theConf->GetBool("Options/NoSupportCheck", false)) + if (!ReminderShown && (g_CertInfo.expired || (g_CertInfo.expirers_in_sec > 0 && g_CertInfo.expirers_in_sec < (60 * 60 * 24 * 30))) && !theConf->GetBool("Options/NoSupportCheck", false)) { ReminderShown = true; CSettingsWindow* pSettingsWindow = new CSettingsWindow(this); @@ -2675,7 +2675,7 @@ void CSandMan::OnHotKey(size_t id) case HK_SUSPEND: { - + for (auto each : theAPI->GetAllBoxes()) { each->SetSuspendedAll(TRUE); }; @@ -2769,7 +2769,7 @@ void CSandMan::AddLogMessage(const QDateTime& TimeStamp, const QString& Message, else pItem->setText(1, Message); #endif - + m_pMessageLog->GetView()->verticalScrollBar()->setValue(m_pMessageLog->GetView()->verticalScrollBar()->maximum()); } @@ -2841,7 +2841,7 @@ void CSandMan::OnLogSbieMessage(quint32 MsgCode, const QStringList& MsgData, qui else Message.append(tr("
Become a project supporter, and receive a supporter certificate")); } - else + else { static quint64 iLastCertWarning = 0; if (iLastCertWarning + 60 < QDateTime::currentDateTime().toSecsSinceEpoch()) { // reset after 60 seconds @@ -2908,7 +2908,7 @@ void CSandMan::SaveMessageLog(QIODevice* pFile) pFile->write((Msg.TimeStamp.toString("dd.MM.yyyy hh:mm:ss.zzz") + "\t" + FormatSbieMessage(Msg.MsgCode, Msg.MsgData, Msg.ProcessName)).toLatin1() + "\n"); } -bool CSandMan::CheckCertificate(QWidget* pWidget, int iType) +bool CSandMan::CheckCertificate(QWidget* pWidget, int iType) { QString Message; if (iType == 1) @@ -2965,13 +2965,13 @@ SB_STATUS CSandMan::ReloadCert(QWidget* pWidget) } else if (Status.GetStatus() == 0xC0000804L /*STATUS_CONTENT_BLOCKED*/) { - QMessageBox::critical(pWidget ? pWidget : this, "Sandboxie-Plus", + QMessageBox::critical(pWidget ? pWidget : this, "Sandboxie-Plus", tr("The certificate you are attempting to use has been blocked, meaning it has been invalidated for cause. Any attempt to use it constitutes a breach of its terms of use!")); BYTE CertBlocked = 1; theAPI->SetSecureParam("CertBlocked", &CertBlocked, sizeof(CertBlocked)); } - else if (Status.GetStatus() != 0xC0000225L /*STATUS_NOT_FOUND*/) + else if (Status.GetStatus() != 0xC0000225L /*STATUS_NOT_FOUND*/) { QString Info; switch (Status.GetStatus()) @@ -3021,7 +3021,7 @@ void CSandMan::UpdateCertState() if (theConf->GetBool("Debug/CertFakeGracePeriode", false)) g_CertInfo.grace_period = 1; - // simulate a subscription type certificate having expired + // simulate a subscription type certificate having expired if (theConf->GetBool("Debug/CertFakeOld", false)) { g_CertInfo.active = 0; g_CertInfo.expired = 1; @@ -3076,7 +3076,7 @@ void CSandMan::UpdateCertState() void CSandMan::OnQueuedRequest(quint32 ClientPid, quint32 ClientTid, quint32 RequestId, const QVariantMap& Data) { - if (Data["id"].toInt() == 0) + if (Data["id"].toInt() == 0) { QVariantMap Ret; Ret["retval"] = (theAPI->IsStarting(ClientPid) || CSupportDialog::ShowDialog()) ? 1 : 0; @@ -3229,7 +3229,7 @@ void CSandMan::OnDisablePopUp() SB_RESULT(void*) CSandMan::ConnectSbie() { SB_RESULT(void*) Status; - if (!CSbieUtils::IsRunning(CSbieUtils::eAll)) + if (!CSbieUtils::IsRunning(CSbieUtils::eAll)) { if (!CSbieUtils::IsInstalled(CSbieUtils::eAll)) { @@ -3264,7 +3264,7 @@ SB_RESULT(void*) CSandMan::ConnectSbie() SB_STATUS CSandMan::ConnectSbieImpl() { SB_STATUS Status = theAPI->Connect(g_PendingMessage.isEmpty(), theConf->GetBool("Options/UseInteractiveQueue", true)); - + if (!g_PendingMessage.isEmpty()) { OnMessage(g_PendingMessage); PostQuitMessage(0); @@ -3342,11 +3342,11 @@ void CSandMan::OnMaintenance() } //else if (sender() == m_pUpdateCore) { - // // todo + // // todo // return; //} - // uninstall + // uninstall else if (sender() == m_pUninstallAll) { Status = StopSbie(true); @@ -3367,7 +3367,7 @@ void CSandMan::HandleMaintenance(SB_RESULT(void*) Status) connect(processFinishedNotifier, &QWinEventNotifier::activated, this, [processFinishedNotifier, this, hProcess]() { processFinishedNotifier->setEnabled(false); processFinishedNotifier->deleteLater(); - + DWORD dwStatus = 0; GetExitCodeProcess(hProcess, & dwStatus); @@ -3460,16 +3460,16 @@ void CSandMan::OnCleanUp() m_MessageLog.clear(); if (m_pMessageLog) m_pMessageLog->GetTree()->clear(); } - + if (sender() == m_pCleanUpTrace || sender() == m_pCleanUpButton) - if (m_pTraceView) { - m_pTraceView->Clear(); + if (m_pTraceView) { + m_pTraceView->Clear(); m_pTraceInfo->clear(); } if (sender() == m_pCleanUpRecovery || sender() == m_pCleanUpButton) if(m_pRecoveryLog) m_pRecoveryLog->GetTree()->clear(); - + if (sender() == m_pCleanUpProcesses || sender() == m_pCleanUpButton) theAPI->UpdateProcesses(0, ShowAllSessions()); } @@ -3555,7 +3555,7 @@ void CSandMan::UpdateSettings(bool bRebuildUI) m_pTrayIcon->hide(); - if (bRebuildUI) + if (bRebuildUI) { StoreState(); @@ -3737,7 +3737,7 @@ void CSandMan::EditIni(const QString& IniPath, bool bPlus) if (!bPlus && theConf->GetBool("Options/WatchIni", true)) return; // if the ini is watched don't double reload - + QWinEventNotifier* processFinishedNotifier = new QWinEventNotifier(si.hProcess); processFinishedNotifier->setEnabled(true); connect(processFinishedNotifier, &QWinEventNotifier::activated, this, [processFinishedNotifier, this, si, bPlus]() { @@ -3908,7 +3908,7 @@ QString CSandMan::FormatError(const SB_STATUS& Error) //case SB_RemNotEmpty: Message = tr("A sandbox must be emptied before it can be renamed."); break; case SB_DelNotEmpty: Message = tr("A sandbox must be emptied before it can be deleted."); break; case SB_FailedMoveDir: Message = tr("Failed to move directory '%1' to '%2'"); break; - case SB_FailedMoveImage:Message = tr("Failed to move box image '%1' to '%2'"); break; + case SB_FailedMoveImage:Message = tr("Failed to move box image '%1' to '%2'"); break; case SB_SnapIsRunning: Message = tr("This Snapshot operation can not be performed while processes are still running in the box."); break; case SB_SnapMkDirFail: Message = tr("Failed to create directory for new snapshot"); break; case SB_SnapCopyDatFail:Message = tr("Failed to copy box data files"); break; @@ -3972,7 +3972,7 @@ void CSandMan::OnBoxAssistant() void CSandMan::TryFix(quint32 MsgCode, const QStringList& MsgData, const QString& ProcessName, const QString& BoxName) { SetWindowPos((HWND)m_pPopUpWindow->winId(), HWND_NOTOPMOST , 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - + QPointer pWizard = new CBoxAssistant(this); pWizard->TryFix(MsgCode, MsgData, ProcessName, BoxName); pWizard->setAttribute(Qt::WA_DeleteOnClose); @@ -3992,7 +3992,7 @@ void CSandMan::OpenUrl(const QUrl& url) { QString scheme = url.scheme(); QString host = url.host(); - QString path = url.path(); + QString path = url.path(); QString query = url.query(); if (scheme == "addon") { @@ -4018,7 +4018,7 @@ void CSandMan::OpenUrl(const QUrl& url) { bool bCheck = false; //QString Message = tr("Do you want to open %1 in a sandboxed (yes) or unsandboxed (no) Web browser?").arg(url.toString()); - //QDialogButtonBox::StandardButton Ret = CCheckableMessageBox::question(this, "Sandboxie-Plus", Message , tr("Remember choice for later."), + //QDialogButtonBox::StandardButton Ret = CCheckableMessageBox::question(this, "Sandboxie-Plus", Message , tr("Remember choice for later."), // &bCheck, QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel, QDialogButtonBox::Yes, QMessageBox::Question); CCheckableMessageBox mb(this); @@ -4044,9 +4044,9 @@ void CSandMan::OpenUrl(const QUrl& url) else ShellExecute(MainWndHandle, NULL, url.toString().toStdWString().c_str(), NULL, NULL, SW_SHOWNORMAL); } -bool CSandMan::IsWFPEnabled() const -{ - return (g_FeatureFlags & CSbieAPI::eSbieFeatureWFP) != 0; +bool CSandMan::IsWFPEnabled() const +{ + return (g_FeatureFlags & CSbieAPI::eSbieFeatureWFP) != 0; } QString CSandMan::GetVersion() @@ -4074,7 +4074,7 @@ void CSandMan::SetUITheme() bDark = (settings.value("AppsUseLightTheme") == 0); } else bDark = (iDark == 1); - + if (bDark) QApplication::setPalette(m_DarkPalett); else @@ -4086,7 +4086,7 @@ void CSandMan::SetUITheme() int iFusion = theConf->GetInt("Options/UseFusionTheme", 2); if (iFusion == 2) bFusion = bDark; - else + else bFusion = (iFusion == 1); if (bFusion) @@ -4127,7 +4127,7 @@ void CSandMan::SetTitleTheme(const HWND& hwnd) QSettings::NativeFormat).value("CurrentBuild").toInt(); if (CurrentVersion < 17763) // Windows 10 1809 - return; - + HMODULE dwmapi = GetModuleHandle(L"dwmapi.dll"); if (dwmapi) { @@ -4178,7 +4178,7 @@ void CSandMan::LoadLanguage() #endif m_LanguageId = LocaleNameToLCID(m_Language.toStdWString().c_str(), 0); - if (!m_LanguageId) + if (!m_LanguageId) m_LanguageId = 1033; // default to English LoadLanguage(m_Language, "sandman", 0); @@ -4202,7 +4202,7 @@ void CSandMan::LoadLanguage(const QString& Lang, const QString& Module, int Inde if (Lang.isEmpty()) return; - + QString LangAux = Lang; // Short version as fallback LangAux.truncate(LangAux.lastIndexOf('_')); @@ -4226,7 +4226,7 @@ void CSandMan::OnHelp() { //if (sender() == m_pSupport) // QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=donate")); - //else + //else if (sender() == m_pContribution) QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=sbie-contribute")); else if (sender() == m_pManual) @@ -4273,14 +4273,14 @@ void CSandMan::OnAbout() msgBox->setInformativeText(AboutText); QIcon ico(QLatin1String(":/SandMan.png")); - + QPixmap pix(128, 160); pix.fill(Qt::transparent); QPainter painter(&pix); painter.drawPixmap(0, 0, ico.pixmap(128, 128)); - if (g_CertInfo.active) + if (g_CertInfo.active) { //painter.setPen(Qt::blue); //painter.drawRect(0, 0, 127, 159); @@ -4351,20 +4351,20 @@ int g_CertAmount = 0; void SlotSend(const std::wstring& message) { std::wstring strSlotName = L"\\\\*\\mailslot\\" + g_SlotName; - HANDLE hSlot = CreateFile(strSlotName.c_str(), - GENERIC_WRITE, + HANDLE hSlot = CreateFile(strSlotName.c_str(), + GENERIC_WRITE, FILE_SHARE_READ, - (LPSECURITY_ATTRIBUTES) NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - (HANDLE) NULL); - if (hSlot == INVALID_HANDLE_VALUE) - { + (LPSECURITY_ATTRIBUTES) NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + (HANDLE) NULL); + if (hSlot == INVALID_HANDLE_VALUE) + { //GetLastError(); return; - } + } - DWORD cbWritten; + DWORD cbWritten; WriteFile(hSlot, message.c_str(), (DWORD)(message.size() + 1) * sizeof(wchar_t), &cbWritten, NULL); CloseHandle(hSlot); @@ -4397,14 +4397,14 @@ int CountSeats() DWORD WINAPI MailThreadFunc(LPVOID lpParam) { std::wstring strSlotName = L"\\\\.\\mailslot\\" + g_SlotName; - HANDLE hSlot = CreateMailslot(strSlotName.c_str(), - 0, // no maximum message size - MAILSLOT_WAIT_FOREVER, // no time-out for operations + HANDLE hSlot = CreateMailslot(strSlotName.c_str(), + 0, // no maximum message size + MAILSLOT_WAIT_FOREVER, // no time-out for operations (LPSECURITY_ATTRIBUTES) NULL); // default security - if (hSlot == INVALID_HANDLE_VALUE) { + if (hSlot == INVALID_HANDLE_VALUE) { //GetLastError() - return FALSE; - } + return FALSE; + } ScanForSeats(); @@ -4414,11 +4414,11 @@ DWORD WINAPI MailThreadFunc(LPVOID lpParam) { DWORD cbMessage; DWORD dwMessageCount; - if(!GetMailslotInfo(hSlot, // mailslot handle - (LPDWORD)NULL, // no maximum message size - &cbMessage, // size of next message - &dwMessageCount, // number of messages - (LPDWORD)NULL)) // no read time-out + if(!GetMailslotInfo(hSlot, // mailslot handle + (LPDWORD)NULL, // no maximum message size + &cbMessage, // size of next message + &dwMessageCount, // number of messages + (LPDWORD)NULL)) // no read time-out { //GetLastError(); continue; diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 1fe82e0c..d7af590d 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -24,7 +24,7 @@ class CScriptManager; class CAddonManager; struct ToolBarAction { - // Identifier of action stored in ini. Empty for separator. + // Identifier of action stored in ini. Empty for separator. QString scriptName = ""; // Not owned. Null for special cases. @@ -104,7 +104,7 @@ public: QIcon MakeIconBusy(const QIcon& Icon, int Index = 0); QIcon IconAddOverlay(const QIcon& Icon, const QString& Name, int Size = 24); QString GetBoxDescription(int boxType); - + bool CheckCertificate(QWidget* pWidget, int iType = 0); bool IsAlwaysOnTop() const; @@ -156,7 +156,7 @@ protected: CScriptManager* m_SbieScripts; CAddonManager* m_AddonManager; - + QMap>> m_pAsyncProgress; QMap> m_MissingTemplates; @@ -183,7 +183,7 @@ protected: struct SSbieMsg { QDateTime TimeStamp; quint32 MsgCode; - QStringList MsgData; + QStringList MsgData; QString ProcessName; }; QVector m_MessageLog;