1.14.0
This commit is contained in:
parent
d0ece79771
commit
5ea9da147b
|
@ -1030,15 +1030,21 @@ QString CSbieAPI::GetUserSection(QString* pUserName, bool* pIsAdmin) const
|
|||
}
|
||||
|
||||
SB_RESULT(quint32) CSbieAPI::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir, QProcess* pProcess)
|
||||
{
|
||||
return RunStart(BoxName, Command, Elevated, WorkingDir, false, pProcess);
|
||||
}
|
||||
SB_RESULT(quint32) CSbieAPI::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir,bool isFCP, QProcess* pProcess)
|
||||
{
|
||||
if (m_SbiePath.isEmpty())
|
||||
return SB_ERR(SB_PathFail);
|
||||
|
||||
QString StartArgs;
|
||||
if(Elevated)
|
||||
if (Elevated)
|
||||
StartArgs += "/elevated ";
|
||||
if (!BoxName.isEmpty())
|
||||
StartArgs += "/box:" + BoxName + " ";
|
||||
if (isFCP)
|
||||
StartArgs += "/fcp ";
|
||||
else
|
||||
StartArgs += "/disable_force ";
|
||||
|
||||
|
@ -1069,42 +1075,41 @@ SB_RESULT(quint32) CSbieAPI::RunStart(const QString& BoxName, const QString& Com
|
|||
/*
|
||||
QString CommandLine = "\"" + GetStartPath() + "\" " + StartArgs;
|
||||
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
si.cb = sizeof(si);
|
||||
ZeroMemory( &pi, sizeof(pi) );
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
si.cb = sizeof(si);
|
||||
ZeroMemory( &pi, sizeof(pi) );
|
||||
|
||||
// Start the child process.
|
||||
if( !CreateProcessW( NULL, // No module name (use command line)
|
||||
(wchar_t*)CommandLine.toStdWString().c_str(), // Command line
|
||||
NULL, // Process handle not inheritable
|
||||
NULL, // Thread handle not inheritable
|
||||
FALSE, // Set handle inheritance to FALSE
|
||||
0, // No creation flags
|
||||
NULL, // Use parent's environment block
|
||||
NULL, // Use parent's starting directory
|
||||
&si, // Pointer to STARTUPINFO structure
|
||||
&pi ) // Pointer to PROCESS_INFORMATION structure
|
||||
)
|
||||
{
|
||||
printf( "CreateProcess failed (%d).\n", GetLastError() );
|
||||
// Start the child process.
|
||||
if( !CreateProcessW( NULL, // No module name (use command line)
|
||||
(wchar_t*)CommandLine.toStdWString().c_str(), // Command line
|
||||
NULL, // Process handle not inheritable
|
||||
NULL, // Thread handle not inheritable
|
||||
FALSE, // Set handle inheritance to FALSE
|
||||
0, // No creation flags
|
||||
NULL, // Use parent's environment block
|
||||
NULL, // Use parent's starting directory
|
||||
&si, // Pointer to STARTUPINFO structure
|
||||
&pi ) // Pointer to PROCESS_INFORMATION structure
|
||||
)
|
||||
{
|
||||
printf( "CreateProcess failed (%d).\n", GetLastError() );
|
||||
return SB_ERR();
|
||||
}
|
||||
}
|
||||
|
||||
// Wait until child process exits.
|
||||
//WaitForSingleObject( pi.hProcess, INFINITE );
|
||||
// Wait until child process exits.
|
||||
//WaitForSingleObject( pi.hProcess, INFINITE );
|
||||
|
||||
// Close process and thread handles.
|
||||
CloseHandle( pi.hProcess );
|
||||
CloseHandle( pi.hThread );
|
||||
// Close process and thread handles.
|
||||
CloseHandle( pi.hProcess );
|
||||
CloseHandle( pi.hThread );
|
||||
*/
|
||||
|
||||
if(pid == 0)
|
||||
if (pid == 0)
|
||||
return SB_ERR();
|
||||
return CSbieResult<quint32>((quint32)pid);
|
||||
}
|
||||
|
||||
QString CSbieAPI::GetStartPath() const
|
||||
{
|
||||
return m_SbiePath + "\\" + QString::fromWCharArray(SBIESTART_EXE);
|
||||
|
|
|
@ -152,6 +152,7 @@ public:
|
|||
virtual QString GetSbieMsgStr(quint32 code, quint32 Lang = 1033);
|
||||
|
||||
virtual SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, bool Elevated = false, const QString& WorkingDir = QString(), QProcess* pProcess = NULL);
|
||||
virtual SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, bool Elevated = false, const QString& WorkingDir = QString(), bool isFCP,QProcess* pProcess = NULL);
|
||||
virtual QString GetStartPath() const;
|
||||
|
||||
virtual quint32 GetSessionID() const;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>263</width>
|
||||
<height>430</height>
|
||||
<width>278</width>
|
||||
<height>475</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -31,77 +31,80 @@
|
|||
<property name="windowTitle">
|
||||
<string>SandboxiePlus select box</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="5" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radBoxed">
|
||||
<property name="text">
|
||||
<string>Run Sandboxed</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QTreeWidget" name="treeBoxes">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Sandbox</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QRadioButton" name="radUnBoxed">
|
||||
<property name="text">
|
||||
<string>Run Outside the Sandbox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="chkAdmin">
|
||||
<property name="text">
|
||||
<string>Run As UAC Administrator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Select the sandbox in which to start the program, installer or document.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QRadioButton" name="radBoxedNew">
|
||||
<property name="text">
|
||||
<string>Run in a new Sandbox</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<widget class="QTreeWidget" name="treeBoxes">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Sandbox</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QRadioButton" name="radUnBoxed">
|
||||
<property name="text">
|
||||
<string>Run Outside the Sandbox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Select the sandbox in which to start the program, installer or document.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QRadioButton" name="radBoxedNew">
|
||||
<property name="text">
|
||||
<string>Run in a new Sandbox</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="chkAdmin">
|
||||
<property name="text">
|
||||
<string>Run As UAC Administrator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radBoxed">
|
||||
<property name="text">
|
||||
<string>Run Sandboxed</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="radFCPRuned">
|
||||
<property name="text">
|
||||
<string>Run Unsandboxed with ForceChildProcess</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
@ -1696,18 +1696,21 @@ bool CSandMan::RunSandboxed(const QStringList& Commands, QString BoxName, const
|
|||
}
|
||||
|
||||
SB_RESULT(quint32) CSandMan::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir, QProcess* pProcess)
|
||||
{
|
||||
return RunStart(BoxName, Command, Elevated, WorkingDir, false, pProcess);
|
||||
}
|
||||
SB_RESULT(quint32) CSandMan::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir,bool isFCP, QProcess* pProcess)
|
||||
{
|
||||
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);
|
||||
if (Status.IsError())
|
||||
return Status;
|
||||
}
|
||||
|
||||
return theAPI->RunStart(BoxName, Command, Elevated, WorkingDir, pProcess);
|
||||
return theAPI->RunStart(BoxName, Command, Elevated, WorkingDir,isFCP, pProcess);
|
||||
}
|
||||
|
||||
SB_STATUS CSandMan::ImBoxMount(const CSandBoxPtr& pBox, bool bAutoUnmount)
|
||||
{
|
||||
auto pBoxEx = pBox.objectCast<CSandBoxPlus>();
|
||||
|
|
|
@ -92,6 +92,7 @@ public:
|
|||
|
||||
bool RunSandboxed(const QStringList& Commands, QString BoxName = QString(), const QString& WrkDir = QString());
|
||||
SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, bool Elevated = false, const QString& WorkingDir = QString(), QProcess* pProcess = NULL);
|
||||
SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, bool Elevated = false, const QString& WorkingDir = QString(), bool isFCP,QProcess* pProcess = NULL);
|
||||
SB_STATUS ImBoxMount(const CSandBoxPtr& pBox, bool bAutoUnmount = false);
|
||||
|
||||
void EditIni(const QString& IniPath, bool bPlus = false);
|
||||
|
|
|
@ -93,6 +93,11 @@ void CSbiePlusAPI::StopMonitor()
|
|||
}
|
||||
|
||||
SB_RESULT(quint32) CSbiePlusAPI::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir, QProcess* pProcess)
|
||||
{
|
||||
|
||||
return RunStart(BoxName,Command,Elevated,WorkingDir,false,pProcess);
|
||||
}
|
||||
SB_RESULT(quint32) CSbiePlusAPI::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir, bool isFCP,QProcess* pProcess)
|
||||
{
|
||||
if (!pProcess)
|
||||
pProcess = new QProcess(this);
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
virtual void StopMonitor();
|
||||
|
||||
virtual SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, bool Elevated = false, const QString& WorkingDir = QString(), QProcess* pProcess = NULL);
|
||||
|
||||
virtual SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, bool Elevated = false, const QString& WorkingDir = QString(), bool isFCP,QProcess* pProcess = NULL);
|
||||
virtual bool IsStarting(qint64 pid) const { return m_PendingStarts.contains(pid); }
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -186,6 +186,7 @@ CSelectBoxWindow::CSelectBoxWindow(const QStringList& Commands, const QString& B
|
|||
connect(ui.radBoxed, SIGNAL(clicked(bool)), this, SLOT(OnBoxType()));
|
||||
connect(ui.radBoxedNew, SIGNAL(clicked(bool)), this, SLOT(OnBoxType()));
|
||||
connect(ui.radUnBoxed, SIGNAL(clicked(bool)), this, SLOT(OnBoxType()));
|
||||
connect(ui.radFCPRuned, SIGNAL(clicked(bool)), this, SLOT(OnBoxType()));
|
||||
|
||||
connect(ui.buttonBox, SIGNAL(accepted()), SLOT(OnRun()));
|
||||
connect(ui.buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||
|
@ -213,13 +214,13 @@ void CSelectBoxWindow::closeEvent(QCloseEvent *e)
|
|||
|
||||
void CSelectBoxWindow::OnBoxType()
|
||||
{
|
||||
m_pBoxPicker->setEnabled(ui.radBoxed->isChecked());
|
||||
m_pBoxPicker->setEnabled(ui.radBoxed->isChecked()||ui.radFCPRuned->isChecked());
|
||||
}
|
||||
|
||||
void CSelectBoxWindow::OnRun()
|
||||
{
|
||||
QString BoxName;
|
||||
|
||||
bool isFCP = false;
|
||||
if (ui.radUnBoxed->isChecked())
|
||||
{
|
||||
if (QMessageBox("Sandboxie-Plus", tr("Are you sure you want to run the program outside the sandbox?"), QMessageBox::Question, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape, QMessageBox::NoButton, this).exec() != QMessageBox::Yes)
|
||||
|
@ -233,6 +234,15 @@ void CSelectBoxWindow::OnRun()
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (ui.radFCPRuned->isChecked())
|
||||
{
|
||||
isFCP = true;
|
||||
BoxName = m_pBoxPicker->GetBoxName();
|
||||
if (BoxName.isEmpty()) {
|
||||
QMessageBox("Sandboxie-Plus", tr("Please select a sandbox."), QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this).exec();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BoxName = m_pBoxPicker->GetBoxName();
|
||||
|
@ -243,7 +253,7 @@ void CSelectBoxWindow::OnRun()
|
|||
}
|
||||
|
||||
foreach(const QString & Command, m_Commands)
|
||||
theGUI->RunStart(BoxName, Command, ui.chkAdmin->isChecked(), m_WrkDir);
|
||||
theGUI->RunStart(BoxName, Command, ui.chkAdmin->isChecked(), m_WrkDir,isFCP,0);
|
||||
|
||||
setResult(1);
|
||||
close();
|
||||
|
|
Loading…
Reference in New Issue