diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3a7a265c..2b62d052 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
+## [0.5.3b / 5.45.2] - 2020-12-02
+
+### Added
+- added settings for the porteble boxed root folder option
+- added process name to resource log
+- added command line column to the process view in the sandman UI
+
+### Fixed
+- fixed a few issues wiht group handling
+- fixed issue with GetRawInputDeviceInfo when runnign a 32 bit program on a 64 bis system
+- fixed issue when pressing apply int he "Resource Access" tab the last edited value was not always applyed
+- fixed issue merging entries in resource access monitor
diff --git a/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj b/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj
index bf51d9e6..383fe221 100644
--- a/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj
+++ b/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj
@@ -68,6 +68,10 @@
$(SolutionDir)$(Platform)\$(Configuration)\
$(Platform)\$(Configuration)\
+
+ $(SolutionDir)$(Platform)\$(Configuration)\
+ $(Platform)\$(Configuration)\
+
diff --git a/SandboxiePlus/QSbieAPI/QSbieAPI.vcxproj b/SandboxiePlus/QSbieAPI/QSbieAPI.vcxproj
index 9bb0f309..e3ec488f 100644
--- a/SandboxiePlus/QSbieAPI/QSbieAPI.vcxproj
+++ b/SandboxiePlus/QSbieAPI/QSbieAPI.vcxproj
@@ -65,6 +65,10 @@
+ $(Platform)\$(Configuration)\
+ $(SolutionDir)$(Platform)\$(Configuration)\
+
+
$(SolutionDir)$(Platform)\$(Configuration)\
$(Platform)\$(Configuration)\
@@ -135,6 +139,7 @@
true
MachineX86
/SUBSYSTEM:WINDOWS
+ ntdll.lib;%(AdditionalDependencies)
diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp b/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp
index 6441d835..c5adae7f 100644
--- a/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp
+++ b/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp
@@ -28,6 +28,8 @@ typedef long NTSTATUS;
#include "..\..\Sandboxie\common\win32_ntddk.h"
#include // For access to GetModuleFileNameEx
+#include
+
//struct SBoxedProcess
//{
//};
@@ -52,12 +54,114 @@ CBoxedProcess::~CBoxedProcess()
//delete m;
}
+typedef enum _PEB_OFFSET
+{
+ PhpoCurrentDirectory,
+ PhpoDllPath,
+ PhpoImagePathName,
+ PhpoCommandLine,
+ PhpoWindowTitle,
+ PhpoDesktopInfo,
+ PhpoShellInfo,
+ PhpoRuntimeData,
+ PhpoTypeMask = 0xffff,
+ PhpoWow64 = 0x10000
+} PEB_OFFSET;
+
+typedef struct _STRING32
+{
+ USHORT Length;
+ USHORT MaximumLength;
+ ULONG Buffer;
+} UNICODE_STRING32, * PUNICODE_STRING32;
+
+QString CBoxedProcess__GetPebString(HANDLE ProcessHandle, PEB_OFFSET Offset)
+{
+ BOOL is64BitOperatingSystem = FALSE;
+ BOOL isWow64Process = FALSE;
+#ifdef _WIN64
+ is64BitOperatingSystem = TRUE;
+#else // ! _WIN64
+ IsWow64Process(GetCurrentProcess(), &isWow64Process);
+ is64BitOperatingSystem = isWow64Process;
+#endif _WIN64
+
+ BOOL isTargetWow64Process = FALSE;
+ IsWow64Process(ProcessHandle, &isTargetWow64Process);
+ BOOL isTarget64BitProcess = is64BitOperatingSystem && !isTargetWow64Process;
+
+
+ ULONG processParametersOffset = isTarget64BitProcess ? 0x20 : 0x10;
+
+ ULONG offset = 0;
+ switch (Offset)
+ {
+ case PhpoCurrentDirectory: offset = isTarget64BitProcess ? 0x38 : 0x24; break;
+ case PhpoCommandLine: offset = isTarget64BitProcess ? 0x70 : 0x40; break;
+ default:
+ return QString();
+ }
+
+ wstring s;
+ if (isTargetWow64Process) // OS : 64Bit, Cur : 32 or 64, Tar: 32bit
+ {
+ PVOID peb32;
+ if (!NT_SUCCESS(NtQueryInformationProcess(ProcessHandle, ProcessWow64Information, &peb32, sizeof(PVOID), NULL)))
+ return QString();
+
+ ULONG procParams;
+ if (!NT_SUCCESS(NtReadVirtualMemory(ProcessHandle, (PVOID)((ULONG64)peb32 + processParametersOffset), &procParams, sizeof(ULONG), NULL)))
+ return QString();
+
+ UNICODE_STRING32 us;
+ if (!NT_SUCCESS(NtReadVirtualMemory(ProcessHandle, (PVOID)(procParams + offset), &us, sizeof(UNICODE_STRING32), NULL)))
+ return QString();
+
+ if ((us.Buffer == 0) || (us.Length == 0))
+ return QString();
+
+ s.resize(us.Length / 2);
+ if (!NT_SUCCESS(NtReadVirtualMemory(ProcessHandle, (PVOID)us.Buffer, (PVOID)s.c_str(), s.length() * 2, NULL)))
+ return QString();
+ }
+ else if (isWow64Process) //Os : 64Bit, Cur 32, Tar 64
+ {
+ return QString(); // not supported
+ }
+ else // Os,Cur,Tar : 64 or 32
+ {
+ PROCESS_BASIC_INFORMATION pbi;
+ if (!NT_SUCCESS(NtQueryInformationProcess(ProcessHandle, ProcessBasicInformation, &pbi, sizeof(PROCESS_BASIC_INFORMATION), NULL)))
+ return QString();
+
+ ULONG_PTR procParams;
+ if (!NT_SUCCESS(NtReadVirtualMemory(ProcessHandle, (PVOID)((ULONG64)pbi.PebBaseAddress + processParametersOffset), &procParams, sizeof(ULONG_PTR), NULL)))
+ return QString();
+
+ UNICODE_STRING us;
+ if (!NT_SUCCESS(NtReadVirtualMemory(ProcessHandle, (PVOID)(procParams + offset), &us, sizeof(UNICODE_STRING), NULL)))
+ return QString();
+
+ if ((us.Buffer == 0) || (us.Length == 0))
+ return QString();
+
+ s.resize(us.Length / 2);
+ if (!NT_SUCCESS(NtReadVirtualMemory(ProcessHandle, (PVOID)us.Buffer, (PVOID)s.c_str(), s.length() * 2, NULL)))
+ return QString();
+ }
+
+ return QString::fromWCharArray(s.c_str());
+}
+
bool CBoxedProcess::InitProcessInfo()
{
- HANDLE ProcessHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, (DWORD)m_ProcessId);
+ HANDLE ProcessHandle;
+ ProcessHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, (DWORD)m_ProcessId);
+ if (ProcessHandle == INVALID_HANDLE_VALUE) // try with less rights
+ ProcessHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD)m_ProcessId);
if (ProcessHandle == INVALID_HANDLE_VALUE)
return false;
-
+
PROCESS_BASIC_INFORMATION BasicInformation;
NTSTATUS status = NtQueryInformationProcess(ProcessHandle, ProcessBasicInformation, &BasicInformation, sizeof(PROCESS_BASIC_INFORMATION), NULL);
if (NT_SUCCESS(status)) {
@@ -68,6 +172,27 @@ bool CBoxedProcess::InitProcessInfo()
if (DWORD size = GetModuleFileNameEx(ProcessHandle, NULL, filename, MAX_PATH))
m_ImagePath = QString::fromWCharArray(filename);
+ if (1) // windows 8.1 and later // todo add os version check
+ {
+#define ProcessCommandLineInformation ((PROCESSINFOCLASS)60)
+ ULONG returnLength = 0;
+ NTSTATUS status = NtQueryInformationProcess(ProcessHandle, ProcessCommandLineInformation, NULL, 0, &returnLength);
+ if (!(status != STATUS_BUFFER_OVERFLOW && status != STATUS_BUFFER_TOO_SMALL && status != STATUS_INFO_LENGTH_MISMATCH))
+ {
+ PUNICODE_STRING commandLine = (PUNICODE_STRING)malloc(returnLength);
+ status = NtQueryInformationProcess(ProcessHandle, ProcessCommandLineInformation, commandLine, returnLength, &returnLength);
+ if (NT_SUCCESS(status) && commandLine->Buffer != NULL)
+ m_CommandLine = QString::fromWCharArray(commandLine->Buffer);
+ free(commandLine);
+ }
+#undef ProcessCommandLineInformation
+ }
+
+ if (m_CommandLine.isEmpty()) // fall back to teh win 7 method - requirers PROCESS_VM_READ
+ {
+ m_CommandLine = CBoxedProcess__GetPebString(ProcessHandle, PhpoCommandLine);
+ }
+
NtClose(ProcessHandle);
return true;
}
diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.h b/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.h
index 67670b0f..d37160bd 100644
--- a/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.h
+++ b/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.h
@@ -34,6 +34,7 @@ public:
virtual quint32 GetProcessId() const { return m_ProcessId; }
virtual quint32 GetParendPID() const { return m_ParendPID; }
virtual QString GetProcessName() const { return m_ImageName; }
+ virtual QString GetCommandLine() const { return m_CommandLine; }
virtual QString GetFileName() const { return m_ImagePath; }
virtual QDateTime GetTimeStamp() const { return m_StartTime; }
@@ -53,6 +54,7 @@ protected:
quint32 m_ParendPID;
QString m_ImageName;
QString m_ImagePath;
+ QString m_CommandLine;
quint32 m_SessionId;
QDateTime m_StartTime;
quint64 m_uTerminated;
diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.cpp b/SandboxiePlus/QSbieAPI/SbieAPI.cpp
index 93719797..c48fc909 100644
--- a/SandboxiePlus/QSbieAPI/SbieAPI.cpp
+++ b/SandboxiePlus/QSbieAPI/SbieAPI.cpp
@@ -1762,6 +1762,8 @@ CBoxedProcessPtr CSbieAPI::OnProcessBoxed(quint32 ProcessId, const QString& Path
pProcess = CBoxedProcessPtr(NewBoxedProcess(ProcessId, pBox.data()));
pBox->m_ProcessList.insert(ProcessId, pProcess);
m_BoxedProxesses.insert(ProcessId, pProcess);
+
+ pProcess->InitProcessInfo();
}
if (pProcess->m_ParendPID == 0){
@@ -1891,9 +1893,8 @@ bool CSbieAPI::GetMonitor()
CResLogEntryPtr LogEntry = CResLogEntryPtr(new CResLogEntry(pid, type, Data));
QWriteLocker Lock(&m_ResLogMutex);
- if (!m_ResLogList.isEmpty() && m_ResLogList.last()->GetValue() == LogEntry->GetValue())
- {
- m_ResLogList.last()->IncrCounter();
+ if (!m_ResLogList.isEmpty() && m_ResLogList.last()->Equals(LogEntry)) {
+ m_ResLogList.last()->Merge(LogEntry);
return true;
}
m_ResLogList.append(LogEntry);
diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.h b/SandboxiePlus/QSbieAPI/SbieAPI.h
index abb25a96..bb148a7e 100644
--- a/SandboxiePlus/QSbieAPI/SbieAPI.h
+++ b/SandboxiePlus/QSbieAPI/SbieAPI.h
@@ -38,9 +38,15 @@ public:
QString GetValue() const { return m_Name; }
QString GetTypeStr() const;
QString GetStautsStr() const;
- void IncrCounter() { m_Counter++; }
int GetCount() const { return m_Counter; }
+ bool Equals(const QSharedDataPointer& pOther) const {
+ return pOther->m_ProcessId == this->m_ProcessId
+ //&& pOther->m_Type.Flags == this->m_Type.Flags
+ && pOther->m_Name == this->m_Name;
+ }
+ void Merge(const QSharedDataPointer& pOther) { m_Counter++; this->m_Type.Flags |= pOther->m_Type.Flags; }
+
quint64 GetUID() const { return m_uid; }
protected:
diff --git a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui
index db7f00a7..a46ce476 100644
--- a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui
+++ b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui
@@ -45,7 +45,7 @@
QTabWidget::North
- 0
+ 1
@@ -346,13 +346,6 @@
- -
-
-
- Separate user folders
-
-
-
-
@@ -373,6 +366,20 @@
+ -
+
+
+ Separate user folders
+
+
+
+ -
+
+
+ Portable root folder
+
+
+
diff --git a/SandboxiePlus/SandMan/Models/ResMonModel.cpp b/SandboxiePlus/SandMan/Models/ResMonModel.cpp
index 6ea916d0..8b6f2be2 100644
--- a/SandboxiePlus/SandMan/Models/ResMonModel.cpp
+++ b/SandboxiePlus/SandMan/Models/ResMonModel.cpp
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ResMonModel.h"
#include "../MiscHelpers/Common/Common.h"
+#include "../SbiePlusAPI.h"
CResMonModel::CResMonModel(QObject *parent)
:CListItemModel(parent)
@@ -93,7 +94,12 @@ void CResMonModel::Sync(const QList& List, QSet PIDs)
switch (section)
{
- case eProcess: ColValue.Formated = QString::number(pEntry->GetProcessId()); break;
+ case eProcess:
+ {
+ CBoxedProcessPtr pProcess = theAPI->GetProcessById(pEntry->GetProcessId());
+ ColValue.Formated = QString("%1 (%2)").arg(pProcess.isNull() ? tr("Unknown") : pProcess->GetProcessName()).arg(pEntry->GetProcessId());
+ break;
+ }
case eTimeStamp: ColValue.Formated = pEntry->GetTimeStamp().toString("hh:mm:ss.zzz"); break;
//case eType: ColValue.Formated = ; break;
//case eValue: ColValue.Formated = ; break;
diff --git a/SandboxiePlus/SandMan/Models/SbieModel.cpp b/SandboxiePlus/SandMan/Models/SbieModel.cpp
index f8f22cb2..c9fd243f 100644
--- a/SandboxiePlus/SandMan/Models/SbieModel.cpp
+++ b/SandboxiePlus/SandMan/Models/SbieModel.cpp
@@ -66,12 +66,22 @@ bool CSbieModel::TestProcPath(const QList& Path, const QString& BoxNam
return Path.size() == Index;
}
+QString CSbieModel__AddGroupMark(const QString& Name)
+{
+ return Name.isEmpty() ? "" : ("!" + Name);
+}
+
+QString CSbieModel__RemoveGroupMark(const QString& Name)
+{
+ return Name.left(1) == "!" ? Name.mid(1) : Name;
+}
+
QString CSbieModel::FindParent(const QVariant& Name, const QMap& Groups)
{
for(auto I = Groups.begin(); I != Groups.end(); ++I)
{
- if (I.value().contains(Name.toString(), Qt::CaseInsensitive))
- return I.key();
+ if (I.value().contains(CSbieModel__RemoveGroupMark(Name.toString()), Qt::CaseInsensitive))
+ return CSbieModel__AddGroupMark(I.key());
}
return QString();
}
@@ -99,7 +109,7 @@ QList CSbieModel::Sync(const QMap& BoxList, cons
{
if (Group.isEmpty())
continue;
- QVariant ID = Group;
+ QVariant ID = CSbieModel__AddGroupMark(Group);
QHash::iterator I = Old.find(ID);
SSandBoxNode* pNode = I != Old.end() ? static_cast(I.value()) : NULL;
@@ -299,7 +309,12 @@ bool CSbieModel::Sync(const CSandBoxPtr& pBox, const QList& Path, cons
//case eTitle: break; // todo
//case eLogCount: break; // todo Value = pProcess->GetResourceLog().count(); break;
case eTimeStamp: Value = pProcess->GetTimeStamp(); break;
- case ePath: Value = pProcess->GetFileName(); break;
+ //case ePath: Value = pProcess->GetFileName(); break;
+ case ePath: {
+ QString CmdLine = pProcess->GetCommandLine();
+ Value = CmdLine.isEmpty() ? pProcess->GetFileName() : CmdLine;
+ break;
+ }
}
SSandBoxNode::SValue& ColValue = pNode->Values[section];
@@ -400,7 +415,7 @@ QVariant CSbieModel::headerData(int section, Qt::Orientation orientation, int ro
//case eTitle: return tr("Title");
//case eLogCount: return tr("Log Count");
case eTimeStamp: return tr("Start Time");
- case ePath: return tr("Path");
+ case ePath: return tr("Path / Command Line");
}
}
return QVariant();
diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp
index 6b69872e..5db57476 100644
--- a/SandboxiePlus/SandMan/SandMan.cpp
+++ b/SandboxiePlus/SandMan/SandMan.cpp
@@ -689,9 +689,20 @@ void CSandMan::OnStatusChanged()
{
appTitle.append(tr(" - Portable"));
- if (theConf->GetBool("Options/PortableRootDir", true))
+ int PortableRootDir = theConf->GetInt("Options/PortableRootDir", -1);
+ if (PortableRootDir == -1)
{
- QString BoxPath = QDir::cleanPath(QApplication::applicationDirPath() + "/../SandBoxes").replace("/", "\\");
+ bool State = false;
+ PortableRootDir = CCheckableMessageBox::question(this, "Sandboxie-Plus", tr("Sandboxie-Plus was started in portable mode, do you want to put the SandBoxes folder into it's parrent directory?")
+ , tr("Don't show this message again."), &State, QDialogButtonBox::Yes | QDialogButtonBox::No, QDialogButtonBox::Yes, QMessageBox::Information) == QDialogButtonBox::Yes ? 1 : 0;
+
+ if (State)
+ theConf->SetValue("Options/PortableRootDir", PortableRootDir);
+ }
+
+ if (PortableRootDir)
+ {
+ QString BoxPath = QDir::cleanPath(QApplication::applicationDirPath() + "/../Sandbox/%SANDBOX%").replace("/", "\\");
theAPI->GetGlobalSettings()->SetText("FileRootPath", BoxPath);
}
}
@@ -706,6 +717,8 @@ void CSandMan::OnStatusChanged()
}
}
+ m_pBoxView->Clear();
+
OnIniReloaded();
if (theConf->GetBool("Options/WatchIni", true))
@@ -715,6 +728,8 @@ void CSandMan::OnStatusChanged()
{
appTitle.append(tr(" - NOT connected").arg(theAPI->GetVersion()));
+ m_pBoxView->Clear();
+
theAPI->WatchIni(false);
}
this->setWindowTitle(appTitle);
@@ -1140,6 +1155,7 @@ void CSandMan::OnResetMsgs()
{
theConf->SetValue("Options/PortableStop", -1);
theConf->SetValue("Options/PortableStart", -1);
+ theConf->SetValue("Options/PortableRootDir", -1);
theConf->SetValue("Options/CheckForUpdates", 2);
diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h
index 9a44b146..5c1f250d 100644
--- a/SandboxiePlus/SandMan/SandMan.h
+++ b/SandboxiePlus/SandMan/SandMan.h
@@ -15,7 +15,7 @@
#define VERSION_MJR 0
#define VERSION_MIN 5
#define VERSION_REV 3
-#define VERSION_UPD 1
+#define VERSION_UPD 2
//#include "../QSbieAPI/SbieAPI.h"
@@ -46,6 +46,8 @@ public:
static QIcon GetIcon(const QString& Name);
+ bool IsFullyPortable();
+
protected:
SB_STATUS ConnectSbie();
SB_STATUS ConnectSbieImpl();
@@ -54,8 +56,6 @@ protected:
static void RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QList>& FileList, int Action = 0);
- bool IsFullyPortable();
-
void closeEvent(QCloseEvent *e);
void timerEvent(QTimerEvent* pEvent);
int m_uTimerID;
diff --git a/SandboxiePlus/SandMan/SandMan.vcxproj b/SandboxiePlus/SandMan/SandMan.vcxproj
index a6ecbff1..ce377f58 100644
--- a/SandboxiePlus/SandMan/SandMan.vcxproj
+++ b/SandboxiePlus/SandMan/SandMan.vcxproj
@@ -75,6 +75,11 @@
$(SolutionDir)$(Platform)\$(Configuration)\
$(Platform)\$(Configuration)\
+
+ $(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)
+ $(SolutionDir)$(Platform)\$(Configuration)\
+ $(Platform)\$(Configuration)\
+
diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp
index 519cdb40..2e71264a 100644
--- a/SandboxiePlus/SandMan/Views/SbieView.cpp
+++ b/SandboxiePlus/SandMan/Views/SbieView.cpp
@@ -135,6 +135,12 @@ CSbieView::~CSbieView()
theConf->SetBlob("MainWindow/BoxTree_Columns", m_pSbieTree->saveState());
}
+void CSbieView::Clear()
+{
+ m_Groups.clear();
+ m_pSbieModel->Clear();
+}
+
void CSbieView::Refresh()
{
QList Added = m_pSbieModel->Sync(theAPI->GetAllBoxes(), m_Groups);
@@ -295,7 +301,10 @@ int CSbieView__ParseGroup(const QString& Grouping, QMap& m
if (pos == -1)
break;
if (Grouping.at(pos) == "(")
+ {
+ m_Groups[Name] = QStringList();
Index = CSbieView__ParseGroup(Grouping, m_Groups, Name, Index);
+ }
else if (Grouping.at(pos) == ")")
break;
}
@@ -355,8 +364,7 @@ void CSbieView::OnGroupAction()
if (m_pSbieModel->GetType(ModelIndex) == CSbieModel::eGroup)
Parent = m_pSbieModel->GetID(ModelIndex).toString();
- if (!Parent.isEmpty())
- m_Groups[Parent].append(Name);
+ m_Groups[Parent].append(Name);
}
else if (Action == m_pDelGroupe)
{
diff --git a/SandboxiePlus/SandMan/Views/SbieView.h b/SandboxiePlus/SandMan/Views/SbieView.h
index 85feb2b7..244b8f9a 100644
--- a/SandboxiePlus/SandMan/Views/SbieView.h
+++ b/SandboxiePlus/SandMan/Views/SbieView.h
@@ -21,6 +21,7 @@ signals:
void RecoveryRequested(const QString& BoxName);
public slots:
+ void Clear();
void Refresh();
void ReloadGroups();
diff --git a/SandboxiePlus/SandMan/Windows/NewBoxWindow.cpp b/SandboxiePlus/SandMan/Windows/NewBoxWindow.cpp
index a8588891..c043e255 100644
--- a/SandboxiePlus/SandMan/Windows/NewBoxWindow.cpp
+++ b/SandboxiePlus/SandMan/Windows/NewBoxWindow.cpp
@@ -25,6 +25,8 @@ CNewBoxWindow::CNewBoxWindow(QWidget *parent)
connect(ui.radCopy, SIGNAL(toggled(bool)), this, SLOT(OnPreset()));
ui.radTemplate->setChecked(true);
+ ui.txtName->setFocus();
+
restoreGeometry(theConf->GetBlob("NewBoxWindow/Window_Geometry"));
}
diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp
index e01a05df..7b084abc 100644
--- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp
+++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp
@@ -1600,6 +1600,8 @@ void COptionsWindow::OnDelAccess()
void COptionsWindow::SaveAccessList()
{
+ CloseAccessEdit(true);
+
QStringList Keys = QStringList() << "OpenFilePath" << "OpenPipePath" << "ClosedFilePath" << "ReadFilePath" << "WriteFilePath"
<< "OpenKeyPath" << "ClosedKeyPath" << "ReadKeyPath" << "WriteKeyPath"
<< "OpenIpcPath" << "ClosedIpcPath" << "OpenWinClass" << "OpenClsid" << "ClosedClsid" << "ClosedRT";
diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp
index 4318e372..48056056 100644
--- a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp
+++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp
@@ -112,6 +112,13 @@ CSettingsWindow::CSettingsWindow(QWidget *parent)
}
m_WarnProgsChanged = false;
+ int PortableRootDir = theConf->GetInt("Options/PortableRootDir", -1);
+ if (PortableRootDir != -1 && theConf->IsPortable())
+ ui.chkAutoRoot->setChecked(PortableRootDir == 0 ? Qt::Unchecked : Qt::Checked);
+ else
+ ui.chkAutoRoot->setVisible(false);
+ connect(ui.chkAutoRoot, SIGNAL(stateChanged(int)), this, SLOT(OnChange()));
+
connect(ui.btnAddCompat, SIGNAL(pressed()), this, SLOT(OnAddCompat()));
connect(ui.btnDelCompat, SIGNAL(pressed()), this, SLOT(OnDelCompat()));
@@ -190,17 +197,20 @@ void CSettingsWindow::apply()
if (theAPI->IsConnected())
{
if (ui.fileRoot->text().isEmpty())
- ui.fileRoot->setText("\\??\\%SystemDrive%\\Sandbox\\%USER%\\%SANDBOX%");
- theAPI->GetGlobalSettings()->SetText("FileRootPath", ui.fileRoot->text());
+ theAPI->GetGlobalSettings()->DelValue("FileRootPath"); //ui.fileRoot->setText("\\??\\%SystemDrive%\\Sandbox\\%USER%\\%SANDBOX%");
+ else
+ theAPI->GetGlobalSettings()->SetText("FileRootPath", ui.fileRoot->text());
theAPI->GetGlobalSettings()->SetBool("SeparateUserFolders", ui.chkSeparateUserFolders->isChecked());
if (ui.regRoot->text().isEmpty())
- ui.regRoot->setText("\\REGISTRY\\USER\\Sandbox_%USER%_%SANDBOX%");
- theAPI->GetGlobalSettings()->SetText("KeyRootPath", ui.regRoot->text());
+ theAPI->GetGlobalSettings()->DelValue("KeyRootPath"); //ui.regRoot->setText("\\REGISTRY\\USER\\Sandbox_%USER%_%SANDBOX%");
+ else
+ theAPI->GetGlobalSettings()->SetText("KeyRootPath", ui.regRoot->text());
if (ui.ipcRoot->text().isEmpty())
- ui.ipcRoot->setText("\\Sandbox\\%USER%\\%SANDBOX%\\Session_%SESSION%");
- theAPI->GetGlobalSettings()->SetText("IpcRootPath", ui.ipcRoot->text());
+ theAPI->GetGlobalSettings()->DelValue("IpcRootPath"); //ui.ipcRoot->setText("\\Sandbox\\%USER%\\%SANDBOX%\\Session_%SESSION%");
+ else
+ theAPI->GetGlobalSettings()->SetText("IpcRootPath", ui.ipcRoot->text());
theAPI->GetGlobalSettings()->SetBool("EditAdminOnly", ui.chkAdminOnly->isChecked());
@@ -262,6 +272,9 @@ void CSettingsWindow::apply()
}
}
+ if (ui.chkAutoRoot->isVisible())
+ theConf->SetValue("Options/PortableRootDir", ui.chkAutoRoot->checkState() != Qt::Checked ? 1 : 0);
+
theConf->SetValue("Options/AutoRunSoftCompat", !ui.chkNoCompat->isChecked());
emit OptionsChanged();
@@ -287,6 +300,9 @@ void CSettingsWindow::OnChange()
QStandardItem *item = model->item(0);
item->setFlags((!ui.chkShowTray->isChecked()) ? item->flags() & ~Qt::ItemIsEnabled : item->flags() | Qt::ItemIsEnabled);
+ if (ui.chkAutoRoot->isVisible() && theGUI->IsFullyPortable())
+ ui.fileRoot->setEnabled(ui.chkAutoRoot->checkState() != Qt::Checked);
+
ui.btnSetPassword->setEnabled(ui.chkPassRequired->isChecked());
}