Skip to content

Commit

Permalink
1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed Sep 1, 2022
1 parent 6e18b98 commit 42560db
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 46 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ This project adheres to [Semantic Versioning](http://semver.org/).




## [1.3.3 / 5.58.3] - 2022-08-??

### Fixed
- fixed issues with group moving drag and drop
- approved more requied sys calls
- fixed issues when deleting box content and the view files panel is open



## [1.3.2 / 5.58.2] - 2022-08-30

### Added
Expand Down
4 changes: 4 additions & 0 deletions Sandboxie/install/Templates.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3652,6 +3652,10 @@ ApproveWinNtSysCall=DeviceIoControlFile
ApproveWinNtSysCall=QueryAttributesFile
ApproveWinNtSysCall=QueryFullAttributesFile

# Windows Notification Facility
ApproveWinNtSysCall=SubscribeWnfStateChange
ApproveWinNtSysCall=UnsubscribeWnfStateChange

# token stuff

ApproveWinNtSysCall=DuplicateToken
Expand Down
75 changes: 41 additions & 34 deletions SandboxiePlus/SandMan/SandMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ CSandMan::CSandMan(QWidget *parent)
connect(m_pHotkeyManager, SIGNAL(activated(size_t)), SLOT(OnHotKey(size_t)));
SetupHotKeys();

for (int i = 0; i < eMaxColor; i++) {
m_BoxIcons[i].Empty = QIcon(QString(":/Boxes/Empty%1").arg(i));
m_BoxIcons[i].InUse = QIcon(QString(":/Boxes/Full%1").arg(i));
}
//for (int i = 0; i < eMaxColor; i++) {
// m_BoxIcons[i].Empty = QIcon(QString(":/Boxes/Empty%1").arg(i));
// m_BoxIcons[i].InUse = QIcon(QString(":/Boxes/Full%1").arg(i));
//}

m_BoxColors[CSandBoxPlus::eHardenedPlus] = qRgb(238,35,4);
m_BoxColors[CSandBoxPlus::eHardened] = qRgb(247,125,2);
Expand Down Expand Up @@ -850,6 +850,7 @@ void CSandMan::UpdateLabel()
void CSandMan::CreateView(int iViewMode)
{
m_pBoxView = new CSbieView();
connect(m_pBoxView, SIGNAL(BoxSelected()), this, SLOT(OnBoxSelected()));
m_pFileView = new CFileView();

if (iViewMode != 1)
Expand All @@ -869,6 +870,7 @@ void CSandMan::CreateView(int iViewMode)
pFileLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0, 1, 1);

m_pBoxCombo = new QComboBox();
connect(m_pBoxCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(OnBoxSelected()));
pFileLayout->addWidget(m_pBoxCombo, 0, 1);

pFileLayout->addWidget(m_pFileView, 1, 0, 1, 2);
Expand Down Expand Up @@ -1046,11 +1048,11 @@ void CSandMan::closeEvent(QCloseEvent *e)

QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy)
{
EBoxColors color = eYellow;
//EBoxColors color = eYellow;
int iViewMode = theConf->GetInt("Options/ViewMode", 1);
if (iViewMode != 2) {
//return GetColorIcon(m_BoxColors[boxType], inUse);
switch (boxType) {
return GetColorIcon(m_BoxColors[boxType], inUse);
/*switch (boxType) {
case CSandBoxPlus::eHardenedPlus: color = eRed; break;
case CSandBoxPlus::eHardened: color = eOrang; break;
case CSandBoxPlus::eDefaultPlus: color = eBlue; break;
Expand All @@ -1059,13 +1061,14 @@ QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy)
case CSandBoxPlus::eAppBox: color = eGreen; break;
case CSandBoxPlus::eInsecure: color = eMagenta; break;
case CSandBoxPlus::eOpen: color = eWhite; break;
}
}*/
}
//if (inBusy)
// return m_BoxIcons[color].Busy;
if (inUse)
/*if (inUse)
return m_BoxIcons[color].InUse;
return m_BoxIcons[color].Empty;
return m_BoxIcons[color].Empty;*/
return GetColorIcon(m_BoxColors[CSandBoxPlus::eDefault], inUse);
}

QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse)
Expand Down Expand Up @@ -1107,6 +1110,7 @@ QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse)

if (hsv.h < 0) hsv.h += 360;
else if (hsv.h >= 360) hsv.h -= 360;
hsv.s = 1; // make the content always fully saturated

my_rgb rgb2 = hsv2rgb(hsv);
rgb = qRgb(rgb2.r, rgb2.g, rgb2.b);
Expand Down Expand Up @@ -1288,30 +1292,6 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
m_pTraceView->setEnabled(bIsMonitoring);
}

CSandBoxPtr pBox;
if (m_pPanelSplitter) {
QList<CSandBoxPtr> boxes = m_pBoxView->GetSelectedBoxes();
if (m_pPanelSplitter->sizes().at(1) > 0 && m_pFileView->isVisible() && boxes.count() == 1)
pBox = boxes.first();
}

// for old menu
if (m_pBoxCombo && m_pViewStack->currentIndex() == 1) {
QString Name = m_pBoxCombo->currentData().toString();
if (Name.isEmpty())
Name = "DefaultBox";
pBox = theAPI->GetBoxByName(Name);
}

if (!pBox.isNull()) {
if (!m_pFileView->isEnabled()) m_pFileView->setEnabled(true);
if (pBox != m_pFileView->GetBox()) m_pFileView->SetBox(pBox);
}
else if (m_pFileView->isEnabled()) {
m_pFileView->setEnabled(false);
m_pFileView->SetBox(CSandBoxPtr());
}

QMap<quint32, CBoxedProcessPtr> Processes = theAPI->GetAllProcesses();
int ActiveProcesses = 0;
if (KeepTerminated()) {
Expand Down Expand Up @@ -1417,6 +1397,33 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
}
}

void CSandMan::OnBoxSelected()
{
CSandBoxPtr pBox;
if (m_pPanelSplitter) {
QList<CSandBoxPtr> boxes = m_pBoxView->GetSelectedBoxes();
if (m_pPanelSplitter->sizes().at(1) > 0 && m_pFileView->isVisible() && boxes.count() == 1)
pBox = boxes.first();
}

// for vintage mode
if (m_pBoxCombo && m_pViewStack->currentIndex() == 1) {
QString Name = m_pBoxCombo->currentData().toString();
if (Name.isEmpty())
Name = "DefaultBox";
pBox = theAPI->GetBoxByName(Name);
}

if (!pBox.isNull()) {
if (!m_pFileView->isEnabled()) m_pFileView->setEnabled(true);
if (pBox != m_pFileView->GetBox()) m_pFileView->SetBox(pBox);
}
else if (m_pFileView->isEnabled()) {
m_pFileView->setEnabled(false);
m_pFileView->SetBox(CSandBoxPtr());
}
}

SB_STATUS CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, bool DeleteShapshots)
{
SB_STATUS Ret = SB_OK;
Expand Down
14 changes: 8 additions & 6 deletions SandboxiePlus/SandMan/SandMan.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,18 @@ class CSandMan : public QMainWindow

QMap<int, QRgb> m_BoxColors;

struct SBoxIcon {
QIcon Empty;
QIcon InUse;
//QIcon Busy;
};
QMap<int, SBoxIcon> m_BoxIcons;
//struct SBoxIcon {
// QIcon Empty;
// QIcon InUse;
// //QIcon Busy;
//};
//QMap<int, SBoxIcon> m_BoxIcons;

class UGlobalHotkeys* m_pHotkeyManager;

public slots:
void OnBoxSelected();

void OnMessage(const QString& MsgData);

void OnStatusChanged();
Expand Down
23 changes: 17 additions & 6 deletions SandboxiePlus/SandMan/Views/SbieView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ void CSbieView::OnGroupAction(QAction* Action)

if (List.isEmpty())
return;

m_Groups[""].removeAll(Name);
m_Groups[List.first()].append(Name);
}
else if (Action == m_pRenGroupe)
Expand Down Expand Up @@ -841,11 +841,13 @@ void CSbieView::OnGroupAction(QAction* Action)
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I) {
int pos = I->indexOf(Name);
if (pos != -1) {
if ((Offset < 0 && pos > Offset + 1) ||(Offset > 0 && pos < I->count() - Offset)){
QString Temp = I.value()[pos+Offset];
I.value()[pos+Offset] = I.value()[pos];
if ((Offset < 0 && pos > Offset + 1) || (Offset > 0 && pos < I->count() - Offset)) {
QString Temp = I.value()[pos + Offset];
I.value()[pos + Offset] = I.value()[pos];
I.value()[pos] = Temp;
}
else // out of bounds
QApplication::beep();
bFound = true;
break;
}
Expand Down Expand Up @@ -896,8 +898,15 @@ bool CSbieView::MoveItem(const QString& Name, const QString& To, int pos)

// remove from old
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I) {
if (I.value().removeAll(Name))
From = I.key();
for (int i = 0; i < I.value().count(); i++) {
if (I.value().at(i) == Name) {
I.value().removeAt(i);
From = I.key();
if(From == To && i < pos)
pos--;
break;
}
}
}

// add to new
Expand Down Expand Up @@ -1534,6 +1543,8 @@ void CSbieView::ProcessSelection(const QItemSelection& selected, const QItemSele
}

selectionModel->select(invalid, QItemSelectionModel::Deselect);

emit BoxSelected();
}

QList<CSandBoxPtr> CSbieView::GetSelectedBoxes()
Expand Down
3 changes: 3 additions & 0 deletions SandboxiePlus/SandMan/Views/SbieView.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class CSbieView : public CPanelView

QMap<QString, QStringList> GetGroups() { return m_Groups; }

signals:
void BoxSelected();

public slots:
void Clear();
void Refresh();
Expand Down

0 comments on commit 42560db

Please sign in to comment.