Remove trailing spaces

This commit is contained in:
isaak654 2024-02-27 17:18:29 +01:00
parent f8bdf6d3e0
commit 7eaab65423
No known key found for this signature in database
GPG Key ID: 59D402040437EC44
2 changed files with 109 additions and 109 deletions

View File

@ -82,10 +82,10 @@ public:
if (theGUI) if (theGUI)
theGUI->UpdateDrives(); 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); UCHAR driveNumber = (UCHAR)(msg->wParam & 0x1F);
if (driveNumber < 26) { if (driveNumber < 26) {
} }
} }
else if (msg->wParam == DBT_DEVNODES_CHANGED) // hardware changed else if (msg->wParam == DBT_DEVNODES_CHANGED) // hardware changed
@ -374,8 +374,8 @@ void CSandMan::CreateUI()
// Clear old ToolBar references. // Clear old ToolBar references.
m_pNewBoxButton = nullptr; m_pNewBoxButton = nullptr;
m_pCleanUpButton = nullptr; m_pCleanUpButton = nullptr;
m_pEditIniButton = nullptr; m_pEditIniButton = nullptr;
int iViewMode = theConf->GetInt("Options/ViewMode", 1); int iViewMode = theConf->GetInt("Options/ViewMode", 1);
if(iViewMode == 2) if(iViewMode == 2)
@ -418,7 +418,7 @@ void CSandMan::CreateUI()
int iUsePizza = theConf->GetInt("Options/UseBackground", 2); int iUsePizza = theConf->GetInt("Options/UseBackground", 2);
if (iUsePizza == 2) if (iUsePizza == 2)
iUsePizza = theConf->GetInt("Options/ViewMode", 1) == 2 ? 1 : 0; iUsePizza = theConf->GetInt("Options/ViewMode", 1) == 2 ? 1 : 0;
if (iUsePizza) if (iUsePizza)
{ {
QPalette pizzaPalete = GetBoxView()->GetTree()->palette(); // QPalette pizzaPalete = QApplication::palette(); QPalette pizzaPalete = GetBoxView()->GetTree()->palette(); // QPalette pizzaPalete = QApplication::palette();
SetPaleteTexture(pizzaPalete, QPalette::Base, QImage(":/Assets/background.png")); 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_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_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 = m_pMenuFile->addAction(CSandMan::GetIcon("UnPackBox"), tr("Import Box"), this, SLOT(OnSandBoxAction()));
m_pImportBox->setEnabled(CArchive::IsInit()); m_pImportBox->setEnabled(CArchive::IsInit());
m_pMenuFile->addSeparator(); m_pMenuFile->addSeparator();
m_pRunBoxed = m_pMenuFile->addAction(CSandMan::GetIcon("Run"), tr("Run Sandboxed"), this, SLOT(OnSandBoxAction())); 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_pLockAll = m_pMenuFile->addAction(CSandMan::GetIcon("LockClosed"), tr("Lock All Encrypted Boxes"), this, SLOT(OnLockAll()));
m_pMenuFile->addSeparator(); m_pMenuFile->addSeparator();
m_pWndFinder = m_pMenuFile->addAction(CSandMan::GetIcon("finder"), tr("Is Window Sandboxed?"), this, SLOT(OnWndFinder())); m_pWndFinder = m_pMenuFile->addAction(CSandMan::GetIcon("finder"), tr("Is Window Sandboxed?"), this, SLOT(OnWndFinder()));
if(bAdvanced || theGUI->IsFullyPortable()) if(bAdvanced || theGUI->IsFullyPortable())
CreateMaintenanceMenu(); CreateMaintenanceMenu();
else { else {
@ -536,7 +536,7 @@ void CSandMan::CreateMenus(bool bAdvanced)
m_pSetupWizard = NULL; m_pSetupWizard = NULL;
//m_pUpdateCore = NULL; //m_pUpdateCore = NULL;
} }
m_pMenuFile->addSeparator(); m_pMenuFile->addSeparator();
m_pRestart = m_pMenuFile->addAction(CSandMan::GetIcon("Exit"), tr("Restart As Admin"), this, SLOT(OnRestartAsAdmin())); 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())); 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); m_pEnableMonitoring->setCheckable(true);
if (!bAdvanced) if (!bAdvanced)
m_pMenuView->addAction(CSandMan::GetIcon("Recover"), tr("Recovery Log"), this, SLOT(OnRecoveryLog())); m_pMenuView->addAction(CSandMan::GetIcon("Recover"), tr("Recovery Log"), this, SLOT(OnRecoveryLog()));
m_pMenuOptions = m_pMenuBar->addMenu(tr("&Options")); m_pMenuOptions = m_pMenuBar->addMenu(tr("&Options"));
m_pMenuSettings = m_pMenuOptions->addAction(CSandMan::GetIcon("Settings"), tr("Global Settings"), this, SLOT(OnSettings())); 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->setCheckable(true);
m_pDisableRecovery = NULL; m_pDisableRecovery = NULL;
//m_pDisableMessages = m_pMenuFile->addAction(tr("Disable Message Popup")); //m_pDisableMessages = m_pMenuFile->addAction(tr("Disable Message Popup"));
//m_pDisableMessages->setCheckable(true); //m_pDisableMessages->setCheckable(true);
m_pDisableMessages = NULL; m_pDisableMessages = NULL;
m_pMenuFile->addSeparator(); m_pMenuFile->addSeparator();
m_pWndFinder = m_pMenuFile->addAction(CSandMan::GetIcon("finder"), tr("Is Window Sandboxed?"), this, SLOT(OnWndFinder())); m_pWndFinder = m_pMenuFile->addAction(CSandMan::GetIcon("finder"), tr("Is Window Sandboxed?"), this, SLOT(OnWndFinder()));
@ -799,7 +799,7 @@ QSet<QString> CSandMan::GetToolBarItemsConfig()
QSet<QString> validSet; QSet<QString> validSet;
for (auto item : GetAvailableToolBarActions()) { for (auto item : GetAvailableToolBarActions()) {
if (!item.scriptName.isEmpty()) validSet.insert(item.scriptName); if (!item.scriptName.isEmpty()) validSet.insert(item.scriptName);
} }
@ -926,7 +926,7 @@ void CSandMan::CreateToolBarConfigMenu(const QList<ToolBarAction>& actions, cons
} }
} }
m_pToolBar->setContextMenuPolicy(Qt::CustomContextMenu); m_pToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(m_pToolBar, &QToolBar::customContextMenuRequested, this, QObject::connect(m_pToolBar, &QToolBar::customContextMenuRequested, this,
[&](const QPoint& p) { [&](const QPoint& p) {
m_pToolBarContextMenu->exec(mapToGlobal(p)); m_pToolBarContextMenu->exec(mapToGlobal(p));
@ -937,7 +937,7 @@ void CSandMan::CreateToolBarConfigMenu(const QList<ToolBarAction>& actions, cons
void CSandMan::CreateToolBar(bool rebuild) void CSandMan::CreateToolBar(bool rebuild)
{ {
// Assumes UI is in Advanced-Mode and menus have been built. // Assumes UI is in Advanced-Mode and menus have been built.
auto pOldToolBar = m_pToolBar; auto pOldToolBar = m_pToolBar;
m_pToolBar = new QToolBar(); m_pToolBar = new QToolBar();
m_pMainLayout->insertWidget(0, m_pToolBar); m_pMainLayout->insertWidget(0, m_pToolBar);
@ -986,7 +986,7 @@ void CSandMan::CreateToolBar(bool rebuild)
but->setToolTip(tr("Cleanup")); but->setToolTip(tr("Cleanup"));
but->setText(tr("Cleanup")); but->setText(tr("Cleanup"));
but->setPopupMode(QToolButton::MenuButtonPopup); but->setPopupMode(QToolButton::MenuButtonPopup);
but->setMenu(m_pCleanUpMenu); but->setMenu(m_pCleanUpMenu);
QObject::connect(but, SIGNAL(clicked(bool)), this, SLOT(OnCleanUp())); QObject::connect(but, SIGNAL(clicked(bool)), this, SLOT(OnCleanUp()));
m_pCleanUpButton = but; m_pCleanUpButton = but;
m_pToolBar->addWidget(but); m_pToolBar->addWidget(but);
@ -1082,7 +1082,7 @@ void CSandMan::UpdateLabel()
//auto neon = new CNeonEffect(10, 4, 180); // 140 //auto neon = new CNeonEffect(10, 4, 180); // 140
//m_pLabel->setGraphicsEffect(NULL); //m_pLabel->setGraphicsEffect(NULL);
} }
else if (g_Certificate.isEmpty()) else if (g_Certificate.isEmpty())
{ {
LabelText = tr("<a href=\"https://sandboxie-plus.com/go.php?to=patreon\">Support Sandboxie-Plus on Patreon</a>"); LabelText = tr("<a href=\"https://sandboxie-plus.com/go.php?to=patreon\">Support Sandboxie-Plus on Patreon</a>");
LabelTip = tr("Click to open web browser"); LabelTip = tr("Click to open web browser");
@ -1169,7 +1169,7 @@ void CSandMan::CreateView(int iViewMode)
else else
m_pRecoveryLogWnd = NULL; m_pRecoveryLogWnd = NULL;
if (iViewMode == 2) if (iViewMode == 2)
{ {
m_pViewStack = new QStackedLayout(); m_pViewStack = new QStackedLayout();
m_pViewStack->addWidget(m_pBoxView); m_pViewStack->addWidget(m_pBoxView);
@ -1206,7 +1206,7 @@ void CSandMan::CreateView(int iViewMode)
m_pViewStack = NULL; m_pViewStack = NULL;
m_pBoxCombo = NULL; m_pBoxCombo = NULL;
if (iViewMode == 1) if (iViewMode == 1)
{ {
m_pLogSplitter = new QSplitter(); m_pLogSplitter = new QSplitter();
m_pLogSplitter->setOrientation(Qt::Vertical); m_pLogSplitter->setOrientation(Qt::Vertical);
@ -1217,7 +1217,7 @@ void CSandMan::CreateView(int iViewMode)
m_pPanelSplitter->setOrientation(Qt::Horizontal); m_pPanelSplitter->setOrientation(Qt::Horizontal);
if (iViewMode == 1) if (iViewMode == 1)
m_pLogSplitter->addWidget(m_pPanelSplitter); m_pLogSplitter->addWidget(m_pPanelSplitter);
else else
m_pMainLayout->addWidget(m_pPanelSplitter); m_pMainLayout->addWidget(m_pPanelSplitter);
m_pPanelSplitter->addWidget(m_pBoxView); m_pPanelSplitter->addWidget(m_pBoxView);
@ -1236,7 +1236,7 @@ void CSandMan::CreateView(int iViewMode)
m_pMessageLog->GetTree()->setItemDelegate(new CTreeItemDelegate()); m_pMessageLog->GetTree()->setItemDelegate(new CTreeItemDelegate());
m_pMessageLog->GetTree()->setAlternatingRowColors(theConf->GetBool("Options/AltRowColors", false)); m_pMessageLog->GetTree()->setAlternatingRowColors(theConf->GetBool("Options/AltRowColors", false));
//m_pMessageLog->GetView()->setItemDelegate(theGUI->GetItemDelegate()); //m_pMessageLog->GetView()->setItemDelegate(theGUI->GetItemDelegate());
((QTreeWidgetEx*)m_pMessageLog->GetView())->setHeaderLabels(tr("Time|Message").split("|")); ((QTreeWidgetEx*)m_pMessageLog->GetView())->setHeaderLabels(tr("Time|Message").split("|"));
((QTreeWidgetEx*)m_pMessageLog->GetView())->setColumnFixed(1, true); ((QTreeWidgetEx*)m_pMessageLog->GetView())->setColumnFixed(1, true);
@ -1380,9 +1380,9 @@ void CSandMan::closeEvent(QCloseEvent *e)
void CSandMan::changeEvent(QEvent* e) void CSandMan::changeEvent(QEvent* e)
{ {
if (e->type() == QEvent::WindowStateChange) if (e->type() == QEvent::WindowStateChange)
{ {
if (isMinimized()) if (isMinimized())
{ {
if (m_bOnTop) { if (m_bOnTop) {
m_bOnTop = false; m_bOnTop = false;
@ -1403,16 +1403,16 @@ void CSandMan::changeEvent(QEvent* e)
} }
} }
} }
QMainWindow::changeEvent(e); QMainWindow::changeEvent(e);
} }
void CSandMan::commitData(QSessionManager& manager) void CSandMan::commitData(QSessionManager& manager)
{ {
//if (manager.allowsInteraction()) //if (manager.allowsInteraction())
//{ //{
// manager.cancel(); // manager.cancel();
// return; // return;
//} //}
m_pBoxView->SaveState(); m_pBoxView->SaveState();
m_pFileView->SaveState(); m_pFileView->SaveState();
@ -1458,7 +1458,7 @@ QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse/*, bool bOut*/)
*c = rgb; *c = rgb;
} }
//} //}
QPixmap result(32, 32); QPixmap result(32, 32);
result.fill(Qt::transparent); // force alpha channel result.fill(Qt::transparent); // force alpha channel
QPainter painter(&result); QPainter painter(&result);
@ -1474,8 +1474,8 @@ QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse/*, bool bOut*/)
painter.drawPixmap(0, 0, FrameDM); painter.drawPixmap(0, 0, FrameDM);
else else
painter.drawPixmap(0, 0, Frame); painter.drawPixmap(0, 0, Frame);
if (inUse) if (inUse)
{ {
//rgb = change_hsv_c(rgb, -60, 2, 1); // yellow -> red //rgb = change_hsv_c(rgb, -60, 2, 1); // yellow -> red
my_rgb rgb1 = { (double)qRed(rgb), (double)qGreen(rgb), (double)qBlue(rgb) }; my_rgb rgb1 = { (double)qRed(rgb), (double)qGreen(rgb), (double)qBlue(rgb) };
@ -1551,7 +1551,7 @@ QString CSandMan::GetBoxDescription(int boxType)
break; break;
case CSandBoxPlus::eDefaultPlus: case CSandBoxPlus::eDefaultPlus:
case CSandBoxPlus::eDefault: 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; break;
case CSandBoxPlus::eAppBoxPlus: case CSandBoxPlus::eAppBoxPlus:
case CSandBoxPlus::eAppBox: case CSandBoxPlus::eAppBox:
@ -1561,7 +1561,7 @@ QString CSandMan::GetBoxDescription(int boxType)
Info = tr("This box will be <a href=\"sbie://docs/boxencryption\">encrypted</a> and <a href=\"sbie://docs/black-box\">access to sandboxed processes will be guarded</a>."); Info = tr("This box will be <a href=\"sbie://docs/boxencryption\">encrypted</a> and <a href=\"sbie://docs/black-box\">access to sandboxed processes will be guarded</a>.");
break; break;
} }
if(boxType == CSandBoxPlus::eHardenedPlus || boxType == CSandBoxPlus::eDefaultPlus || boxType == CSandBoxPlus::eAppBoxPlus) if(boxType == CSandBoxPlus::eHardenedPlus || boxType == CSandBoxPlus::eDefaultPlus || boxType == CSandBoxPlus::eAppBoxPlus)
Info.append(tr("<br /><br />This box <a href=\"sbie://docs/privacy-mode\">prevents access to all user data</a> locations, except explicitly granted in the Resource Access options.")); Info.append(tr("<br /><br />This box <a href=\"sbie://docs/privacy-mode\">prevents access to all user data</a> locations, except explicitly granted in the Resource Access options."));
@ -1578,7 +1578,7 @@ bool CSandMan::IsFullyPortable()
} }
bool CSandMan::KeepTerminated() bool CSandMan::KeepTerminated()
{ {
if (CWizardEngine::GetInstanceCount() > 0) if (CWizardEngine::GetInstanceCount() > 0)
return true; return true;
return m_pKeepTerminated && m_pKeepTerminated->isChecked(); 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<CSandBoxPlus>(); auto pBoxEx = theAPI->GetBoxByName(BoxName).objectCast<CSandBoxPlus>();
if (pBoxEx && pBoxEx->UseImageFile() && pBoxEx->GetMountRoot().isEmpty()){ if (pBoxEx && pBoxEx->UseImageFile() && pBoxEx->GetMountRoot().isEmpty()){
SB_STATUS Status = ImBoxMount(pBoxEx, true); SB_STATUS Status = ImBoxMount(pBoxEx, true);
if (Status.IsError()) if (Status.IsError())
return Status; return Status;
@ -1754,7 +1754,7 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
m_pDisableForce->setChecked(bForceProcessDisabled); m_pDisableForce->setChecked(bForceProcessDisabled);
m_pDisableForce2->setChecked(bForceProcessDisabled); m_pDisableForce2->setChecked(bForceProcessDisabled);
if (m_pTraceView) if (m_pTraceView)
{ {
bool bIsMonitoring = theAPI->IsMonitoring(); bool bIsMonitoring = theAPI->IsMonitoring();
m_pEnableMonitoring->setChecked(bIsMonitoring); m_pEnableMonitoring->setChecked(bIsMonitoring);
@ -1774,7 +1774,7 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
ActiveProcesses++; ActiveProcesses++;
} }
} }
else else
ActiveProcesses = Processes.count(); ActiveProcesses = Processes.count();
@ -1870,7 +1870,7 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
QSharedPointer<CSbieIni> Section; QSharedPointer<CSbieIni> Section;
if (I.key() == "GlobalSettings") if (I.key() == "GlobalSettings")
Section = theAPI->GetGlobalSettings(); Section = theAPI->GetGlobalSettings();
else else
Section = theAPI->GetBoxByName(I.key()); Section = theAPI->GetBoxByName(I.key());
if (!Section) continue; if (!Section) continue;
@ -1888,7 +1888,7 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
} }
} }
void CSandMan::UpdateDrives() void CSandMan::UpdateDrives()
{ {
static bool UpdatePending = false; static bool UpdatePending = false;
if (!UpdatePending) { if (!UpdatePending) {
@ -1907,7 +1907,7 @@ void CSandMan::UpdateDrives()
qDebug() << "=============="; qDebug() << "==============";
for (auto I = volumes.begin(); I != volumes.end(); ++I) { for (auto I = volumes.begin(); I != volumes.end(); ++I) {
for (auto J = I->mountPoints.begin(); J != I->mountPoints.end(); ++J) { for (auto J = I->mountPoints.begin(); J != I->mountPoints.end(); ++J) {
QString Device; QString Device;
bool bOnUSB = false; bool bOnUSB = false;
for (auto J = I->disks.begin(); J != I->disks.end(); ++J) { 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) { if (Mode != eForDelete) {
// //
// schedule async OnBoxDelete triggers and clean up // schedule async OnBoxDelete triggers and clean up
// //
@ -2049,7 +2049,7 @@ SB_STATUS CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, boo
m_iDeletingContent++; m_iDeletingContent++;
if (Mode != eForDelete) { if (Mode != eForDelete) {
// //
// execute OnBoxDelete triggers // execute OnBoxDelete triggers
// //
@ -2066,7 +2066,7 @@ SB_STATUS CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, boo
} }
} }
} }
{ {
// //
// delete content synchronously // delete content synchronously
@ -2198,7 +2198,7 @@ void CSandMan::SyncStartMenu()
EnumBoxLinks(BoxLinks, "Desktop", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), false); EnumBoxLinks(BoxLinks, "Desktop", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), false);
QMap<QString, CSandBoxPtr> Boxes = theAPI->GetAllBoxes(); QMap<QString, CSandBoxPtr> Boxes = theAPI->GetAllBoxes();
foreach(const CSandBoxPtr & pBox, Boxes) foreach(const CSandBoxPtr & pBox, Boxes)
{ {
CSandBoxPlus* pBoxEx = (CSandBoxPlus*)pBox.data(); CSandBoxPlus* pBoxEx = (CSandBoxPlus*)pBox.data();
@ -2300,7 +2300,7 @@ void CSandMan::OnBoxClosed(const CSandBoxPtr& pBox)
void CSandMan::OnBoxCleaned(CSandBoxPlus* pBoxEx) void CSandMan::OnBoxCleaned(CSandBoxPlus* pBoxEx)
{ {
if (pBoxEx->GetBool("AutoRemove", false)) if (pBoxEx->GetBool("AutoRemove", false))
{ {
if (theConf->GetBool("Options/AutoBoxOpsNotify", false)) if (theConf->GetBool("Options/AutoBoxOpsNotify", false))
OnLogMessage(tr("Auto removing sandbox %1").arg(pBoxEx->GetName()), true); OnLogMessage(tr("Auto removing sandbox %1").arg(pBoxEx->GetName()), true);
@ -2317,7 +2317,7 @@ void CSandMan::OnStatusChanged()
#else #else
QString appTitle = tr("Sandboxie-Plus v%1").arg(GetVersion()); QString appTitle = tr("Sandboxie-Plus v%1").arg(GetVersion());
#endif #endif
bool bConnected = theAPI->IsConnected(); bool bConnected = theAPI->IsConnected();
m_pConnect->setEnabled(!bConnected); m_pConnect->setEnabled(!bConnected);
m_pDisconnect->setEnabled(bConnected); m_pDisconnect->setEnabled(bConnected);
@ -2333,7 +2333,7 @@ void CSandMan::OnStatusChanged()
OnLogMessage(tr("Data Directory: %1").arg(QString(theConf->GetConfigDir()).replace("/","\\"))); OnLogMessage(tr("Data Directory: %1").arg(QString(theConf->GetConfigDir()).replace("/","\\")));
//statusBar()->showMessage(tr("Driver version: %1").arg(theAPI->GetVersion())); //statusBar()->showMessage(tr("Driver version: %1").arg(theAPI->GetVersion()));
//appTitle.append(tr(" - Driver: v%1").arg(theAPI->GetVersion())); //appTitle.append(tr(" - Driver: v%1").arg(theAPI->GetVersion()));
if (bPortable) if (bPortable)
{ {
@ -2347,7 +2347,7 @@ void CSandMan::OnStatusChanged()
QString NtBoxRoot = theAPI->GetGlobalSettings()->GetText("FileRootPath", "\\??\\%SystemDrive%\\Sandbox\\%USER%\\%SANDBOX%", false, false).replace("GlobalSettings", "[BoxName]"); QString NtBoxRoot = theAPI->GetGlobalSettings()->GetText("FileRootPath", "\\??\\%SystemDrive%\\Sandbox\\%USER%\\%SANDBOX%", false, false).replace("GlobalSettings", "[BoxName]");
bool State = false; 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") 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(BoxPath + "\\[BoxName]")
.arg(theAPI->Nt2DosPath(NtBoxRoot)) .arg(theAPI->Nt2DosPath(NtBoxRoot))
@ -2407,7 +2407,7 @@ void CSandMan::OnStatusChanged()
theAPI->SetSecureParam("UsageFlags", &UsageFlags, sizeof(UsageFlags)); theAPI->SetSecureParam("UsageFlags", &UsageFlags, sizeof(UsageFlags));
} }
} }
g_FeatureFlags = theAPI->GetFeatureFlags(); g_FeatureFlags = theAPI->GetFeatureFlags();
SB_STATUS Status = theAPI->ReloadBoxes(true); SB_STATUS Status = theAPI->ReloadBoxes(true);
@ -2447,20 +2447,20 @@ void CSandMan::OnStatusChanged()
} }
int DynData = theAPI->IsDyndataActive(); int DynData = theAPI->IsDyndataActive();
if (DynData != 1) if (DynData != 1)
{ {
RTL_OSVERSIONINFOEXW versionInfo; RTL_OSVERSIONINFOEXW versionInfo;
memset(&versionInfo, 0, sizeof(RTL_OSVERSIONINFOEXW)); memset(&versionInfo, 0, sizeof(RTL_OSVERSIONINFOEXW));
versionInfo.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW); versionInfo.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
NTSTATUS(WINAPI *RtlGetVersion)(PRTL_OSVERSIONINFOEXW); NTSTATUS(WINAPI *RtlGetVersion)(PRTL_OSVERSIONINFOEXW);
*(void**)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll.dll"), "RtlGetVersion"); *(void**)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll.dll"), "RtlGetVersion");
if (RtlGetVersion != NULL) if (RtlGetVersion != NULL)
RtlGetVersion(&versionInfo); RtlGetVersion(&versionInfo);
else else
GetVersionExW((LPOSVERSIONINFOW)&versionInfo); // since windows 10 this one is lying GetVersionExW((LPOSVERSIONINFOW)&versionInfo); // since windows 10 this one is lying
RtlGetVersion(&versionInfo); RtlGetVersion(&versionInfo);
if (DynData == 0) if (DynData == 0)
{ {
QString Message = tr("Your Windows build %1 exceeds the current support capabilities of your Sandboxie version, " 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" "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; return;
} }
} }
m_SbieTemplates->RunCheck(); m_SbieTemplates->RunCheck();
qDebug() << "Template Check took" << timer->elapsed() << "ms"; qDebug() << "Template Check took" << timer->elapsed() << "ms";
@ -2625,7 +2625,7 @@ void CSandMan::CheckSupport()
return; return;
static bool ReminderShown = false; 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; ReminderShown = true;
CSettingsWindow* pSettingsWindow = new CSettingsWindow(this); CSettingsWindow* pSettingsWindow = new CSettingsWindow(this);
@ -2675,7 +2675,7 @@ void CSandMan::OnHotKey(size_t id)
case HK_SUSPEND: case HK_SUSPEND:
{ {
for (auto each : theAPI->GetAllBoxes()) { for (auto each : theAPI->GetAllBoxes()) {
each->SetSuspendedAll(TRUE); each->SetSuspendedAll(TRUE);
}; };
@ -2769,7 +2769,7 @@ void CSandMan::AddLogMessage(const QDateTime& TimeStamp, const QString& Message,
else else
pItem->setText(1, Message); pItem->setText(1, Message);
#endif #endif
m_pMessageLog->GetView()->verticalScrollBar()->setValue(m_pMessageLog->GetView()->verticalScrollBar()->maximum()); m_pMessageLog->GetView()->verticalScrollBar()->setValue(m_pMessageLog->GetView()->verticalScrollBar()->maximum());
} }
@ -2841,7 +2841,7 @@ void CSandMan::OnLogSbieMessage(quint32 MsgCode, const QStringList& MsgData, qui
else else
Message.append(tr("<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>")); Message.append(tr("<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>"));
} }
else else
{ {
static quint64 iLastCertWarning = 0; static quint64 iLastCertWarning = 0;
if (iLastCertWarning + 60 < QDateTime::currentDateTime().toSecsSinceEpoch()) { // reset after 60 seconds 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"); 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; QString Message;
if (iType == 1) if (iType == 1)
@ -2965,13 +2965,13 @@ SB_STATUS CSandMan::ReloadCert(QWidget* pWidget)
} }
else if (Status.GetStatus() == 0xC0000804L /*STATUS_CONTENT_BLOCKED*/) 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!")); 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; BYTE CertBlocked = 1;
theAPI->SetSecureParam("CertBlocked", &CertBlocked, sizeof(CertBlocked)); theAPI->SetSecureParam("CertBlocked", &CertBlocked, sizeof(CertBlocked));
} }
else if (Status.GetStatus() != 0xC0000225L /*STATUS_NOT_FOUND*/) else if (Status.GetStatus() != 0xC0000225L /*STATUS_NOT_FOUND*/)
{ {
QString Info; QString Info;
switch (Status.GetStatus()) switch (Status.GetStatus())
@ -3021,7 +3021,7 @@ void CSandMan::UpdateCertState()
if (theConf->GetBool("Debug/CertFakeGracePeriode", false)) if (theConf->GetBool("Debug/CertFakeGracePeriode", false))
g_CertInfo.grace_period = 1; 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)) { if (theConf->GetBool("Debug/CertFakeOld", false)) {
g_CertInfo.active = 0; g_CertInfo.active = 0;
g_CertInfo.expired = 1; g_CertInfo.expired = 1;
@ -3076,7 +3076,7 @@ void CSandMan::UpdateCertState()
void CSandMan::OnQueuedRequest(quint32 ClientPid, quint32 ClientTid, quint32 RequestId, const QVariantMap& Data) void CSandMan::OnQueuedRequest(quint32 ClientPid, quint32 ClientTid, quint32 RequestId, const QVariantMap& Data)
{ {
if (Data["id"].toInt() == 0) if (Data["id"].toInt() == 0)
{ {
QVariantMap Ret; QVariantMap Ret;
Ret["retval"] = (theAPI->IsStarting(ClientPid) || CSupportDialog::ShowDialog()) ? 1 : 0; Ret["retval"] = (theAPI->IsStarting(ClientPid) || CSupportDialog::ShowDialog()) ? 1 : 0;
@ -3229,7 +3229,7 @@ void CSandMan::OnDisablePopUp()
SB_RESULT(void*) CSandMan::ConnectSbie() SB_RESULT(void*) CSandMan::ConnectSbie()
{ {
SB_RESULT(void*) Status; SB_RESULT(void*) Status;
if (!CSbieUtils::IsRunning(CSbieUtils::eAll)) if (!CSbieUtils::IsRunning(CSbieUtils::eAll))
{ {
if (!CSbieUtils::IsInstalled(CSbieUtils::eAll)) if (!CSbieUtils::IsInstalled(CSbieUtils::eAll))
{ {
@ -3264,7 +3264,7 @@ SB_RESULT(void*) CSandMan::ConnectSbie()
SB_STATUS CSandMan::ConnectSbieImpl() SB_STATUS CSandMan::ConnectSbieImpl()
{ {
SB_STATUS Status = theAPI->Connect(g_PendingMessage.isEmpty(), theConf->GetBool("Options/UseInteractiveQueue", true)); SB_STATUS Status = theAPI->Connect(g_PendingMessage.isEmpty(), theConf->GetBool("Options/UseInteractiveQueue", true));
if (!g_PendingMessage.isEmpty()) { if (!g_PendingMessage.isEmpty()) {
OnMessage(g_PendingMessage); OnMessage(g_PendingMessage);
PostQuitMessage(0); PostQuitMessage(0);
@ -3342,11 +3342,11 @@ void CSandMan::OnMaintenance()
} }
//else if (sender() == m_pUpdateCore) { //else if (sender() == m_pUpdateCore) {
// // todo // // todo
// return; // return;
//} //}
// uninstall // uninstall
else if (sender() == m_pUninstallAll) { else if (sender() == m_pUninstallAll) {
Status = StopSbie(true); Status = StopSbie(true);
@ -3367,7 +3367,7 @@ void CSandMan::HandleMaintenance(SB_RESULT(void*) Status)
connect(processFinishedNotifier, &QWinEventNotifier::activated, this, [processFinishedNotifier, this, hProcess]() { connect(processFinishedNotifier, &QWinEventNotifier::activated, this, [processFinishedNotifier, this, hProcess]() {
processFinishedNotifier->setEnabled(false); processFinishedNotifier->setEnabled(false);
processFinishedNotifier->deleteLater(); processFinishedNotifier->deleteLater();
DWORD dwStatus = 0; DWORD dwStatus = 0;
GetExitCodeProcess(hProcess, & dwStatus); GetExitCodeProcess(hProcess, & dwStatus);
@ -3460,16 +3460,16 @@ void CSandMan::OnCleanUp()
m_MessageLog.clear(); m_MessageLog.clear();
if (m_pMessageLog) m_pMessageLog->GetTree()->clear(); if (m_pMessageLog) m_pMessageLog->GetTree()->clear();
} }
if (sender() == m_pCleanUpTrace || sender() == m_pCleanUpButton) if (sender() == m_pCleanUpTrace || sender() == m_pCleanUpButton)
if (m_pTraceView) { if (m_pTraceView) {
m_pTraceView->Clear(); m_pTraceView->Clear();
m_pTraceInfo->clear(); m_pTraceInfo->clear();
} }
if (sender() == m_pCleanUpRecovery || sender() == m_pCleanUpButton) if (sender() == m_pCleanUpRecovery || sender() == m_pCleanUpButton)
if(m_pRecoveryLog) m_pRecoveryLog->GetTree()->clear(); if(m_pRecoveryLog) m_pRecoveryLog->GetTree()->clear();
if (sender() == m_pCleanUpProcesses || sender() == m_pCleanUpButton) if (sender() == m_pCleanUpProcesses || sender() == m_pCleanUpButton)
theAPI->UpdateProcesses(0, ShowAllSessions()); theAPI->UpdateProcesses(0, ShowAllSessions());
} }
@ -3555,7 +3555,7 @@ void CSandMan::UpdateSettings(bool bRebuildUI)
m_pTrayIcon->hide(); m_pTrayIcon->hide();
if (bRebuildUI) if (bRebuildUI)
{ {
StoreState(); StoreState();
@ -3737,7 +3737,7 @@ void CSandMan::EditIni(const QString& IniPath, bool bPlus)
if (!bPlus && theConf->GetBool("Options/WatchIni", true)) if (!bPlus && theConf->GetBool("Options/WatchIni", true))
return; // if the ini is watched don't double reload return; // if the ini is watched don't double reload
QWinEventNotifier* processFinishedNotifier = new QWinEventNotifier(si.hProcess); QWinEventNotifier* processFinishedNotifier = new QWinEventNotifier(si.hProcess);
processFinishedNotifier->setEnabled(true); processFinishedNotifier->setEnabled(true);
connect(processFinishedNotifier, &QWinEventNotifier::activated, this, [processFinishedNotifier, this, si, bPlus]() { 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_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_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_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_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_SnapMkDirFail: Message = tr("Failed to create directory for new snapshot"); break;
case SB_SnapCopyDatFail:Message = tr("Failed to copy box data files"); 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) 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); SetWindowPos((HWND)m_pPopUpWindow->winId(), HWND_NOTOPMOST , 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
QPointer<CBoxAssistant> pWizard = new CBoxAssistant(this); QPointer<CBoxAssistant> pWizard = new CBoxAssistant(this);
pWizard->TryFix(MsgCode, MsgData, ProcessName, BoxName); pWizard->TryFix(MsgCode, MsgData, ProcessName, BoxName);
pWizard->setAttribute(Qt::WA_DeleteOnClose); pWizard->setAttribute(Qt::WA_DeleteOnClose);
@ -3992,7 +3992,7 @@ void CSandMan::OpenUrl(const QUrl& url)
{ {
QString scheme = url.scheme(); QString scheme = url.scheme();
QString host = url.host(); QString host = url.host();
QString path = url.path(); QString path = url.path();
QString query = url.query(); QString query = url.query();
if (scheme == "addon") { if (scheme == "addon") {
@ -4018,7 +4018,7 @@ void CSandMan::OpenUrl(const QUrl& url)
{ {
bool bCheck = false; bool bCheck = false;
//QString Message = tr("Do you want to open %1 in a sandboxed (yes) or unsandboxed (no) Web browser?").arg(url.toString()); //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); // &bCheck, QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel, QDialogButtonBox::Yes, QMessageBox::Question);
CCheckableMessageBox mb(this); 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); else ShellExecute(MainWndHandle, NULL, url.toString().toStdWString().c_str(), NULL, NULL, SW_SHOWNORMAL);
} }
bool CSandMan::IsWFPEnabled() const bool CSandMan::IsWFPEnabled() const
{ {
return (g_FeatureFlags & CSbieAPI::eSbieFeatureWFP) != 0; return (g_FeatureFlags & CSbieAPI::eSbieFeatureWFP) != 0;
} }
QString CSandMan::GetVersion() QString CSandMan::GetVersion()
@ -4074,7 +4074,7 @@ void CSandMan::SetUITheme()
bDark = (settings.value("AppsUseLightTheme") == 0); bDark = (settings.value("AppsUseLightTheme") == 0);
} else } else
bDark = (iDark == 1); bDark = (iDark == 1);
if (bDark) if (bDark)
QApplication::setPalette(m_DarkPalett); QApplication::setPalette(m_DarkPalett);
else else
@ -4086,7 +4086,7 @@ void CSandMan::SetUITheme()
int iFusion = theConf->GetInt("Options/UseFusionTheme", 2); int iFusion = theConf->GetInt("Options/UseFusionTheme", 2);
if (iFusion == 2) if (iFusion == 2)
bFusion = bDark; bFusion = bDark;
else else
bFusion = (iFusion == 1); bFusion = (iFusion == 1);
if (bFusion) if (bFusion)
@ -4127,7 +4127,7 @@ void CSandMan::SetTitleTheme(const HWND& hwnd)
QSettings::NativeFormat).value("CurrentBuild").toInt(); QSettings::NativeFormat).value("CurrentBuild").toInt();
if (CurrentVersion < 17763) // Windows 10 1809 - if (CurrentVersion < 17763) // Windows 10 1809 -
return; return;
HMODULE dwmapi = GetModuleHandle(L"dwmapi.dll"); HMODULE dwmapi = GetModuleHandle(L"dwmapi.dll");
if (dwmapi) if (dwmapi)
{ {
@ -4178,7 +4178,7 @@ void CSandMan::LoadLanguage()
#endif #endif
m_LanguageId = LocaleNameToLCID(m_Language.toStdWString().c_str(), 0); m_LanguageId = LocaleNameToLCID(m_Language.toStdWString().c_str(), 0);
if (!m_LanguageId) if (!m_LanguageId)
m_LanguageId = 1033; // default to English m_LanguageId = 1033; // default to English
LoadLanguage(m_Language, "sandman", 0); LoadLanguage(m_Language, "sandman", 0);
@ -4202,7 +4202,7 @@ void CSandMan::LoadLanguage(const QString& Lang, const QString& Module, int Inde
if (Lang.isEmpty()) if (Lang.isEmpty())
return; return;
QString LangAux = Lang; // Short version as fallback QString LangAux = Lang; // Short version as fallback
LangAux.truncate(LangAux.lastIndexOf('_')); LangAux.truncate(LangAux.lastIndexOf('_'));
@ -4226,7 +4226,7 @@ void CSandMan::OnHelp()
{ {
//if (sender() == m_pSupport) //if (sender() == m_pSupport)
// QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=donate")); // QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=donate"));
//else //else
if (sender() == m_pContribution) if (sender() == m_pContribution)
QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=sbie-contribute")); QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=sbie-contribute"));
else if (sender() == m_pManual) else if (sender() == m_pManual)
@ -4273,14 +4273,14 @@ void CSandMan::OnAbout()
msgBox->setInformativeText(AboutText); msgBox->setInformativeText(AboutText);
QIcon ico(QLatin1String(":/SandMan.png")); QIcon ico(QLatin1String(":/SandMan.png"));
QPixmap pix(128, 160); QPixmap pix(128, 160);
pix.fill(Qt::transparent); pix.fill(Qt::transparent);
QPainter painter(&pix); QPainter painter(&pix);
painter.drawPixmap(0, 0, ico.pixmap(128, 128)); painter.drawPixmap(0, 0, ico.pixmap(128, 128));
if (g_CertInfo.active) if (g_CertInfo.active)
{ {
//painter.setPen(Qt::blue); //painter.setPen(Qt::blue);
//painter.drawRect(0, 0, 127, 159); //painter.drawRect(0, 0, 127, 159);
@ -4351,20 +4351,20 @@ int g_CertAmount = 0;
void SlotSend(const std::wstring& message) void SlotSend(const std::wstring& message)
{ {
std::wstring strSlotName = L"\\\\*\\mailslot\\" + g_SlotName; std::wstring strSlotName = L"\\\\*\\mailslot\\" + g_SlotName;
HANDLE hSlot = CreateFile(strSlotName.c_str(), HANDLE hSlot = CreateFile(strSlotName.c_str(),
GENERIC_WRITE, GENERIC_WRITE,
FILE_SHARE_READ, FILE_SHARE_READ,
(LPSECURITY_ATTRIBUTES) NULL, (LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL); (HANDLE) NULL);
if (hSlot == INVALID_HANDLE_VALUE) if (hSlot == INVALID_HANDLE_VALUE)
{ {
//GetLastError(); //GetLastError();
return; return;
} }
DWORD cbWritten; DWORD cbWritten;
WriteFile(hSlot, message.c_str(), (DWORD)(message.size() + 1) * sizeof(wchar_t), &cbWritten, NULL); WriteFile(hSlot, message.c_str(), (DWORD)(message.size() + 1) * sizeof(wchar_t), &cbWritten, NULL);
CloseHandle(hSlot); CloseHandle(hSlot);
@ -4397,14 +4397,14 @@ int CountSeats()
DWORD WINAPI MailThreadFunc(LPVOID lpParam) DWORD WINAPI MailThreadFunc(LPVOID lpParam)
{ {
std::wstring strSlotName = L"\\\\.\\mailslot\\" + g_SlotName; std::wstring strSlotName = L"\\\\.\\mailslot\\" + g_SlotName;
HANDLE hSlot = CreateMailslot(strSlotName.c_str(), HANDLE hSlot = CreateMailslot(strSlotName.c_str(),
0, // no maximum message size 0, // no maximum message size
MAILSLOT_WAIT_FOREVER, // no time-out for operations MAILSLOT_WAIT_FOREVER, // no time-out for operations
(LPSECURITY_ATTRIBUTES) NULL); // default security (LPSECURITY_ATTRIBUTES) NULL); // default security
if (hSlot == INVALID_HANDLE_VALUE) { if (hSlot == INVALID_HANDLE_VALUE) {
//GetLastError() //GetLastError()
return FALSE; return FALSE;
} }
ScanForSeats(); ScanForSeats();
@ -4414,11 +4414,11 @@ DWORD WINAPI MailThreadFunc(LPVOID lpParam)
{ {
DWORD cbMessage; DWORD cbMessage;
DWORD dwMessageCount; DWORD dwMessageCount;
if(!GetMailslotInfo(hSlot, // mailslot handle if(!GetMailslotInfo(hSlot, // mailslot handle
(LPDWORD)NULL, // no maximum message size (LPDWORD)NULL, // no maximum message size
&cbMessage, // size of next message &cbMessage, // size of next message
&dwMessageCount, // number of messages &dwMessageCount, // number of messages
(LPDWORD)NULL)) // no read time-out (LPDWORD)NULL)) // no read time-out
{ {
//GetLastError(); //GetLastError();
continue; continue;

View File

@ -24,7 +24,7 @@ class CScriptManager;
class CAddonManager; class CAddonManager;
struct ToolBarAction { struct ToolBarAction {
// Identifier of action stored in ini. Empty for separator. // Identifier of action stored in ini. Empty for separator.
QString scriptName = ""; QString scriptName = "";
// Not owned. Null for special cases. // Not owned. Null for special cases.
@ -104,7 +104,7 @@ public:
QIcon MakeIconBusy(const QIcon& Icon, int Index = 0); QIcon MakeIconBusy(const QIcon& Icon, int Index = 0);
QIcon IconAddOverlay(const QIcon& Icon, const QString& Name, int Size = 24); QIcon IconAddOverlay(const QIcon& Icon, const QString& Name, int Size = 24);
QString GetBoxDescription(int boxType); QString GetBoxDescription(int boxType);
bool CheckCertificate(QWidget* pWidget, int iType = 0); bool CheckCertificate(QWidget* pWidget, int iType = 0);
bool IsAlwaysOnTop() const; bool IsAlwaysOnTop() const;
@ -156,7 +156,7 @@ protected:
CScriptManager* m_SbieScripts; CScriptManager* m_SbieScripts;
CAddonManager* m_AddonManager; CAddonManager* m_AddonManager;
QMap<CSbieProgress*, QPair<CSbieProgressPtr, QPointer<QWidget>>> m_pAsyncProgress; QMap<CSbieProgress*, QPair<CSbieProgressPtr, QPointer<QWidget>>> m_pAsyncProgress;
QMap<QString, QSet<QString>> m_MissingTemplates; QMap<QString, QSet<QString>> m_MissingTemplates;
@ -183,7 +183,7 @@ protected:
struct SSbieMsg { struct SSbieMsg {
QDateTime TimeStamp; QDateTime TimeStamp;
quint32 MsgCode; quint32 MsgCode;
QStringList MsgData; QStringList MsgData;
QString ProcessName; QString ProcessName;
}; };
QVector<SSbieMsg> m_MessageLog; QVector<SSbieMsg> m_MessageLog;