fixes
This commit is contained in:
parent
fb31e94fb8
commit
bd6cc0f7ad
|
@ -920,6 +920,15 @@ Desktop
|
||||||
Programs
|
Programs
|
||||||
.
|
.
|
||||||
|
|
||||||
|
3198;txt;01
|
||||||
|
Do you want to start a new program into the sandbox %s?
|
||||||
|
You received this message because you set AlertBeforeStart=y.
|
||||||
|
.
|
||||||
|
|
||||||
|
3199;txt;01
|
||||||
|
This startup request does not appear to be invoked by the SANDBOXIE component. Are you sure you want to run it? If this is your action, you can ignore it and choose yes.
|
||||||
|
.
|
||||||
|
|
||||||
3202;txt;01
|
3202;txt;01
|
||||||
Invalid command line parameter: %2
|
Invalid command line parameter: %2
|
||||||
.
|
.
|
||||||
|
@ -4238,14 +4247,4 @@ This is the third and last retry.
|
||||||
8106;txt;02
|
8106;txt;02
|
||||||
The following programs must be closed before the installation can continue.
|
The following programs must be closed before the installation can continue.
|
||||||
Click OK to close these programs and continue. Click Cancel to abort the installation.
|
Click OK to close these programs and continue. Click Cancel to abort the installation.
|
||||||
.
|
.
|
||||||
|
|
||||||
3198;txt;01
|
|
||||||
Do you want to start a new program into the sandbox %s?
|
|
||||||
You received this message because you set AlertBeforeStart=y.
|
|
||||||
|
|
||||||
.
|
|
||||||
|
|
||||||
3199;txt;01
|
|
||||||
This startup request does not appear to be invoked by the SANDBOXIE component. Are you sure you want to run it? If this is your action, you can ignore it and choose yes.
|
|
||||||
.
|
|
|
@ -147,7 +147,7 @@ SB_STATUS CSandBox::RunStart(const QString& Command, bool Elevated)
|
||||||
if ((QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) != 0)
|
if ((QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) != 0)
|
||||||
return RunSandboxed(Command);
|
return RunSandboxed(Command);
|
||||||
#endif
|
#endif
|
||||||
return m_pAPI->RunStart(m_Name, Command, Elevated);
|
return m_pAPI->RunStart(m_Name, Command, Elevated ? CSbieAPI::eStartElevated : CSbieAPI::eStartDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
SB_STATUS CSandBox::RunSandboxed(const QString& Command)
|
SB_STATUS CSandBox::RunSandboxed(const QString& Command)
|
||||||
|
|
|
@ -1029,22 +1029,19 @@ QString CSbieAPI::GetUserSection(QString* pUserName, bool* pIsAdmin) const
|
||||||
return UserSection;
|
return UserSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
SB_RESULT(quint32) CSbieAPI::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir, QProcess* pProcess)
|
SB_RESULT(quint32) CSbieAPI::RunStart(const QString& BoxName, const QString& Command, EStartFlags Flags, const QString& WorkingDir, QProcess* pProcess)
|
||||||
{
|
|
||||||
return RunStartWithFCP(BoxName, Command,false, Elevated, WorkingDir, pProcess);
|
|
||||||
}
|
|
||||||
SB_RESULT(quint32) CSbieAPI::RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP,bool Elevated, const QString& WorkingDir, QProcess* pProcess)
|
|
||||||
{
|
{
|
||||||
if (m_SbiePath.isEmpty())
|
if (m_SbiePath.isEmpty())
|
||||||
return SB_ERR(SB_PathFail);
|
return SB_ERR(SB_PathFail);
|
||||||
|
|
||||||
QString StartArgs;
|
QString StartArgs;
|
||||||
if (Elevated)
|
if (Flags & eStartElevated)
|
||||||
StartArgs += "/elevated ";
|
StartArgs += "/elevated ";
|
||||||
|
if (Flags & eStartFCP)
|
||||||
|
StartArgs += "/fcp ";
|
||||||
|
|
||||||
if (!BoxName.isEmpty())
|
if (!BoxName.isEmpty())
|
||||||
StartArgs += "/box:" + BoxName + " ";
|
StartArgs += "/box:" + BoxName + " ";
|
||||||
if (isFCP)
|
|
||||||
StartArgs += "/fcp ";
|
|
||||||
else
|
else
|
||||||
StartArgs += "/disable_force ";
|
StartArgs += "/disable_force ";
|
||||||
|
|
||||||
|
@ -1075,41 +1072,42 @@ SB_RESULT(quint32) CSbieAPI::RunStartWithFCP(const QString& BoxName, const QStri
|
||||||
/*
|
/*
|
||||||
QString CommandLine = "\"" + GetStartPath() + "\" " + StartArgs;
|
QString CommandLine = "\"" + GetStartPath() + "\" " + StartArgs;
|
||||||
|
|
||||||
STARTUPINFO si;
|
STARTUPINFO si;
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
ZeroMemory( &si, sizeof(si) );
|
ZeroMemory( &si, sizeof(si) );
|
||||||
si.cb = sizeof(si);
|
si.cb = sizeof(si);
|
||||||
ZeroMemory( &pi, sizeof(pi) );
|
ZeroMemory( &pi, sizeof(pi) );
|
||||||
|
|
||||||
// Start the child process.
|
// Start the child process.
|
||||||
if( !CreateProcessW( NULL, // No module name (use command line)
|
if( !CreateProcessW( NULL, // No module name (use command line)
|
||||||
(wchar_t*)CommandLine.toStdWString().c_str(), // Command line
|
(wchar_t*)CommandLine.toStdWString().c_str(), // Command line
|
||||||
NULL, // Process handle not inheritable
|
NULL, // Process handle not inheritable
|
||||||
NULL, // Thread handle not inheritable
|
NULL, // Thread handle not inheritable
|
||||||
FALSE, // Set handle inheritance to FALSE
|
FALSE, // Set handle inheritance to FALSE
|
||||||
0, // No creation flags
|
0, // No creation flags
|
||||||
NULL, // Use parent's environment block
|
NULL, // Use parent's environment block
|
||||||
NULL, // Use parent's starting directory
|
NULL, // Use parent's starting directory
|
||||||
&si, // Pointer to STARTUPINFO structure
|
&si, // Pointer to STARTUPINFO structure
|
||||||
&pi ) // Pointer to PROCESS_INFORMATION structure
|
&pi ) // Pointer to PROCESS_INFORMATION structure
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
printf( "CreateProcess failed (%d).\n", GetLastError() );
|
printf( "CreateProcess failed (%d).\n", GetLastError() );
|
||||||
return SB_ERR();
|
return SB_ERR();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until child process exits.
|
// Wait until child process exits.
|
||||||
//WaitForSingleObject( pi.hProcess, INFINITE );
|
//WaitForSingleObject( pi.hProcess, INFINITE );
|
||||||
|
|
||||||
// Close process and thread handles.
|
// Close process and thread handles.
|
||||||
CloseHandle( pi.hProcess );
|
CloseHandle( pi.hProcess );
|
||||||
CloseHandle( pi.hThread );
|
CloseHandle( pi.hThread );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (pid == 0)
|
if(pid == 0)
|
||||||
return SB_ERR();
|
return SB_ERR();
|
||||||
return CSbieResult<quint32>((quint32)pid);
|
return CSbieResult<quint32>((quint32)pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CSbieAPI::GetStartPath() const
|
QString CSbieAPI::GetStartPath() const
|
||||||
{
|
{
|
||||||
return m_SbiePath + "\\" + QString::fromWCharArray(SBIESTART_EXE);
|
return m_SbiePath + "\\" + QString::fromWCharArray(SBIESTART_EXE);
|
||||||
|
|
|
@ -153,8 +153,14 @@ public:
|
||||||
|
|
||||||
virtual QString GetSbieMsgStr(quint32 code, quint32 Lang = 1033);
|
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);
|
enum EStartFlags
|
||||||
virtual SB_RESULT(quint32) RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP,bool Elevated = false, const QString& WorkingDir = QString(),QProcess* pProcess = NULL);
|
{
|
||||||
|
eStartDefault = 0,
|
||||||
|
eStartElevated = 1,
|
||||||
|
eStartFCP = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, EStartFlags Flags = eStartDefault, const QString& WorkingDir = QString(), QProcess* pProcess = NULL);
|
||||||
virtual QString GetStartPath() const;
|
virtual QString GetStartPath() const;
|
||||||
|
|
||||||
virtual quint32 GetSessionID() const;
|
virtual quint32 GetSessionID() const;
|
||||||
|
|
|
@ -564,7 +564,7 @@ bool CSbieUtils::GetStartMenuShortcut(CSbieAPI* pApi, QString &BoxName, QString
|
||||||
QString Command = "start_menu:" + QString::fromWCharArray(MapName);
|
QString Command = "start_menu:" + QString::fromWCharArray(MapName);
|
||||||
if (!LinkPath.isEmpty())
|
if (!LinkPath.isEmpty())
|
||||||
Command += ":" + LinkPath;
|
Command += ":" + LinkPath;
|
||||||
pApi->RunStart(BoxName, Command, false, QString(), &Process);
|
pApi->RunStart(BoxName, Command, CSbieAPI::eStartDefault, QString(), &Process);
|
||||||
//Process.waitForFinished(-1);
|
//Process.waitForFinished(-1);
|
||||||
while(Process.state() != QProcess::NotRunning)
|
while(Process.state() != QProcess::NotRunning)
|
||||||
QCoreApplication::processEvents(); // keep UI responsive
|
QCoreApplication::processEvents(); // keep UI responsive
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
quint32 CBoxObject::StartTask(const QString& Command, const QVariantMap& Options)
|
quint32 CBoxObject::StartTask(const QString& Command, const QVariantMap& Options)
|
||||||
{
|
{
|
||||||
SB_RESULT(quint32) result = theGUI->RunStart(getName(), Command, Options["elevalted"].toBool(), Options["directory"].toString());
|
SB_RESULT(quint32) result = theGUI->RunStart(getName(), Command, Options["elevalted"].toBool() ? CSbieAPI::eStartElevated : CSbieAPI::eStartDefault, Options["directory"].toString());
|
||||||
return result.IsError() ? -1 : result.GetValue();
|
return result.IsError() ? -1 : result.GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,24 @@
|
||||||
<string>SandboxiePlus select box</string>
|
<string>SandboxiePlus select box</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="3" column="0">
|
<item row="5" column="0">
|
||||||
|
<widget class="QRadioButton" name="radUnBoxed">
|
||||||
|
<property name="text">
|
||||||
|
<string>Run Outside the Sandbox</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QCheckBox" name="chkFCP">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Force child processes to be sandboxed</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Force Children</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QTreeWidget" name="treeBoxes">
|
<widget class="QTreeWidget" name="treeBoxes">
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -41,31 +58,7 @@
|
||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="4" column="0" colspan="2">
|
||||||
<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">
|
<widget class="QRadioButton" name="radBoxedNew">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Run in a new Sandbox</string>
|
<string>Run in a new Sandbox</string>
|
||||||
|
@ -75,21 +68,28 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="7" column="0" colspan="2">
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="chkAdmin">
|
<widget class="QCheckBox" name="chkAdmin">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Run As UAC Administrator</string>
|
<string>Run As UAC Administrator</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="9" column="0" colspan="2">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0" colspan="2">
|
||||||
<widget class="QRadioButton" name="radBoxed">
|
<widget class="QRadioButton" name="radBoxed">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Run Sandboxed</string>
|
<string>Run Sandboxed</string>
|
||||||
|
@ -99,10 +99,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QRadioButton" name="radFCPRuned">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Run Unsandboxed with ForceChildProcess</string>
|
<string>Select the sandbox in which to start the program, installer or document.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -1671,9 +1671,9 @@ void CSandMan::OnMessage(const QString& MsgData)
|
||||||
BoxName = theAPI->GetGlobalSettings()->GetText("DefaultBox", "DefaultBox");
|
BoxName = theAPI->GetGlobalSettings()->GetText("DefaultBox", "DefaultBox");
|
||||||
|
|
||||||
if (!BoxName.isEmpty())
|
if (!BoxName.isEmpty())
|
||||||
RunStart(BoxName == "*DFP*" ? "" : BoxName, CmdLine, false, WrkDir);
|
RunStart(BoxName == "*DFP*" ? "" : BoxName, CmdLine, CSbieAPI::eStartDefault, WrkDir);
|
||||||
else
|
else
|
||||||
RunSandboxed(QStringList(CmdLine), BoxName, WrkDir);
|
RunSandboxed(QStringList(CmdLine), BoxName, WrkDir, true);
|
||||||
}
|
}
|
||||||
else if (Message.left(3) == "Op:")
|
else if (Message.left(3) == "Op:")
|
||||||
{
|
{
|
||||||
|
@ -1702,21 +1702,18 @@ void CSandMan::dragEnterEvent(QDragEnterEvent* e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSandMan::RunSandboxed(const QStringList& Commands, QString BoxName, const QString& WrkDir)
|
bool CSandMan::RunSandboxed(const QStringList& Commands, QString BoxName, const QString& WrkDir, bool bShowFCP)
|
||||||
{
|
{
|
||||||
if (BoxName.isEmpty())
|
if (BoxName.isEmpty())
|
||||||
BoxName = theAPI->GetGlobalSettings()->GetText("DefaultBox", "DefaultBox");
|
BoxName = theAPI->GetGlobalSettings()->GetText("DefaultBox", "DefaultBox");
|
||||||
CSelectBoxWindow* pSelectBoxWindow = new CSelectBoxWindow(Commands, BoxName, WrkDir, g_GUIParent);
|
CSelectBoxWindow* pSelectBoxWindow = new CSelectBoxWindow(Commands, BoxName, WrkDir, g_GUIParent);
|
||||||
|
if (bShowFCP) pSelectBoxWindow->ShowFCP();
|
||||||
connect(this, SIGNAL(Closed()), pSelectBoxWindow, SLOT(close()));
|
connect(this, SIGNAL(Closed()), pSelectBoxWindow, SLOT(close()));
|
||||||
//pSelectBoxWindow->show();
|
//pSelectBoxWindow->show();
|
||||||
return SafeExec(pSelectBoxWindow) == 1;
|
return SafeExec(pSelectBoxWindow) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SB_RESULT(quint32) CSandMan::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir, QProcess* pProcess)
|
SB_RESULT(quint32) CSandMan::RunStart(const QString& BoxName, const QString& Command, CSbieAPI::EStartFlags Flags, const QString& WorkingDir, QProcess* pProcess)
|
||||||
{
|
|
||||||
return RunStartWithFCP(BoxName, Command, false, Elevated, WorkingDir, pProcess);
|
|
||||||
}
|
|
||||||
SB_RESULT(quint32) CSandMan::RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP, bool Elevated, const QString& WorkingDir, QProcess* pProcess)
|
|
||||||
{
|
{
|
||||||
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()) {
|
||||||
|
@ -1726,8 +1723,9 @@ SB_RESULT(quint32) CSandMan::RunStartWithFCP(const QString& BoxName, const QStri
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return theAPI->RunStartWithFCP(BoxName, Command, isFCP, Elevated, WorkingDir, pProcess);
|
return theAPI->RunStart(BoxName, Command, Flags, WorkingDir, pProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
SB_STATUS CSandMan::ImBoxMount(const CSandBoxPtr& pBox, bool bAutoUnmount)
|
SB_STATUS CSandMan::ImBoxMount(const CSandBoxPtr& pBox, bool bAutoUnmount)
|
||||||
{
|
{
|
||||||
auto pBoxEx = pBox.objectCast<CSandBoxPlus>();
|
auto pBoxEx = pBox.objectCast<CSandBoxPlus>();
|
||||||
|
|
|
@ -91,9 +91,8 @@ public:
|
||||||
static void SafeShow(QWidget* pWidget);
|
static void SafeShow(QWidget* pWidget);
|
||||||
int SafeExec(QDialog* pDialog);
|
int SafeExec(QDialog* pDialog);
|
||||||
|
|
||||||
bool RunSandboxed(const QStringList& Commands, QString BoxName = QString(), const QString& WrkDir = QString());
|
bool RunSandboxed(const QStringList& Commands, QString BoxName = QString(), const QString& WrkDir = QString(), bool bShowFCP = false);
|
||||||
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, CSbieAPI::EStartFlags Flags = CSbieAPI::eStartDefault, const QString& WorkingDir = QString(), QProcess* pProcess = NULL);
|
||||||
SB_RESULT(quint32) RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP, bool Elevated = false, const QString& WorkingDir = QString(),QProcess* pProcess = NULL);
|
|
||||||
SB_STATUS ImBoxMount(const CSandBoxPtr& pBox, bool bAutoUnmount = false);
|
SB_STATUS ImBoxMount(const CSandBoxPtr& pBox, bool bAutoUnmount = false);
|
||||||
|
|
||||||
void EditIni(const QString& IniPath, bool bPlus = false);
|
void EditIni(const QString& IniPath, bool bPlus = false);
|
||||||
|
|
|
@ -357,6 +357,6 @@ void CSandMan::OnRecoveryLog()
|
||||||
{
|
{
|
||||||
if (!m_pRecoveryLogWnd->isVisible()) {
|
if (!m_pRecoveryLogWnd->isVisible()) {
|
||||||
m_pRecoveryLogWnd->setWindowFlag(Qt::WindowStaysOnTopHint, theGUI->IsAlwaysOnTop());
|
m_pRecoveryLogWnd->setWindowFlag(Qt::WindowStaysOnTopHint, theGUI->IsAlwaysOnTop());
|
||||||
SafeShow(m_pRecoveryLogWnd);
|
CSandMan::SafeShow(m_pRecoveryLogWnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,16 +92,11 @@ void CSbiePlusAPI::StopMonitor()
|
||||||
m_BoxMonitor->Stop();
|
m_BoxMonitor->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
SB_RESULT(quint32) CSbiePlusAPI::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir, QProcess* pProcess)
|
SB_RESULT(quint32) CSbiePlusAPI::RunStart(const QString& BoxName, const QString& Command, EStartFlags Flags, const QString& WorkingDir,QProcess* pProcess)
|
||||||
{
|
|
||||||
|
|
||||||
return RunStartWithFCP(BoxName,Command,false,Elevated,WorkingDir,pProcess);
|
|
||||||
}
|
|
||||||
SB_RESULT(quint32) CSbiePlusAPI::RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP, bool Elevated, const QString& WorkingDir,QProcess* pProcess)
|
|
||||||
{
|
{
|
||||||
if (!pProcess)
|
if (!pProcess)
|
||||||
pProcess = new QProcess(this);
|
pProcess = new QProcess(this);
|
||||||
SB_RESULT(quint32) Status = CSbieAPI::RunStartWithFCP(BoxName, Command,isFCP, Elevated, WorkingDir, pProcess);
|
SB_RESULT(quint32) Status = CSbieAPI::RunStart(BoxName, Command, Flags, WorkingDir, pProcess);
|
||||||
if (pProcess->parent() == this) {
|
if (pProcess->parent() == this) {
|
||||||
if (!Status.IsError()) {
|
if (!Status.IsError()) {
|
||||||
connect(pProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(OnStartFinished()));
|
connect(pProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(OnStartFinished()));
|
||||||
|
|
|
@ -31,8 +31,7 @@ public:
|
||||||
|
|
||||||
virtual void StopMonitor();
|
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, EStartFlags Flags = eStartDefault, const QString& WorkingDir = QString(), QProcess* pProcess = NULL);
|
||||||
virtual SB_RESULT(quint32) RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP,bool Elevated = false, const QString& WorkingDir = QString(),QProcess* pProcess = NULL);
|
|
||||||
virtual bool IsStarting(qint64 pid) const { return m_PendingStarts.contains(pid); }
|
virtual bool IsStarting(qint64 pid) const { return m_PendingStarts.contains(pid); }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -1216,7 +1216,7 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList<CSandBoxPtr>& SandB
|
||||||
else if (Action == m_pMenuRunCmd)
|
else if (Action == m_pMenuRunCmd)
|
||||||
Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "cmd.exe"));
|
Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "cmd.exe"));
|
||||||
else if (Action == m_pMenuRunCmdAdmin)
|
else if (Action == m_pMenuRunCmdAdmin)
|
||||||
Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "cmd.exe", true));
|
Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "cmd.exe", CSbieAPI::eStartElevated));
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
else if (Action == m_pMenuRunCmd32)
|
else if (Action == m_pMenuRunCmd32)
|
||||||
Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "C:\\WINDOWS\\SysWOW64\\cmd.exe"));
|
Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "C:\\WINDOWS\\SysWOW64\\cmd.exe"));
|
||||||
|
@ -1576,10 +1576,10 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList<CSandBoxPtr>& SandB
|
||||||
QString Command = Action->data().toString();
|
QString Command = Action->data().toString();
|
||||||
QString WorkingDir = Action->property("WorkingDir").toString();
|
QString WorkingDir = Action->property("WorkingDir").toString();
|
||||||
if (Command.isEmpty())
|
if (Command.isEmpty())
|
||||||
Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "start_menu", false, WorkingDir));
|
Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "start_menu", CSbieAPI::eStartDefault, WorkingDir));
|
||||||
else {
|
else {
|
||||||
auto pBoxEx = SandBoxes.first().objectCast<CSandBoxPlus>();
|
auto pBoxEx = SandBoxes.first().objectCast<CSandBoxPlus>();
|
||||||
Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), pBoxEx->GetFullCommand(Command), false, pBoxEx->GetFullCommand(WorkingDir)));
|
Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), pBoxEx->GetFullCommand(Command), CSbieAPI::eStartDefault, pBoxEx->GetFullCommand(WorkingDir)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,9 @@ CSelectBoxWindow::CSelectBoxWindow(const QStringList& Commands, const QString& B
|
||||||
connect(ui.radBoxed, SIGNAL(clicked(bool)), this, SLOT(OnBoxType()));
|
connect(ui.radBoxed, SIGNAL(clicked(bool)), this, SLOT(OnBoxType()));
|
||||||
connect(ui.radBoxedNew, 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.radUnBoxed, SIGNAL(clicked(bool)), this, SLOT(OnBoxType()));
|
||||||
connect(ui.radFCPRuned, SIGNAL(clicked(bool)), this, SLOT(OnBoxType()));
|
connect(ui.chkFCP, SIGNAL(clicked(bool)), this, SLOT(OnBoxType()));
|
||||||
|
ui.chkFCP->setEnabled(false);
|
||||||
|
ui.chkFCP->setVisible(false);
|
||||||
|
|
||||||
connect(ui.buttonBox, SIGNAL(accepted()), SLOT(OnRun()));
|
connect(ui.buttonBox, SIGNAL(accepted()), SLOT(OnRun()));
|
||||||
connect(ui.buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
connect(ui.buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||||
|
@ -204,6 +206,11 @@ CSelectBoxWindow::~CSelectBoxWindow()
|
||||||
theConf->SetBlob("SelectBoxWindow/Window_Geometry", saveGeometry());
|
theConf->SetBlob("SelectBoxWindow/Window_Geometry", saveGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSelectBoxWindow::ShowFCP()
|
||||||
|
{
|
||||||
|
ui.chkFCP->setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
void CSelectBoxWindow::closeEvent(QCloseEvent *e)
|
void CSelectBoxWindow::closeEvent(QCloseEvent *e)
|
||||||
{
|
{
|
||||||
//emit Closed();
|
//emit Closed();
|
||||||
|
@ -212,19 +219,22 @@ void CSelectBoxWindow::closeEvent(QCloseEvent *e)
|
||||||
|
|
||||||
void CSelectBoxWindow::OnBoxType()
|
void CSelectBoxWindow::OnBoxType()
|
||||||
{
|
{
|
||||||
m_pBoxPicker->setEnabled(ui.radBoxed->isChecked()||ui.radFCPRuned->isChecked());
|
ui.chkFCP->setEnabled(ui.radUnBoxed->isChecked());
|
||||||
|
m_pBoxPicker->setEnabled(ui.radBoxed->isChecked() || (ui.chkFCP->isEnabled() && ui.chkFCP->isChecked()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSelectBoxWindow::OnRun()
|
void CSelectBoxWindow::OnRun()
|
||||||
{
|
{
|
||||||
QString BoxName;
|
QString BoxName;
|
||||||
bool isFCP = false;
|
int Flags = CSbieAPI::eStartDefault;
|
||||||
|
if (ui.chkAdmin->isChecked())
|
||||||
|
Flags |= CSbieAPI::eStartElevated;
|
||||||
if (ui.radUnBoxed->isChecked())
|
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)
|
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)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (ui.radBoxedNew->isChecked())
|
if (ui.radBoxedNew->isChecked())
|
||||||
{
|
{
|
||||||
BoxName = theGUI->GetBoxView()->AddNewBox(true);
|
BoxName = theGUI->GetBoxView()->AddNewBox(true);
|
||||||
if (BoxName.isEmpty()) {
|
if (BoxName.isEmpty()) {
|
||||||
|
@ -232,17 +242,10 @@ void CSelectBoxWindow::OnRun()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ui.radFCPRuned->isChecked())
|
else if (!ui.radUnBoxed->isChecked() || ui.chkFCP->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
|
|
||||||
{
|
{
|
||||||
|
if (ui.chkFCP->isChecked())
|
||||||
|
Flags |= CSbieAPI::eStartFCP;
|
||||||
BoxName = m_pBoxPicker->GetBoxName();
|
BoxName = m_pBoxPicker->GetBoxName();
|
||||||
if (BoxName.isEmpty()) {
|
if (BoxName.isEmpty()) {
|
||||||
QMessageBox("Sandboxie-Plus", tr("Please select a sandbox."), QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this).exec();
|
QMessageBox("Sandboxie-Plus", tr("Please select a sandbox."), QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this).exec();
|
||||||
|
@ -250,9 +253,9 @@ void CSelectBoxWindow::OnRun()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(const QString & Command, m_Commands)
|
foreach(const QString& Command, m_Commands)
|
||||||
theGUI->RunStartWithFCP(BoxName, Command, isFCP, ui.chkAdmin->isChecked(), m_WrkDir,0);
|
theGUI->RunStart(BoxName, Command, (CSbieAPI::EStartFlags)Flags, m_WrkDir);
|
||||||
|
|
||||||
setResult(1);
|
setResult(1);
|
||||||
close();
|
close();
|
||||||
}
|
}
|
|
@ -44,6 +44,8 @@ public:
|
||||||
CSelectBoxWindow(const QStringList& Commands, const QString& BoxName, const QString& WrkDir = QString(), QWidget *parent = Q_NULLPTR);
|
CSelectBoxWindow(const QStringList& Commands, const QString& BoxName, const QString& WrkDir = QString(), QWidget *parent = Q_NULLPTR);
|
||||||
~CSelectBoxWindow();
|
~CSelectBoxWindow();
|
||||||
|
|
||||||
|
void ShowFCP();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void OnBoxType();
|
void OnBoxType();
|
||||||
void OnRun();
|
void OnRun();
|
||||||
|
|
|
@ -270,8 +270,8 @@ SB_STATUS CNewBoxWizard::TryToCreateBox()
|
||||||
if(field("imagesProtection").toBool())
|
if(field("imagesProtection").toBool())
|
||||||
pBox->SetBool("ProtectHostImages", true);
|
pBox->SetBool("ProtectHostImages", true);
|
||||||
|
|
||||||
if (field("coverBoxedWindows").toBool())
|
if (field("coverBoxedWindows").toBool())
|
||||||
pBox->SetBool("CoverBoxedWindows", true);
|
pBox->SetBool("CoverBoxedWindows", true);
|
||||||
|
|
||||||
if (!Password.isEmpty())
|
if (!Password.isEmpty())
|
||||||
pBox->ImBoxCreate(ImageSize / 1024, Password);
|
pBox->ImBoxCreate(ImageSize / 1024, Password);
|
||||||
|
|
Loading…
Reference in New Issue