2023-01-28 13:05:37 +00:00
# include "stdafx.h"
# include "NewBoxWizard.h"
# include "../MiscHelpers/Common/Common.h"
# include "../Windows/SettingsWindow.h"
# include "../SandMan.h"
# include "Helpers/WinAdmin.h"
# include <QButtonGroup>
# include "../QSbieAPI/SbieUtils.h"
# include "../Views/SbieView.h"
2023-01-29 20:12:58 +00:00
# include "../MiscHelpers/Common/CheckableMessageBox.h"
2023-08-24 17:39:00 +01:00
# include "../Windows/BoxImageWindow.h"
# include "../AddonManager.h"
2023-01-28 13:05:37 +00:00
2023-01-29 10:48:28 +00:00
CNewBoxWizard : : CNewBoxWizard ( bool bAlowTemp , QWidget * parent )
2023-01-28 13:05:37 +00:00
: QWizard ( parent )
{
2023-01-29 10:48:28 +00:00
setPage ( Page_Type , new CBoxTypePage ( bAlowTemp ) ) ;
2023-01-28 13:05:37 +00:00
setPage ( Page_Files , new CFilesPage ) ;
2024-05-20 19:49:03 +01:00
setPage ( Page_Isolation , new CIsolationPage ) ;
2023-01-28 13:05:37 +00:00
setPage ( Page_Advanced , new CAdvancedPage ) ;
setPage ( Page_Summary , new CSummaryPage ) ;
2024-06-14 17:09:00 +01:00
2024-01-06 17:02:43 +00:00
m_bAdvanced = theConf - > GetBool ( " Options/AdvancedBoxWizard " , false ) ;
2023-01-28 13:05:37 +00:00
setWizardStyle ( ModernStyle ) ;
//setOption(HaveHelpButton, true);
setPixmap ( QWizard : : LogoPixmap , QPixmap ( " :/SandMan.png " ) . scaled ( 64 , 64 , Qt : : KeepAspectRatio , Qt : : SmoothTransformation ) ) ;
connect ( this , & QWizard : : helpRequested , this , & CNewBoxWizard : : showHelp ) ;
setWindowTitle ( tr ( " New Box Wizard " ) ) ;
2023-07-01 17:54:53 +01:00
2023-08-27 11:54:54 +01:00
setMinimumWidth ( 600 * theConf - > GetInt ( " Options/FontScaling " , 100 ) / 100 ) ;
2023-01-28 13:05:37 +00:00
}
void CNewBoxWizard : : showHelp ( )
{
}
2023-01-29 10:48:28 +00:00
QString CNewBoxWizard : : CreateNewBox ( bool bAlowTemp , QWidget * pParent )
2023-01-28 13:05:37 +00:00
{
2023-01-29 10:48:28 +00:00
CNewBoxWizard wizard ( bAlowTemp , pParent ) ;
2023-05-25 17:33:24 +01:00
if ( ! theGUI - > SafeExec ( & wizard ) )
2023-01-28 13:05:37 +00:00
return QString ( ) ;
QString BoxName = wizard . field ( " boxName " ) . toString ( ) ;
BoxName . replace ( " " , " _ " ) ;
return BoxName ;
}
SB_STATUS CNewBoxWizard : : TryToCreateBox ( )
{
QString BoxName = field ( " boxName " ) . toString ( ) ;
BoxName . replace ( " " , " _ " ) ;
int BoxType = field ( " boxType " ) . toInt ( ) ;
2023-12-15 19:59:54 +00:00
# ifndef USE_COMBO
bool BlackBox = field ( " blackBox " ) . toBool ( ) ;
# else
bool BlackBox = CSandBoxPlus : : ePrivate ;
# endif
2023-01-28 13:05:37 +00:00
2023-08-24 17:39:00 +01:00
QString Password ;
quint64 ImageSize = 0 ;
2023-12-15 19:59:54 +00:00
if ( BlackBox ) {
2023-08-24 17:39:00 +01:00
CBoxImageWindow window ( CBoxImageWindow : : eNew , this ) ;
if ( theGUI - > SafeExec ( & window ) = = 1 ) {
Password = window . GetPassword ( ) ;
ImageSize = window . GetImageSize ( ) ;
if ( theConf - > GetBool ( " Options/WarnBoxCrypto " , true ) ) {
bool State = false ;
if ( CCheckableMessageBox : : question ( this , " Sandboxie-Plus " ,
tr ( " This sandbox content will be placed in an encrypted container file, "
2023-10-21 13:10:45 +01:00
" please note that any corruption of the container's header will render all its content permanently inaccessible. "
" Corruption can occur as a result of a BSOD, a storage hardware failure, or a malicious application overwriting random files. "
" This feature is provided under a strict <b>No Backup No Mercy</b> policy, YOU the user are responsible for the data you put into an encrypted box. "
2023-08-24 17:39:00 +01:00
" <br /><br /> "
" IF YOU AGREE TO TAKE FULL RESPONSIBILITY FOR YOUR DATA PRESS [YES], OTHERWISE PRESS [NO]. " )
, tr ( " Don't show this message again. " ) , & State , QDialogButtonBox : : Yes | QDialogButtonBox : : No , QDialogButtonBox : : No , QMessageBox : : Warning ) ! = QDialogButtonBox : : Yes )
return SB_ERR ( SB_Canceled ) ;
if ( State )
theConf - > SetValue ( " Options/WarnBoxCrypto " , false ) ;
}
}
else
return SB_ERR ( SB_Canceled ) ;
}
2023-01-28 13:05:37 +00:00
SB_STATUS Status = theAPI - > CreateBox ( BoxName , true ) ;
if ( ! Status . IsError ( ) )
{
CSandBoxPtr pBox = theAPI - > GetBoxByName ( BoxName ) ;
2024-06-14 17:09:00 +01:00
2024-03-27 18:41:04 +00:00
// SharedTemplate
2024-05-20 21:53:28 +01:00
QElapsedTimer timer ;
timer . start ( ) ;
2024-08-31 11:07:16 +01:00
int SharedTemplateIndex = field ( " sharedTemplateIndex " ) . toInt ( ) ;
const QString templateName = ( SharedTemplateIndex = = 0 )
? QString ( " SharedTemplate " )
: QString ( " SharedTemplate_%1 " ) . arg ( SharedTemplateIndex ) ;
2024-05-20 21:53:28 +01:00
const QString templateFullName = " Template_Local_ " + templateName ;
const QString templateSettings = theAPI - > SbieIniGetEx ( templateFullName , " " ) ;
const QStringList templateSettingsLines = templateSettings . split ( QRegularExpression ( QStringLiteral ( " [ \r \n ] " ) ) , Qt : : SkipEmptyParts ) ;
const QString templateComment = tr ( " Add your settings after this line. " ) ;
2024-08-31 11:07:16 +01:00
const QString templateTitle = ( SharedTemplateIndex = = 0 )
? tr ( " Shared Template " )
: tr ( " Shared Template " ) + " " + QString : : number ( SharedTemplateIndex ) ;
2024-05-20 21:53:28 +01:00
const QString boxSettings = theAPI - > SbieIniGetEx ( BoxName , " " ) ;
const QStringList boxSettingsLines = boxSettings . split ( QRegularExpression ( QStringLiteral ( " [ \r \n ] " ) ) , Qt : : SkipEmptyParts ) ;
2024-07-19 17:20:58 +01:00
const QStringList SPECIAL_SETTINGS = { " BorderColor " , " BoxIcon " , " ConfigLevel " , " CopyLimitKb " } ;
2024-03-30 20:31:28 +00:00
2024-05-20 21:53:28 +01:00
bool disableWizardSettings = templateSettings . contains ( QRegularExpression ( QStringLiteral ( " [ \r \n ]#DisableWizardSettings=y[ \r \n ] " ) ) ) ;
bool removeDefaultAll = templateSettings . contains ( QRegularExpression ( QStringLiteral ( " [ \r \n ]#RemoveDefaultAll=y[ \r \n ] " ) ) ) ;
bool removeDefaultRecovers = templateSettings . contains ( QRegularExpression ( QStringLiteral ( " [ \r \n ]#RemoveDefaultRecovers=y[ \r \n ] " ) ) ) ;
bool removeDefaultTemplates = templateSettings . contains ( QRegularExpression ( QStringLiteral ( " [ \r \n ]#RemoveDefaultTemplates=y[ \r \n ] " ) ) ) ;
2024-03-30 20:31:28 +00:00
2024-05-28 13:16:13 +01:00
int sharedTemplateMode = field ( " sharedTemplate " ) . toInt ( ) ;
2024-05-29 20:17:11 +01:00
// Create base template
2024-05-28 13:16:13 +01:00
if ( templateSettings . isEmpty ( ) & & sharedTemplateMode ! = 0 ) {
2024-05-20 21:53:28 +01:00
const QString templateBase = QStringLiteral ( " Tmpl.Title=%1 \n Tmpl.Class=Local \n %3=n \n %4=n \n %5=n \n %6=n \n Tmpl.Comment=%2 " )
. arg ( templateTitle , templateComment , " #DisableWizardSettings " , " #RemoveDefaultAll " , " #RemoveDefaultRecovers " , " #RemoveDefaultTemplates " ) ;
2024-03-26 21:39:57 +00:00
theAPI - > SbieIniSet ( templateFullName , " " , templateBase ) ;
}
2024-03-27 18:41:04 +00:00
2024-03-31 20:54:59 +01:00
switch ( sharedTemplateMode )
2024-03-31 18:37:14 +01:00
{
2024-03-30 20:31:28 +00:00
case 1 :
case 2 :
2024-03-31 18:37:14 +01:00
case 3 :
2024-03-30 20:31:28 +00:00
// Remove default settings
if ( removeDefaultRecovers | | removeDefaultAll ) {
pBox - > DelValue ( " RecoverFolder " ) ;
}
if ( removeDefaultTemplates | | removeDefaultAll ) {
pBox - > DelValue ( " Template " ) ;
}
if ( removeDefaultAll ) {
for ( const QString & bLine : boxSettingsLines ) {
2024-05-17 22:20:22 +01:00
int bParts = bLine . indexOf ( " = " , Qt : : SkipEmptyParts ) ;
if ( bParts ! = - 1 ) {
2024-05-20 21:53:28 +01:00
const QString bKey = bLine . mid ( 0 , bParts ) . trimmed ( ) ;
const QString bValue = bLine . mid ( bParts + 1 ) . trimmed ( ) ;
if ( bKey . compare ( " Enabled " , Qt : : CaseInsensitive ) ! = 0 & & bKey . compare ( " ConfigLevel " ) ! = 0 ) { // Do not remove Enabled and ConfigLevel
2024-03-30 20:31:28 +00:00
pBox - > DelValue ( bKey , bValue ) ;
}
}
}
}
break ;
default :
// Default case
break ;
}
2024-05-20 21:53:28 +01:00
if ( sharedTemplateMode = = 1 ) { // Insert as template
const QString insertValue = templateFullName . mid ( 9 ) ; // Template_
2024-03-24 22:19:08 +00:00
pBox - > InsertText ( " Template " , insertValue ) ;
2024-03-23 17:43:54 +00:00
}
2024-05-20 21:53:28 +01:00
else if ( sharedTemplateMode = = 2 ) { // Append template settings to configuration
for ( const QString & tLine : templateSettingsLines ) {
2024-05-17 22:20:22 +01:00
int tParts = tLine . indexOf ( " = " , Qt : : SkipEmptyParts ) ;
if ( tParts = = - 1 ) {
continue ; // Skip lines that don't have at least one '=' character.
2024-03-27 18:41:04 +00:00
}
2024-05-20 21:53:28 +01:00
const QString tKey = tLine . mid ( 0 , tParts ) . trimmed ( ) ;
const QString tValue = tLine . mid ( tParts + 1 ) . trimmed ( ) ;
if ( tKey . compare ( " Enabled " , Qt : : CaseInsensitive ) = = 0 | | tKey . startsWith ( " Tmpl. " ) | | tKey . startsWith ( " # " ) | | tKey . endsWith ( " Disabled " ) ) {
2024-03-30 20:31:28 +00:00
continue ; // Skip lines that start or end with one of these
}
if ( tValue . compare ( " y " , Qt : : CaseInsensitive ) = = 0 | | tValue . compare ( " n " , Qt : : CaseInsensitive ) = = 0 | | SPECIAL_SETTINGS . contains ( tKey ) ) {
2024-03-27 18:41:04 +00:00
pBox - > SetText ( tKey , tValue ) ;
}
else {
pBox - > AppendText ( tKey , tValue ) ;
2024-03-26 21:39:57 +00:00
}
}
}
2024-05-20 21:53:28 +01:00
qDebug ( ) . noquote ( ) . nospace ( ) < < templateName < < " (Mode = " < < sharedTemplateMode < < " ) operation took " < < timer . elapsed ( ) < < " ms " ;
2024-03-30 20:31:28 +00:00
//
2024-03-31 20:54:59 +01:00
if ( ! disableWizardSettings | | sharedTemplateMode = = 0 ) {
2024-03-30 20:31:28 +00:00
switch ( BoxType )
{
case CSandBoxPlus : : eHardenedPlus :
pBox - > SetBool ( " UsePrivacyMode " , true ) ;
case CSandBoxPlus : : eHardened :
pBox - > SetBool ( " UseSecurityMode " , true ) ;
break ;
2024-06-14 17:09:00 +01:00
2024-03-30 20:31:28 +00:00
case CSandBoxPlus : : eDefaultPlus :
pBox - > SetBool ( " UsePrivacyMode " , true ) ;
case CSandBoxPlus : : eDefault :
break ;
2024-06-14 17:09:00 +01:00
2024-03-30 20:31:28 +00:00
case CSandBoxPlus : : eAppBoxPlus :
pBox - > SetBool ( " UsePrivacyMode " , true ) ;
case CSandBoxPlus : : eAppBox :
pBox - > SetBool ( " NoSecurityIsolation " , true ) ;
//pBox->InsertText("Template", "NoUACProxy"); // proxy is always needed for exes in the box
pBox - > InsertText ( " Template " , " RpcPortBindingsExt " ) ;
break ;
}
2024-06-14 17:09:00 +01:00
2024-03-30 20:31:28 +00:00
if ( BlackBox ) {
pBox - > SetBool ( " UseFileImage " , true ) ;
pBox - > SetBool ( " ConfidentialBox " , true ) ;
}
2024-06-14 17:09:00 +01:00
2024-03-30 20:31:28 +00:00
QRgb rgb = theGUI - > GetBoxColor ( BoxType ) ;
pBox - > SetText ( " BorderColor " , QString ( " #%1%2%3 " ) . arg ( qBlue ( rgb ) , 2 , 16 , QChar ( ' 0 ' ) ) . arg ( qGreen ( rgb ) , 2 , 16 , QChar ( ' 0 ' ) ) . arg ( qRed ( rgb ) , 2 , 16 , QChar ( ' 0 ' ) ) + " ,ttl " ) ;
2024-06-14 17:09:00 +01:00
2024-03-30 20:31:28 +00:00
QString Location = field ( " boxLocation " ) . toString ( ) ;
if ( ! Location . isEmpty ( ) ) {
pBox - > SetText ( " FileRootPath " , Location ) ;
theAPI - > UpdateBoxPaths ( pBox . data ( ) ) ;
}
2024-06-14 17:09:00 +01:00
2024-03-30 20:31:28 +00:00
if ( field ( " boxVersion " ) . toInt ( ) = = 1 ) {
pBox - > SetBool ( " UseFileDeleteV2 " , true ) ;
pBox - > SetBool ( " UseRegDeleteV2 " , true ) ;
}
if ( ! field ( " separateUser " ) . toBool ( ) )
pBox - > SetBool ( " SeparateUserFolders " , false ) ;
if ( field ( " useVolumeSN " ) . toBool ( ) )
pBox - > SetBool ( " UseVolumeSerialNumbers " , true ) ;
2024-06-14 17:09:00 +01:00
2024-03-30 20:31:28 +00:00
if ( field ( " autoRemove " ) . toBool ( ) ) {
pBox - > SetBool ( " AutoDelete " , true ) ;
pBox - > SetBool ( " AutoRemove " , true ) ;
}
else if ( field ( " autoDelete " ) . toBool ( ) )
pBox - > SetBool ( " AutoDelete " , true ) ;
if ( field ( " autoRecover " ) . toBool ( ) )
pBox - > SetBool ( " AutoRecover " , true ) ;
2024-06-14 17:09:00 +01:00
2024-03-30 20:31:28 +00:00
if ( field ( " blockNetwork " ) . toInt ( ) = = 1 ) { // device based
//pBox->InsertText("AllowNetworkAccess", "<BlockNetAccess>,n");
pBox - > InsertText ( " ClosedFilePath " , " !<InternetAccess>,InternetAccessDevices " ) ;
//pBox->InsertText("ClosedFilePath", "<BlockNetDevices>,InternetAccessDevices");
}
else if ( field ( " blockNetwork " ) . toInt ( ) = = 2 ) { // using WFP
pBox - > InsertText ( " AllowNetworkAccess " , " !<InternetAccess>,n " ) ;
//pBox->InsertText("AllowNetworkAccess", "<BlockNetAccess>,n");
//pBox->InsertText("ClosedFilePath", "<BlockNetDevices>,InternetAccessDevices");
}
pBox - > SetBool ( " BlockNetworkFiles " , ! field ( " shareAccess " ) . toBool ( ) ) ;
2024-04-25 15:50:32 +01:00
2024-06-14 17:09:00 +01:00
bool bAllowNetwork = field ( " blockNetwork " ) . toInt ( ) = = 0 ;
if ( field ( " promptAccess " ) . toBool ( ) & & ! bAllowNetwork )
pBox - > SetBool ( " PromptForInternetAccess " , true ) ;
2024-06-16 13:08:16 +01:00
bool bHardened = ( BoxType = = CSandBoxPlus : : eHardenedPlus | | BoxType = = CSandBoxPlus : : eHardened ) ;
2024-06-14 17:09:00 +01:00
bool bAppBox = ( BoxType = = CSandBoxPlus : : eAppBoxPlus | | BoxType = = CSandBoxPlus : : eAppBox ) ;
2024-04-25 15:50:32 +01:00
bool bDropAdmin = field ( " dropAdmin " ) . toBool ( ) ;
if ( field ( " dropAdmin " ) . toBool ( ) & & ! bHardened )
2024-03-30 20:31:28 +00:00
pBox - > SetBool ( " DropAdminRights " , true ) ;
2024-04-25 15:50:32 +01:00
if ( field ( " fakeAdmin " ) . toBool ( ) )
2024-03-30 20:31:28 +00:00
pBox - > SetBool ( " FakeAdminRights " , true ) ;
2024-04-25 15:50:32 +01:00
if ( field ( " msiServer " ) . toBool ( ) & & ! bDropAdmin & & ! bHardened )
2024-03-30 20:31:28 +00:00
pBox - > SetBool ( " MsiInstallerExemptions " , true ) ;
2024-04-25 15:50:32 +01:00
2024-06-14 17:09:00 +01:00
if ( field ( " boxToken " ) . toBool ( ) & & ! bAppBox )
2024-03-30 20:31:28 +00:00
pBox - > SetBool ( " SandboxieLogon " , true ) ;
2024-04-25 15:50:32 +01:00
2024-03-30 20:31:28 +00:00
if ( field ( " imagesProtection " ) . toBool ( ) )
pBox - > SetBool ( " ProtectHostImages " , true ) ;
2024-04-25 15:50:32 +01:00
2024-05-18 09:49:20 +01:00
if ( field ( " coverBoxedWindows " ) . toBool ( ) )
pBox - > SetBool ( " CoverBoxedWindows " , true ) ;
2024-05-18 08:02:36 +01:00
2024-03-30 20:31:28 +00:00
if ( ! Password . isEmpty ( ) )
pBox - > ImBoxCreate ( ImageSize / 1024 , Password ) ;
2024-04-25 15:50:32 +01:00
2024-03-30 20:31:28 +00:00
if ( field ( " boxVersion " ) . toInt ( ) = = 1 ) {
if ( theConf - > GetBool ( " Options/WarnDeleteV2 " , true ) ) {
bool State = false ;
CCheckableMessageBox : : question ( this , " Sandboxie-Plus " ,
tr ( " The new sandbox has been created using the new <a href= \" https://sandboxie-plus.com/go.php?to=sbie-delete-v2 \" >Virtualization Scheme Version 2</a>, if you experience any unexpected issues with this box, "
" please switch to the Virtualization Scheme to Version 1 and report the issue, "
" the option to change this preset can be found in the Box Options in the Box Structure group. " )
, tr ( " Don't show this message again. " ) , & State , QDialogButtonBox : : Ok , QDialogButtonBox : : Ok , QMessageBox : : Information ) ;
2024-06-14 17:09:00 +01:00
2024-03-30 20:31:28 +00:00
if ( State )
theConf - > SetValue ( " Options/WarnDeleteV2 " , false ) ;
}
2023-01-29 20:12:58 +00:00
}
}
2024-03-30 20:31:28 +00:00
}
2023-01-28 13:05:37 +00:00
return Status ;
}
QString CNewBoxWizard : : GetDefaultLocation ( )
{
QString DefaultPath = theAPI - > GetGlobalSettings ( ) - > GetText ( " FileRootPath " , " \\ ?? \\ %SystemDrive% \\ Sandbox \\ %USER% \\ %SANDBOX% " , false , false ) ;
// HACK HACK: globally %SANDBOX% evaluates to GlobalSettings
2023-04-09 10:43:10 +01:00
DefaultPath . replace ( " \\ GlobalSettings " , " \\ " + field ( " boxName " ) . toString ( ) . replace ( " " , " _ " ) ) ;
2023-01-28 13:05:37 +00:00
return theAPI - > Nt2DosPath ( DefaultPath ) ;
}
//////////////////////////////////////////////////////////////////////////////////////////
// CBoxTypePage
//
2023-01-29 10:48:28 +00:00
CBoxTypePage : : CBoxTypePage ( bool bAlowTemp , QWidget * parent )
2023-01-28 13:05:37 +00:00
: QWizardPage ( parent )
{
setTitle ( tr ( " Create new Sandbox " ) ) ;
2023-08-27 11:54:54 +01:00
QPixmap Logo = QPixmap ( theGUI - > m_DarkTheme ? " :/SideLogoDM.png " : " :/SideLogo.png " ) ;
int Scaling = theConf - > GetInt ( " Options/FontScaling " , 100 ) ;
if ( Scaling ! = 100 ) Logo = Logo . scaled ( Logo . width ( ) * Scaling / 100 , Logo . height ( ) * Scaling / 100 ) ;
setPixmap ( QWizard : : WatermarkPixmap , Logo ) ;
2023-01-28 13:05:37 +00:00
m_bInstant = theConf - > GetBool ( " Options/InstantBoxWizard " , false ) ;
int row = 0 ;
QGridLayout * layout = new QGridLayout ;
2023-08-22 19:41:38 +01:00
# ifndef USE_COMBO
layout - > setSpacing ( 2 ) ;
QLabel * pTopLabel = new QLabel ( tr ( " A sandbox isolates your host system from processes running within the box, "
" it prevents them from making permanent changes to other programs and data in your computer. " ) ) ;
# else
2023-01-28 13:05:37 +00:00
QLabel * pTopLabel = new QLabel ( tr ( " A sandbox isolates your host system from processes running within the box, "
" it prevents them from making permanent changes to other programs and data in your computer. "
" The level of isolation impacts your security as well as the compatibility with applications, "
" hence there will be a different level of isolation depending on the selected Box Type. "
" Sandboxie can also protect your personal data from being accessed by processes running under its supervision. " ) ) ;
2023-08-22 19:41:38 +01:00
# endif
2023-01-28 13:05:37 +00:00
pTopLabel - > setWordWrap ( true ) ;
layout - > addWidget ( pTopLabel , row + + , 0 , 1 , 3 ) ;
2023-08-22 19:41:38 +01:00
layout - > addItem ( new QSpacerItem ( 0 , 3 ) , row + + , 0 ) ;
2023-01-28 13:05:37 +00:00
layout - > addWidget ( new QLabel ( tr ( " Enter box name: " ) ) , row + + , 0 ) ;
m_pBoxName = new QLineEdit ( ) ;
2023-08-22 19:41:38 +01:00
m_pBoxName - > setMaxLength ( 32 ) ; // BOXNAME_COUNT
m_pBoxName - > setText ( theAPI - > MkNewName ( " New Box " ) ) ;
2023-01-28 13:05:37 +00:00
m_pBoxName - > setFocus ( ) ;
layout - > addWidget ( m_pBoxName , row + + , 1 , 1 , 2 ) ;
registerField ( " boxName " , m_pBoxName ) ;
2023-08-22 19:41:38 +01:00
/*QLabel* pMore = new QLabel(tr("<a href=\"more\">More Types</a>"));
pMore - > setAlignment ( Qt : : AlignRight ) ;
connect ( pMore , SIGNAL ( linkActivated ( const QString & ) ) , this , SLOT ( SnowMore ( ) ) ) ;
layout - > addWidget ( pMore , row , 2 ) ; */
2023-01-31 08:29:55 +00:00
layout - > addWidget ( new QLabel ( tr ( " Select box type: " ) ) , row + + , 0 ) ;
2023-01-28 13:05:37 +00:00
2023-08-22 19:41:38 +01:00
# ifndef USE_COMBO
m_TypeGroup = new QButtonGroup ( ) ;
auto AddBoxType = [ & ] ( const QString & label , int Type , const QString & tip = QString ( ) , bool bCheck = false ) {
2023-12-15 19:59:54 +00:00
QAbstractButton * pC = bCheck ? ( QAbstractButton * ) new QCheckBox ( ) : ( QAbstractButton * ) new QRadioButton ( ) ;
2023-08-23 20:05:11 +01:00
if ( theGUI - > m_DarkTheme ) {
QPalette palette = QApplication : : palette ( ) ;
2023-08-24 11:00:16 +01:00
palette . setColor ( QPalette : : Base , Qt : : white ) ;
2023-08-23 20:05:11 +01:00
palette . setColor ( QPalette : : Text , Qt : : black ) ;
2023-12-15 19:59:54 +00:00
pC - > setPalette ( palette ) ;
2023-08-23 20:05:11 +01:00
}
2023-12-15 19:59:54 +00:00
pC - > setToolTip ( tip ) ;
if ( ! bCheck ) m_TypeGroup - > addButton ( ( QRadioButton * ) pC , Type ) ;
2023-08-22 19:41:38 +01:00
QHBoxLayout * pLayout = new QHBoxLayout ( ) ;
pLayout - > setContentsMargins ( 0 , 0 , 0 , 0 ) ;
pLayout - > setSpacing ( 4 ) ;
2023-12-15 19:59:54 +00:00
pC - > setSizePolicy ( QSizePolicy ( QSizePolicy : : Fixed , QSizePolicy : : Fixed ) ) ;
pLayout - > addWidget ( pC ) ;
2023-08-22 19:41:38 +01:00
QLabel * pLabel = new QLabel ( label ) ;
pLabel - > setToolTip ( tip ) ;
pLayout - > addWidget ( pLabel ) ;
connect ( pLabel , SIGNAL ( linkActivated ( const QString & ) ) , theGUI , SLOT ( OpenUrl ( const QString & ) ) ) ;
2023-12-15 19:59:54 +00:00
QWidget * pW = new QWidget ( ) ;
2023-08-22 19:41:38 +01:00
pW - > setLayout ( pLayout ) ;
layout - > addWidget ( pW , row , 1 , 1 , 2 ) ;
if ( Type ! = - 1 ) {
QLabel * pIcon = new QLabel ( ) ;
pIcon - > setPixmap ( theGUI - > GetBoxIcon ( Type ) . pixmap ( 16 , 16 ) ) ;
pIcon - > setAlignment ( Qt : : AlignRight ) ;
pIcon - > setContentsMargins ( 0 , 2 , 4 , 0 ) ;
pIcon - > setToolTip ( tip ) ;
layout - > addWidget ( pIcon , row , 0 ) ;
}
row + + ;
//return qMakePair(pW, pIcon);
2023-12-15 19:59:54 +00:00
return pC ;
2023-08-22 19:41:38 +01:00
} ;
2024-06-16 13:08:16 +01:00
2023-08-22 19:41:38 +01:00
AddBoxType ( tr ( " <a href= \" sbie://docs/security-mode \" >Security Hardened</a> Sandbox with <a href= \" sbie://docs/privacy-mode \" >Data Protection</a> " ) , ( int ) CSandBoxPlus : : eHardenedPlus ,
tr ( " This box type offers the highest level of protection by significantly reducing the attack surface exposed to sandboxed processes. \n "
" It strictly limits access to user data, allowing processes within this box to only access C: \\ Windows and C: \\ Program Files directories. \n "
" The entire user profile remains hidden, ensuring maximum security. " ) ) ;
AddBoxType ( tr ( " <a href= \" sbie://docs/security-mode \" >Security Hardened</a> Sandbox " ) , ( int ) CSandBoxPlus : : eHardened ,
tr ( " This box type offers the highest level of protection by significantly reducing the attack surface exposed to sandboxed processes. " ) ) ;
AddBoxType ( tr ( " Sandbox with <a href= \" sbie://docs/privacy-mode \" >Data Protection</a> " ) , ( int ) CSandBoxPlus : : eDefaultPlus ,
tr ( " In this box type, sandboxed processes are prevented from accessing any personal user files or data. The focus is on protecting user data, and as such, \n "
" only C: \\ Windows and C: \\ Program Files directories are accessible to processes running within this sandbox. This ensures that personal files remain secure. " ) ) ;
AddBoxType ( tr ( " Standard Sandbox " ) , ( int ) CSandBoxPlus : : eDefault ,
tr ( " This box type offers the default behavior of Sandboxie classic. It provides users with a familiar and reliable sandboxing scheme. \n "
" Applications can be run within this sandbox, ensuring they operate within a controlled and isolated space. " ) ) ;
AddBoxType ( tr ( " <a href= \" sbie://docs/compartment-mode \" >Application Compartment</a> Box with <a href= \" sbie://docs/privacy-mode \" >Data Protection</a> " ) , ( int ) CSandBoxPlus : : eAppBoxPlus ,
tr ( " This box type prioritizes compatibility while still providing a good level of isolation. It is designed for running trusted applications within separate compartments. \n "
" While the level of isolation is reduced compared to other box types, it offers improved compatibility with a wide range of applications, ensuring smooth operation within the sandboxed environment. " ) ) ;
AddBoxType ( tr ( " <a href= \" sbie://docs/compartment-mode \" >Application Compartment</a> Box " ) , ( int ) CSandBoxPlus : : eAppBox ,
tr ( " This box type prioritizes compatibility while still providing a good level of isolation. It is designed for running trusted applications within separate compartments. \n "
" While the level of isolation is reduced compared to other box types, it offers improved compatibility with a wide range of applications, ensuring smooth operation within the sandboxed environment. " ) ) ;
2024-06-14 17:09:00 +01:00
2023-12-15 19:59:54 +00:00
QWidget * pGap = new QWidget ( ) ;
pGap - > setMinimumHeight ( 4 ) ;
layout - > addWidget ( pGap , row + + , 1 , 1 , 2 ) ;
//AddBoxType(tr("<a href=\"sbie://docs/boxencryption\">Encrypted</a> <a href=\"sbie://docs/black-box\">Confidential</a> Box"), (int)CSandBoxPlus::ePrivate,
QWidget * pBlackBox = AddBoxType ( tr ( " <a href= \" sbie://docs/boxencryption \" >Encrypt</a> Box content and set <a href= \" sbie://docs/black-box \" >Confidential</a> " ) , ( int ) CSandBoxPlus : : ePrivate ,
2023-08-24 17:39:00 +01:00
tr ( " In this box type the sandbox uses an encrypted disk image as its root folder. This provides an additional layer of privacy and security. \n "
" Access to the virtual disk when mounted is restricted to programs running within the sandbox. Sandboxie prevents other processes on the host system from accessing the sandboxed processes. \n "
2023-12-15 19:59:54 +00:00
" This ensures the utmost level of privacy and data protection within the confidential sandbox environment. " ) , true ) ;
2023-08-24 17:39:00 +01:00
2023-08-22 19:41:38 +01:00
connect ( m_TypeGroup , SIGNAL ( buttonClicked ( QAbstractButton * ) ) , this , SIGNAL ( typeChanged ( ) ) ) ;
registerField ( " boxType " , this , " currentType " , " typeChanged " ) ;
connect ( m_TypeGroup , SIGNAL ( buttonClicked ( QAbstractButton * ) ) , this , SLOT ( OnBoxTypChanged ( ) ) ) ;
2023-12-15 19:59:54 +00:00
connect ( pBlackBox , SIGNAL ( toggled ( bool ) ) , this , SIGNAL ( typeChanged ( ) ) ) ;
registerField ( " blackBox " , pBlackBox ) ;
connect ( pBlackBox , SIGNAL ( toggled ( bool ) ) , this , SLOT ( OnBoxTypChanged ( ) ) ) ;
2023-08-22 19:41:38 +01:00
//QCheckBox* pMore = new QCheckBox(tr("Show More Types"));
//layout->addWidget(pMore, 4, 3);
//connect(pMore, &QCheckBox::toggled, [=](bool bValue) {
// ...
// });
# else
bool bAll = true ;
2023-01-28 13:05:37 +00:00
m_pBoxType = new QComboBox ( ) ;
m_pBoxType - > addItem ( theGUI - > GetBoxIcon ( CSandBoxPlus : : eHardenedPlus ) , tr ( " Hardened Sandbox with Data Protection " ) , ( int ) CSandBoxPlus : : eHardenedPlus ) ;
2023-08-22 19:41:38 +01:00
if ( bAll ) m_pBoxType - > addItem ( theGUI - > GetBoxIcon ( CSandBoxPlus : : eHardened ) , tr ( " Security Hardened Sandbox " ) , ( int ) CSandBoxPlus : : eHardened ) ;
2023-01-28 13:05:37 +00:00
m_pBoxType - > addItem ( theGUI - > GetBoxIcon ( CSandBoxPlus : : eDefaultPlus ) , tr ( " Sandbox with Data Protection " ) , ( int ) CSandBoxPlus : : eDefaultPlus ) ;
m_pBoxType - > addItem ( theGUI - > GetBoxIcon ( CSandBoxPlus : : eDefault ) , tr ( " Standard Isolation Sandbox (Default) " ) , ( int ) CSandBoxPlus : : eDefault ) ;
//m_pBoxType->addItem(theGUI->GetBoxIcon(CSandBoxPlus::eInsecure), tr("INSECURE Configuration (please change)"), (int)CSandBoxPlus::eInsecure);
2023-08-22 19:41:38 +01:00
if ( bAll ) m_pBoxType - > addItem ( theGUI - > GetBoxIcon ( CSandBoxPlus : : eAppBoxPlus ) , tr ( " Application Compartment with Data Protection " ) , ( int ) CSandBoxPlus : : eAppBoxPlus ) ;
m_pBoxType - > addItem ( theGUI - > GetBoxIcon ( CSandBoxPlus : : eAppBox ) , tr ( " Application Compartment Box " ) , ( int ) CSandBoxPlus : : eAppBox ) ;
2023-08-24 17:39:00 +01:00
m_pBoxType - > addItem ( theGUI - > GetBoxIcon ( CSandBoxPlus : : ePrivate ) , tr ( " Confidential Encrypted Box " ) , ( int ) CSandBoxPlus : : ePrivate ) ;
2023-01-28 13:05:37 +00:00
connect ( m_pBoxType , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( OnBoxTypChanged ( ) ) ) ;
layout - > addWidget ( m_pBoxType , row + + , 1 , 1 , 2 ) ;
2023-08-22 19:41:38 +01:00
registerField ( " boxType " , m_pBoxType , " currentData " , " currentIndexChanged " ) ;
2023-01-28 13:05:37 +00:00
m_pInfoLabel = new QLabel ( ) ;
m_pInfoLabel - > setWordWrap ( true ) ;
2023-05-25 17:54:52 +01:00
//m_pInfoLabel->setOpenExternalLinks(true);
connect ( m_pInfoLabel , SIGNAL ( linkActivated ( const QString & ) ) , theGUI , SLOT ( OpenUrl ( const QString & ) ) ) ;
2023-01-28 13:05:37 +00:00
layout - > addWidget ( m_pInfoLabel , row + + , 0 , 1 , 3 ) ;
m_pBoxType - > setCurrentIndex ( 3 ) ; // default
2023-08-22 19:41:38 +01:00
# endif
2023-01-28 13:05:37 +00:00
QWidget * pSpacer = new QWidget ( ) ;
pSpacer - > setSizePolicy ( QSizePolicy : : Expanding , QSizePolicy : : Expanding ) ;
layout - > addWidget ( pSpacer , row + + , 1 ) ;
2023-01-29 09:49:41 +00:00
QCheckBox * pTemp = new QCheckBox ( tr ( " Remove after use " ) ) ;
pTemp - > setToolTip ( tr ( " After the last process in the box terminates, all data in the box will be deleted and the box itself will be removed. " ) ) ;
layout - > addWidget ( pTemp , row , 0 , 1 , 2 ) ;
2023-01-29 10:48:28 +00:00
pTemp - > setVisible ( bAlowTemp ) ;
2023-01-29 09:49:41 +00:00
registerField ( " autoRemove " , pTemp ) ;
2023-01-28 13:05:37 +00:00
m_pAdvanced = new QCheckBox ( tr ( " Configure advanced options " ) ) ;
2023-08-24 17:39:00 +01:00
if ( theGUI - > m_DarkTheme ) {
QPalette palette = QApplication : : palette ( ) ;
palette . setColor ( QPalette : : Base , Qt : : white ) ;
palette . setColor ( QPalette : : Text , Qt : : black ) ;
m_pAdvanced - > setPalette ( palette ) ;
}
2023-08-22 19:41:38 +01:00
layout - > addWidget ( m_pAdvanced , row + + , 2 , 1 , 1 ) ;
2023-01-28 13:05:37 +00:00
connect ( m_pAdvanced , SIGNAL ( toggled ( bool ) ) , this , SLOT ( OnAdvanced ( ) ) ) ;
setLayout ( layout ) ;
}
2024-01-06 17:02:43 +00:00
void CBoxTypePage : : initializePage ( )
{
m_pAdvanced - > setChecked ( ( ( CNewBoxWizard * ) wizard ( ) ) - > m_bAdvanced ) ;
}
2023-08-22 19:41:38 +01:00
void CBoxTypePage : : setCurrentType ( int type )
{
if ( m_TypeGroup - > buttons ( ) . count ( ) < type )
m_TypeGroup - > button ( type ) - > setChecked ( true ) ;
}
int CBoxTypePage : : currentType ( )
{
return m_TypeGroup - > checkedId ( ) ;
}
2023-01-28 13:05:37 +00:00
void CBoxTypePage : : OnBoxTypChanged ( )
{
2023-08-22 19:41:38 +01:00
# ifndef USE_COMBO
int BoxType = m_TypeGroup - > checkedId ( ) ;
2023-12-15 19:59:54 +00:00
bool BlackBox = field ( " blackBox " ) . toBool ( ) ;
2023-08-22 19:41:38 +01:00
# else
2023-01-28 13:05:37 +00:00
int BoxType = m_pBoxType - > currentData ( ) . toInt ( ) ;
2023-12-15 19:59:54 +00:00
bool BlackBox = CSandBoxPlus : : ePrivate ;
2023-01-28 13:05:37 +00:00
m_pInfoLabel - > setText ( theGUI - > GetBoxDescription ( BoxType ) ) ;
2023-08-22 19:41:38 +01:00
# endif
2023-01-28 13:05:37 +00:00
2023-12-15 19:59:54 +00:00
if ( BoxType ! = CSandBoxPlus : : eDefault | | BlackBox )
2024-08-27 15:34:36 +01:00
theGUI - > CheckCertificate ( this , BlackBox ? 1 : 0 ) ;
2023-08-22 19:41:38 +01:00
emit completeChanged ( ) ;
2023-01-28 13:05:37 +00:00
}
void CBoxTypePage : : OnAdvanced ( )
{
( ( CNewBoxWizard * ) wizard ( ) ) - > m_bAdvanced = m_pAdvanced - > isChecked ( ) ;
if ( m_bInstant )
{
QString BoxName = m_pBoxName - > text ( ) ;
2023-08-25 10:59:50 +01:00
# ifdef USE_COMBO
2023-01-28 13:05:37 +00:00
int BoxType = m_pBoxType - > currentIndex ( ) ;
2023-08-25 10:59:50 +01:00
# endif
2023-01-28 13:05:37 +00:00
wizard ( ) - > restart ( ) ;
m_pBoxName - > setText ( BoxName ) ;
2023-08-25 10:59:50 +01:00
# ifdef USE_COMBO
2023-01-28 13:05:37 +00:00
m_pBoxType - > setCurrentIndex ( BoxType ) ;
2023-08-25 10:59:50 +01:00
# endif
2023-01-28 13:05:37 +00:00
}
}
int CBoxTypePage : : nextId ( ) const
{
if ( ! m_pAdvanced - > isChecked ( ) ) {
if ( m_bInstant )
return - 1 ;
return CNewBoxWizard : : Page_Summary ;
}
return CNewBoxWizard : : Page_Files ;
}
bool CBoxTypePage : : isComplete ( ) const
{
2023-08-22 19:41:38 +01:00
# ifndef USE_COMBO
if ( m_TypeGroup - > checkedId ( ) = = - 1 )
return false ;
# endif
2023-01-28 13:05:37 +00:00
return true ;
}
bool CBoxTypePage : : validatePage ( )
{
QString BoxName = field ( " boxName " ) . toString ( ) ;
if ( ! theGUI - > GetBoxView ( ) - > TestNameAndWarn ( BoxName ) )
return false ;
2023-08-24 17:39:00 +01:00
# ifndef USE_COMBO
int BoxType = m_TypeGroup - > checkedId ( ) ;
2023-12-15 19:59:54 +00:00
bool BlackBox = field ( " blackBox " ) . toBool ( ) ;
2023-08-24 17:39:00 +01:00
# else
int BoxType = m_pBoxType - > currentData ( ) . toInt ( ) ;
2023-12-15 19:59:54 +00:00
bool BlackBox = ( BoxType = = CSandBoxPlus : : ePrivate | | BoxType = = CSandBoxPlus : : ePrivatePlus ) ;
2023-08-24 17:39:00 +01:00
# endif
2023-12-15 19:59:54 +00:00
if ( BlackBox & & ! theGUI - > IsImDiskReady ( ) ) {
2023-12-15 20:14:59 +00:00
theGUI - > GetAddonManager ( ) - > TryInstallAddon ( " ImDisk " , this , tr ( " To use encrypted boxes you need to install the ImDisk driver, do you want to download and install it? " ) ) ;
2023-08-24 17:39:00 +01:00
return false ;
}
2023-01-28 13:05:37 +00:00
if ( m_bInstant & & ! m_pAdvanced - > isChecked ( ) )
return ! ( ( CNewBoxWizard * ) wizard ( ) ) - > TryToCreateBox ( ) . IsError ( ) ;
2023-08-22 19:41:38 +01:00
2023-01-28 13:05:37 +00:00
return true ;
}
//////////////////////////////////////////////////////////////////////////////////////////
// CFilesPage
//
CFilesPage : : CFilesPage ( QWidget * parent )
: QWizardPage ( parent )
{
2023-01-31 08:29:55 +00:00
setTitle ( tr ( " Sandbox location and behavior " ) ) ;
setSubTitle ( tr ( " On this page the sandbox location and its behavior can be customized. \n You can use %USER% to save each users sandbox to an own folder. " ) ) ;
2023-01-28 13:05:37 +00:00
int row = 0 ;
QGridLayout * layout = new QGridLayout ;
QLabel * pFileLabel = new QLabel ( tr ( " Sandboxed Files " ) , this ) ;
QFont fnt = pFileLabel - > font ( ) ;
fnt . setBold ( true ) ;
//fnt.setWeight(QFont::DemiBold);
pFileLabel - > setFont ( fnt ) ;
layout - > addWidget ( pFileLabel , row + + , 0 ) ;
layout - > addItem ( new QSpacerItem ( 40 , 20 , QSizePolicy : : Expanding , QSizePolicy : : Minimum ) , 0 , 2 , 1 , 1 ) ;
2024-06-14 17:09:00 +01:00
2023-01-28 13:05:37 +00:00
// Location
QLineEdit * pDummy = new QLineEdit ( ) ;
pDummy - > setVisible ( false ) ;
layout - > addWidget ( pDummy , row , 0 ) ;
registerField ( " boxLocation " , pDummy ) ;
QHBoxLayout * pLayout = new QHBoxLayout ( ) ;
pLayout - > setContentsMargins ( 0 , 0 , 0 , 0 ) ;
m_pBoxLocation = new QComboBox ( ) ;
m_pBoxLocation - > setEditable ( true ) ;
pLayout - > addWidget ( m_pBoxLocation ) ;
QPushButton * pButton = new QPushButton ( " ... " ) ;
pButton - > setMaximumWidth ( 25 ) ;
connect ( pButton , & QPushButton : : clicked , [ & ] ( ) {
QString FilePath = QFileDialog : : getExistingDirectory ( this , tr ( " Select Directory " ) ) ;
if ( ! FilePath . isEmpty ( ) )
this - > m_pBoxLocation - > setCurrentText ( FilePath . replace ( " / " , " \\ " ) ) ;
} ) ;
pLayout - > addWidget ( pButton ) ;
layout - > addLayout ( pLayout , row + + , 1 , 1 , 3 ) ;
//
QLabel * pVersionLbl = new QLabel ( tr ( " Virtualization scheme " ) , this ) ;
layout - > addWidget ( pVersionLbl , row , 1 ) ;
QComboBox * pVersion = new QComboBox ( ) ;
pVersion - > addItem ( tr ( " Version 1 " ) ) ;
pVersion - > addItem ( tr ( " Version 2 " ) ) ;
layout - > addWidget ( pVersion , row + + , 2 ) ;
pVersion - > setCurrentIndex ( theConf - > GetInt ( " BoxDefaults/BoxScheme " , 2 ) - 1 ) ; // V2 default
layout - > addItem ( new QSpacerItem ( 40 , 20 , QSizePolicy : : Expanding , QSizePolicy : : Minimum ) , 0 , 3 , 1 , 1 ) ;
registerField ( " boxVersion " , pVersion ) ;
QCheckBox * pUserFolders = new QCheckBox ( tr ( " Separate user folders " ) ) ;
pUserFolders - > setChecked ( theConf - > GetBool ( " BoxDefaults/SeparateUser " , true ) ) ;
layout - > addWidget ( pUserFolders , row + + , 2 , 1 , 2 ) ;
registerField ( " separateUser " , pUserFolders ) ;
QCheckBox * pUseVolumeSN = new QCheckBox ( tr ( " Use volume serial numbers for drives " ) ) ;
pUseVolumeSN - > setChecked ( theConf - > GetBool ( " BoxDefaults/UseVolumeSN " , false ) ) ;
layout - > addWidget ( pUseVolumeSN , row + + , 2 , 1 , 2 ) ;
registerField ( " useVolumeSN " , pUseVolumeSN ) ;
QCheckBox * pAutoDelete = new QCheckBox ( tr ( " Auto delete content when last process terminates " ) ) ;
pAutoDelete - > setChecked ( theConf - > GetBool ( " BoxDefaults/AutoDelete " , false ) ) ;
layout - > addWidget ( pAutoDelete , row + + , 1 , 1 , 3 ) ;
2023-01-29 09:49:41 +00:00
if ( field ( " autoRemove " ) . toBool ( ) )
pAutoDelete - > setEnabled ( false ) ;
2023-01-28 13:05:37 +00:00
registerField ( " autoDelete " , pAutoDelete ) ;
QCheckBox * pAutoRecover = new QCheckBox ( tr ( " Enable Immediate Recovery of files from recovery locations " ) ) ;
pAutoRecover - > setChecked ( theConf - > GetBool ( " BoxDefaults/AutoRecover " , true ) ) ;
layout - > addWidget ( pAutoRecover , row + + , 1 , 1 , 3 ) ;
registerField ( " autoRecover " , pAutoRecover ) ;
setLayout ( layout ) ;
int size = 16.0 ;
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
size * = ( QApplication : : desktop ( ) - > logicalDpiX ( ) / 96.0 ) ; // todo Qt6
# endif
AddIconToLabel ( pFileLabel , CSandMan : : GetIcon ( " Folder " ) . pixmap ( size , size ) ) ;
}
int CFilesPage : : nextId ( ) const
{
2024-05-20 19:49:03 +01:00
return CNewBoxWizard : : Page_Isolation ;
2023-01-28 13:05:37 +00:00
}
2024-06-14 17:09:00 +01:00
2023-01-28 13:05:37 +00:00
void CFilesPage : : initializePage ( )
{
m_pBoxLocation - > clear ( ) ;
QString Location = theAPI - > GetGlobalSettings ( ) - > GetText ( " FileRootPath " , " \\ ?? \\ %SystemDrive% \\ Sandbox \\ %USER% \\ %SANDBOX% " ) ;
m_pBoxLocation - > addItem ( Location /*.replace("%SANDBOX%", field("boxName").toString())*/ ) ;
2024-09-15 12:30:11 +01:00
QStringList StdLocations = QStringList ( )
< < " \\ ?? \\ %SystemDrive% \\ Sandbox \\ %USER% \\ %SANDBOX% "
< < " \\ ?? \\ %SystemDrive% \\ Sandbox \\ %SANDBOX% "
< < " \\ ?? \\ %SystemDrive% \\ Users \\ %USER% \\ Sandbox \\ %SANDBOX% " ;
foreach ( auto StdLocation , StdLocations ) {
if ( StdLocation ! = Location )
m_pBoxLocation - > addItem ( StdLocation ) ;
}
2023-01-28 13:05:37 +00:00
}
bool CFilesPage : : validatePage ( )
{
QString Location = m_pBoxLocation - > currentText ( ) ;
if ( Location = = m_pBoxLocation - > itemText ( 0 ) )
wizard ( ) - > setField ( " boxLocation " , " " ) ;
else {
if ( Location . mid ( 2 ) . contains ( QRegularExpression ( " [ <>: \" / \\ |?* \\ [ \\ ]] " ) ) ) {
2023-01-31 08:29:55 +00:00
QMessageBox : : critical ( this , " Sandboxie-Plus " , tr ( " The selected box location is not a valid path. " ) ) ;
2023-01-28 13:05:37 +00:00
return false ;
}
QDir Dir ( Location ) ;
if ( Dir . exists ( ) & & ! Dir . entryList ( QDir : : NoDotAndDotDot | QDir : : AllEntries ) . isEmpty ( ) ) {
2023-01-31 08:29:55 +00:00
if ( QMessageBox : : warning ( this , " Sandboxie-Plus " , tr ( " The selected box location exists and is not empty, it is recommended to pick a new or empty folder. "
2023-01-28 13:05:37 +00:00
" Are you sure you want to use an existing folder? " ) , QDialogButtonBox : : Yes , QDialogButtonBox : : No ) ! = QDialogButtonBox : : Yes )
return false ;
}
if ( ! QDir ( ) . exists ( Location . left ( 3 ) ) ) {
2023-04-05 20:38:53 +01:00
QMessageBox : : critical ( this , " Sandboxie-Plus " , tr ( " The selected box location is not placed on a currently available drive. " ) ) ;
2023-01-28 13:05:37 +00:00
return false ;
}
wizard ( ) - > setField ( " boxLocation " , Location ) ;
}
return true ;
}
//////////////////////////////////////////////////////////////////////////////////////////
2024-05-20 19:49:03 +01:00
// CIsolationPage
2023-01-28 13:05:37 +00:00
//
2024-05-20 19:49:03 +01:00
CIsolationPage : : CIsolationPage ( QWidget * parent )
2023-01-28 13:05:37 +00:00
: QWizardPage ( parent )
{
2024-05-20 19:49:03 +01:00
setTitle ( tr ( " Sandbox Isolation options " ) ) ;
setSubTitle ( tr ( " On this page sandbox isolation options can be configured. " ) ) ;
2023-01-28 13:05:37 +00:00
int row = 0 ;
QGridLayout * layout = new QGridLayout ;
QLabel * pNetLabel = new QLabel ( tr ( " Network Access " ) , this ) ;
QFont fnt = pNetLabel - > font ( ) ;
fnt . setBold ( true ) ;
//fnt.setWeight(QFont::DemiBold);
pNetLabel - > setFont ( fnt ) ;
layout - > addWidget ( pNetLabel , row + + , 0 ) ;
QComboBox * pNetAccess = new QComboBox ( ) ;
pNetAccess - > addItem ( tr ( " Allow network/internet access " ) ) ;
pNetAccess - > addItem ( tr ( " Block network/internet by denying access to Network devices " ) ) ;
2023-05-21 13:48:58 +01:00
if ( theGUI - > IsWFPEnabled ( ) )
2023-01-28 13:05:37 +00:00
pNetAccess - > addItem ( tr ( " Block network/internet using Windows Filtering Platform " ) ) ;
pNetAccess - > setCurrentIndex ( theConf - > GetInt ( " BoxDefaults/BlockNetwork " , 0 ) ) ;
layout - > addWidget ( pNetAccess , row + + , 1 , 1 , 3 ) ;
2024-06-14 17:09:00 +01:00
connect ( pNetAccess , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( OnBlockNetworkChanged ( int ) ) ) ;
2023-01-28 13:05:37 +00:00
registerField ( " blockNetwork " , pNetAccess ) ;
2023-01-31 08:29:55 +00:00
m_pShareAccess = new QCheckBox ( tr ( " Allow access to network files and folders " ) ) ;
m_pShareAccess - > setToolTip ( tr ( " This option is not recommended for Hardened boxes " ) ) ;
2023-01-28 13:05:37 +00:00
m_pShareAccess - > setChecked ( theConf - > GetBool ( " BoxDefaults/ShareAccess " , false ) ) ;
layout - > addWidget ( m_pShareAccess , row + + , 1 , 1 , 3 ) ;
registerField ( " shareAccess " , m_pShareAccess ) ;
2024-06-14 17:09:00 +01:00
m_pPromptAccess = new QCheckBox ( tr ( " Prompt user whether to allow an exemption from the blockade " ) ) ;
m_pPromptAccess - > setChecked ( theConf - > GetBool ( " BoxDefaults/PromptAccess " , false ) ) ;
layout - > addWidget ( m_pPromptAccess , row + + , 1 , 1 , 3 ) ;
registerField ( " promptAccess " , m_pPromptAccess ) ;
2023-01-28 13:05:37 +00:00
QLabel * pAdminLabel = new QLabel ( tr ( " Admin Options " ) , this ) ;
pAdminLabel - > setFont ( fnt ) ;
layout - > addWidget ( pAdminLabel , row + + , 0 ) ;
2024-04-25 15:50:32 +01:00
m_pDropAdmin = new QCheckBox ( tr ( " Drop rights from Administrators and Power Users groups " ) ) ;
m_pDropAdmin - > setChecked ( theConf - > GetBool ( " BoxDefaults/DropAdmin " , false ) ) ;
layout - > addWidget ( m_pDropAdmin , row + + , 1 , 1 , 3 ) ;
2024-05-20 19:49:03 +01:00
connect ( m_pDropAdmin , & QCheckBox : : stateChanged , this , & CIsolationPage : : OnDropAdminChanged ) ;
2024-04-25 15:50:32 +01:00
registerField ( " dropAdmin " , m_pDropAdmin ) ;
2023-01-28 13:05:37 +00:00
QCheckBox * pFakeAdmin = new QCheckBox ( tr ( " Make applications think they are running elevated " ) ) ;
pFakeAdmin - > setChecked ( theConf - > GetBool ( " BoxDefaults/FakeAdmin " , false ) ) ;
layout - > addWidget ( pFakeAdmin , row + + , 1 , 1 , 3 ) ;
registerField ( " fakeAdmin " , pFakeAdmin ) ;
m_pMSIServer = new QCheckBox ( tr ( " Allow MSIServer to run with a sandboxed system token " ) ) ;
2023-01-31 08:29:55 +00:00
m_pMSIServer - > setToolTip ( tr ( " This option is not recommended for Hardened boxes " ) ) ;
2024-04-25 15:50:32 +01:00
if ( ! theConf - > GetBool ( " BoxDefaults/DropAdmin " , false ) )
m_pMSIServer - > setChecked ( theConf - > GetBool ( " BoxDefaults/MsiExemptions " , false ) ) ;
2023-01-28 13:05:37 +00:00
layout - > addWidget ( m_pMSIServer , row + + , 1 , 1 , 3 ) ;
registerField ( " msiServer " , m_pMSIServer ) ;
2024-05-22 14:09:18 +01:00
QLabel * pBoxLabel = new QLabel ( tr ( " Box Options " ) , this ) ;
pBoxLabel - > setFont ( fnt ) ;
layout - > addWidget ( pBoxLabel , row + + , 0 ) ;
m_pBoxToken = new QCheckBox ( tr ( " Use a Sandboxie login instead of an anonymous token " ) ) ;
m_pBoxToken - > setToolTip ( tr ( " Using a custom Sandboxie Token allows to isolate individual sandboxes from each other better, and it shows in the user column of task managers the name of the box a process belongs to. Some 3rd party security solutions may however have problems with custom tokens. " ) ) ;
m_pBoxToken - > setChecked ( theConf - > GetBool ( " BoxDefaults/BoxToken " , false ) ) ;
layout - > addWidget ( m_pBoxToken , row + + , 1 , 1 , 3 ) ;
registerField ( " boxToken " , m_pBoxToken ) ;
2024-05-20 19:49:03 +01:00
setLayout ( layout ) ;
int size = 16.0 ;
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
size * = ( QApplication : : desktop ( ) - > logicalDpiX ( ) / 96.0 ) ; // todo Qt6
# endif
AddIconToLabel ( pNetLabel , CSandMan : : GetIcon ( " Network " ) . pixmap ( size , size ) ) ;
AddIconToLabel ( pAdminLabel , CSandMan : : GetIcon ( " Shield9 " ) . pixmap ( size , size ) ) ;
2024-05-22 14:09:18 +01:00
AddIconToLabel ( pBoxLabel , CSandMan : : GetIcon ( " Sandbox " ) . pixmap ( size , size ) ) ;
2024-05-20 19:49:03 +01:00
}
int CIsolationPage : : nextId ( ) const
{
return CNewBoxWizard : : Page_Advanced ;
}
2024-06-14 17:09:00 +01:00
2024-05-20 19:49:03 +01:00
void CIsolationPage : : initializePage ( )
{
int BoxType = wizard ( ) - > field ( " boxType " ) . toInt ( ) ;
2024-06-16 13:08:16 +01:00
bool bHardened = ( BoxType = = CSandBoxPlus : : eHardenedPlus | | BoxType = = CSandBoxPlus : : eHardened ) ;
2024-05-20 19:49:03 +01:00
bool bDropAdmin = field ( " dropAdmin " ) . toBool ( ) ;
m_pMSIServer - > setEnabled ( ! bHardened & & ! bDropAdmin ) ;
m_pShareAccess - > setEnabled ( ! bHardened ) ;
m_pDropAdmin - > setEnabled ( ! bHardened ) ;
m_pDropAdmin - > setChecked ( bDropAdmin | | bHardened ) ;
2024-05-22 14:09:18 +01:00
bool bAppBox = ( BoxType = = CSandBoxPlus : : eAppBoxPlus | | BoxType = = CSandBoxPlus : : eAppBox ) ;
2024-06-14 17:09:00 +01:00
bool bBoxToken = field ( " boxToken " ) . toBool ( ) ;
2024-05-22 14:09:18 +01:00
m_pBoxToken - > setEnabled ( ! bAppBox ) ;
2024-06-14 17:09:00 +01:00
m_pBoxToken - > setChecked ( ! bAppBox & & bBoxToken ) ;
bool bAllowNetwork = field ( " blockNetwork " ) . toInt ( ) = = 0 ;
bool bPromptAccess = field ( " promptAccess " ) . toBool ( ) ;
m_pPromptAccess - > setEnabled ( ! bAllowNetwork ) ;
m_pPromptAccess - > setChecked ( ! bAllowNetwork & & bPromptAccess ) ;
2024-05-20 19:49:03 +01:00
}
bool CIsolationPage : : validatePage ( )
{
return true ;
}
void CIsolationPage : : OnDropAdminChanged ( int state ) {
// If m_pDropAdmin is checked, disable m_pMSIServer
if ( state = = Qt : : Checked ) {
m_pMSIServer - > setEnabled ( false ) ;
m_pMSIServer - > setChecked ( false ) ;
}
else {
// If m_pDropAdmin is unchecked, enable m_pMSIServer
m_pMSIServer - > setEnabled ( true ) ;
2024-06-14 17:09:00 +01:00
m_pMSIServer - > setChecked ( theConf - > GetBool ( " BoxDefaults/MsiExemptions " , false ) ) ;
}
}
void CIsolationPage : : OnBlockNetworkChanged ( int index ) {
if ( index = = 0 ) {
// If network access is allowed, disable m_pPromptAccess
m_pPromptAccess - > setEnabled ( false ) ;
m_pPromptAccess - > setChecked ( false ) ;
}
else {
// If network access is blocked, enable m_pPromptAccess
m_pPromptAccess - > setEnabled ( true ) ;
m_pPromptAccess - > setChecked ( theConf - > GetBool ( " BoxDefaults/PromptAccess " , false ) ) ;
2024-05-20 19:49:03 +01:00
}
}
//////////////////////////////////////////////////////////////////////////////////////////
// CAdvancedPage
//
CAdvancedPage : : CAdvancedPage ( QWidget * parent )
: QWizardPage ( parent )
{
setTitle ( tr ( " Advanced Sandbox options " ) ) ;
setSubTitle ( tr ( " On this page advanced sandbox options can be configured. " ) ) ;
int row = 0 ;
QGridLayout * layout = new QGridLayout ;
2024-05-22 14:09:18 +01:00
QLabel * pBoxLabel = new QLabel ( tr ( " Advanced Options " ) , this ) ;
2024-05-20 19:49:03 +01:00
QFont fnt = pBoxLabel - > font ( ) ;
fnt . setBold ( true ) ;
//fnt.setWeight(QFont::DemiBold);
2023-04-15 14:14:52 +01:00
pBoxLabel - > setFont ( fnt ) ;
layout - > addWidget ( pBoxLabel , row + + , 0 ) ;
2024-05-22 14:09:18 +01:00
QCheckBox * pImageProtection = new QCheckBox ( tr ( " Prevent sandboxed programs on the host from loading sandboxed DLLs " ) ) ;
2023-04-30 17:36:42 +01:00
pImageProtection - > setToolTip ( tr ( " This feature may reduce compatibility as it also prevents box located processes from writing to host located ones and even starting them. " ) ) ;
2023-04-29 10:55:43 +01:00
pImageProtection - > setChecked ( theConf - > GetBool ( " BoxDefaults/ImagesProtection " , false ) ) ;
2023-07-11 21:35:59 +01:00
pImageProtection - > setEnabled ( g_CertInfo . active ) ;
2023-04-29 10:55:43 +01:00
layout - > addWidget ( pImageProtection , row + + , 1 , 1 , 3 ) ;
registerField ( " imagesProtection " , pImageProtection ) ;
2024-05-28 14:52:16 +01:00
QCheckBox * pWindowCover = new QCheckBox ( tr ( " Prevent sandboxed windows from being captured " ) ) ;
2024-05-18 08:07:59 +01:00
pWindowCover - > setToolTip ( tr ( " This feature can cause a decline in the user experience because it also prevents normal screenshots. " ) ) ;
pWindowCover - > setChecked ( theConf - > GetBool ( " BoxDefaults/CoverBoxedWindows " , false ) ) ;
layout - > addWidget ( pWindowCover , row + + , 1 , 1 , 3 ) ;
registerField ( " coverBoxedWindows " , pWindowCover ) ;
2024-05-18 08:00:49 +01:00
2024-03-31 18:37:14 +01:00
QString SharedTemplateName = tr ( " Shared Template " ) ;
QLabel * pSharedTemplateLbl = new QLabel ( tr ( " Shared template mode " ) , this ) ;
2024-03-26 21:39:57 +00:00
pSharedTemplateLbl - > setToolTip ( tr ( " This setting adds a local template or its settings to the sandbox configuration so that the settings in that template are shared between sandboxes. "
" \n However, if 'use as a template' option is selected as the sharing mode, some settings may not be reflected in the user interface. "
2024-03-31 18:37:14 +01:00
" \n To change the template's settings, simply locate the '%1' template in the App Templates list under Sandbox Options, then double-click on it to edit it. "
" \n To disable this template for a sandbox, simply uncheck it in the template list. " ) . arg ( SharedTemplateName ) ) ;
2024-03-26 21:39:57 +00:00
layout - > addWidget ( pSharedTemplateLbl , row , 1 ) ;
2024-03-31 18:37:14 +01:00
QString SharedTemplateTip0 = tr ( " This option does not add any settings to the box configuration and does not remove the default box settings based on the removal settings within the template. " ) ;
QString SharedTemplateTip1 = tr ( " This option adds the shared template to the box configuration as a local template and may also remove the default box settings based on the removal settings within the template. " ) ;
2024-03-31 19:16:53 +01:00
QString SharedTemplateTip2 = tr ( " This option adds the settings from the shared template to the box configuration and may also remove the default box settings based on the removal settings within the template. " ) ;
2024-03-31 18:37:14 +01:00
QString SharedTemplateTip3 = tr ( " This option does not add any settings to the box configuration, but may remove the default box settings based on the removal settings within the template. " ) ;
2024-08-31 11:07:16 +01:00
m_pSharedTemplate = new QComboBox ( ) ;
m_pSharedTemplate - > addItem ( tr ( " Disabled " ) ) ;
m_pSharedTemplate - > setItemData ( 0 , SharedTemplateTip0 , Qt : : ToolTipRole ) ;
m_pSharedTemplate - > addItem ( tr ( " Use as a template " ) ) ;
m_pSharedTemplate - > setItemData ( 1 , SharedTemplateTip1 , Qt : : ToolTipRole ) ;
m_pSharedTemplate - > addItem ( tr ( " Append to the configuration " ) ) ;
m_pSharedTemplate - > setItemData ( 2 , SharedTemplateTip2 , Qt : : ToolTipRole ) ;
m_pSharedTemplate - > addItem ( tr ( " Remove defaults if set " ) ) ;
m_pSharedTemplate - > setItemData ( 3 , SharedTemplateTip3 , Qt : : ToolTipRole ) ;
layout - > addWidget ( m_pSharedTemplate , row + + , 2 ) ;
m_pSharedTemplate - > setCurrentIndex ( theConf - > GetInt ( " BoxDefaults/SharedTemplate " , 0 ) ) ;
2024-03-31 18:37:14 +01:00
layout - > addItem ( new QSpacerItem ( 40 , 20 , QSizePolicy : : Expanding , QSizePolicy : : Minimum ) , 0 , 4 , 1 , 1 ) ;
2024-08-31 11:07:16 +01:00
registerField ( " sharedTemplate " , m_pSharedTemplate ) ;
QLabel * pSharedTemplateIndexLbl = new QLabel ( tr ( " Shared template selection " ) , this ) ;
layout - > addWidget ( pSharedTemplateIndexLbl , row , 1 ) ;
m_pSharedTemplateIndex = new QComboBox ( ) ;
QStringList templateOptions ;
QStringList templateToolTips ;
for ( int i = 0 ; i < = 9 ; + + i ) {
QString templateName = ( i = = 0 )
? QString ( " SharedTemplate " )
: QString ( " SharedTemplate_%1 " ) . arg ( i ) ;
QString templateFullName = " Template_Local_ " + templateName ;
QString templateTitle = theAPI - > SbieIniGetEx ( templateFullName , " Tmpl.Title " ) ;
// Determine the template name, including the index if not zero
QString templateNameCustom = templateTitle . isEmpty ( )
? ( i = = 0 ? SharedTemplateName : SharedTemplateName + " " + QString : : number ( i ) )
: templateTitle ;
templateOptions < < templateNameCustom ;
// Set tooltip text using the combined template name
QString toolTipText = tr ( " This option specifies the template to be used in shared template mode. (%1) " ) . arg ( templateFullName ) ;
templateToolTips < < toolTipText ;
}
// Set options to the combobox
m_pSharedTemplateIndex - > addItems ( templateOptions ) ;
// Set tooltips for each item
for ( int i = 0 ; i < templateOptions . size ( ) ; + + i ) {
m_pSharedTemplateIndex - > setItemData ( i , templateToolTips [ i ] , Qt : : ToolTipRole ) ;
}
layout - > addWidget ( m_pSharedTemplateIndex , row + + , 2 ) ;
m_pSharedTemplateIndex - > setCurrentIndex ( theConf - > GetInt ( " BoxDefaults/SharedTemplateIndex " , 0 ) ) ;
registerField ( " sharedTemplateIndex " , m_pSharedTemplateIndex ) ;
2024-03-23 17:43:54 +00:00
2023-01-28 13:05:37 +00:00
setLayout ( layout ) ;
2024-08-31 11:07:16 +01:00
// Connect the combo box signal to the slot
connect ( m_pSharedTemplate , qOverload < int > ( & QComboBox : : currentIndexChanged ) ,
this , & CAdvancedPage : : OnSharedTemplateIndexChanged ) ;
// Initial call to set the state based on the default index
OnSharedTemplateIndexChanged ( m_pSharedTemplate - > currentIndex ( ) ) ;
2023-01-28 13:05:37 +00:00
int size = 16.0 ;
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
size * = ( QApplication : : desktop ( ) - > logicalDpiX ( ) / 96.0 ) ; // todo Qt6
# endif
2024-05-22 14:09:18 +01:00
AddIconToLabel ( pBoxLabel , CSandMan : : GetIcon ( " Advanced " ) . pixmap ( size , size ) ) ;
2023-01-28 13:05:37 +00:00
}
2024-08-31 11:07:16 +01:00
void CAdvancedPage : : OnSharedTemplateIndexChanged ( int index )
{
if ( m_pSharedTemplateIndex ) {
bool enable = ( index ! = 0 ) ;
m_pSharedTemplateIndex - > setEnabled ( enable ) ;
}
}
2023-01-28 13:05:37 +00:00
int CAdvancedPage : : nextId ( ) const
{
return CNewBoxWizard : : Page_Summary ;
}
2024-06-14 17:09:00 +01:00
2023-01-28 13:05:37 +00:00
void CAdvancedPage : : initializePage ( )
{
}
bool CAdvancedPage : : validatePage ( )
{
return true ;
}
//////////////////////////////////////////////////////////////////////////////////////////
// CSummaryPage
//
CSummaryPage : : CSummaryPage ( QWidget * parent )
: QWizardPage ( parent )
{
setTitle ( tr ( " Create the new Sandbox " ) ) ;
2023-08-27 11:54:54 +01:00
QPixmap Logo = QPixmap ( theGUI - > m_DarkTheme ? " :/SideLogoDM.png " : " :/SideLogo.png " ) ;
int Scaling = theConf - > GetInt ( " Options/FontScaling " , 100 ) ;
if ( Scaling ! = 100 ) Logo = Logo . scaled ( Logo . width ( ) * Scaling / 100 , Logo . height ( ) * Scaling / 100 ) ;
setPixmap ( QWizard : : WatermarkPixmap , Logo ) ;
2023-01-28 13:05:37 +00:00
int row = 0 ;
QGridLayout * layout = new QGridLayout ;
QLabel * pLabel = new QLabel ;
pLabel - > setWordWrap ( true ) ;
pLabel - > setText ( tr ( " Almost complete, click Finish to create a new sandbox and conclude the wizard. " ) ) ;
layout - > addWidget ( pLabel , row + + , 0 , 1 , 3 ) ;
m_pSummary = new QTextEdit ( ) ;
m_pSummary - > setReadOnly ( true ) ;
m_pSummary - > setSizePolicy ( QSizePolicy : : Expanding , QSizePolicy : : Expanding ) ;
layout - > addWidget ( m_pSummary , row + + , 0 , 1 , 3 ) ;
m_pSetDefault = new QCheckBox ( tr ( " Save options as new defaults " ) ) ;
layout - > addWidget ( m_pSetDefault , row + + , 2 ) ;
//QWidget* pSpacer = new QWidget();
//pSpacer->setMinimumHeight(16);
//layout->addWidget(pSpacer);
QWidget * pSpacer = new QWidget ( ) ;
pSpacer - > setSizePolicy ( QSizePolicy : : Expanding , QSizePolicy : : Expanding ) ;
layout - > addWidget ( pSpacer , row + + , 1 ) ;
2023-08-27 11:54:54 +01:00
m_pSetInstant = new QCheckBox ( tr ( " Skip this summary page when advanced options are not set " ) ) ;
2023-01-28 13:05:37 +00:00
m_pSetInstant - > setChecked ( theConf - > GetBool ( " Options/InstantBoxWizard " , false ) ) ;
layout - > addWidget ( m_pSetInstant , row + + , 1 , 1 , 2 ) ;
2024-06-14 17:09:00 +01:00
2023-01-28 13:05:37 +00:00
setLayout ( layout ) ;
}
int CSummaryPage : : nextId ( ) const
{
return - 1 ;
}
void CSummaryPage : : initializePage ( )
{
m_pSummary - > setText ( theGUI - > GetBoxDescription ( wizard ( ) - > field ( " boxType " ) . toInt ( ) ) ) ;
QString Location = field ( " boxLocation " ) . toString ( ) ;
if ( Location . isEmpty ( ) )
Location = ( ( CNewBoxWizard * ) wizard ( ) ) - > GetDefaultLocation ( ) ;
m_pSummary - > append ( tr ( " \n This Sandbox will be saved to: %1 " ) . arg ( Location ) ) ;
2023-01-29 09:49:41 +00:00
if ( field ( " autoRemove " ) . toBool ( ) )
2023-01-31 08:29:55 +00:00
m_pSummary - > append ( tr ( " \n This box's content will be DISCARDED when it's closed, and the box will be removed. " ) ) ;
2023-01-29 09:49:41 +00:00
else if ( field ( " autoDelete " ) . toBool ( ) )
2023-01-28 13:05:37 +00:00
m_pSummary - > append ( tr ( " \n This box will DISCARD its content when its closed, its suitable only for temporary data. " ) ) ;
if ( field ( " blockNetwork " ) . toInt ( ) )
m_pSummary - > append ( tr ( " \n Processes in this box will not be able to access the internet or the local network, this ensures all accessed data to stay confidential. " ) ) ;
if ( field ( " msiServer " ) . toBool ( ) )
2023-02-03 07:05:10 +00:00
m_pSummary - > append ( tr ( " \n This box will run the MSIServer (*.msi installer service) with a system token, this improves the compatibility but reduces the security isolation. " ) ) ;
2023-01-28 13:05:37 +00:00
else if ( field ( " fakeAdmin " ) . toBool ( ) )
m_pSummary - > append ( tr ( " \n Processes in this box will think they are run with administrative privileges, without actually having them, hence installers can be used even in a security hardened box. " ) ) ;
2023-04-29 10:55:43 +01:00
if ( field ( " boxToken " ) . toBool ( ) )
2023-04-30 17:36:42 +01:00
m_pSummary - > append ( tr ( " \n Processes in this box will be running with a custom process token indicating the sandbox they belong to. " ) ) ;
2023-04-29 10:55:43 +01:00
2023-01-28 13:05:37 +00:00
m_pSetDefault - > setVisible ( ( ( CNewBoxWizard * ) wizard ( ) ) - > m_bAdvanced ) ;
}
bool CSummaryPage : : validatePage ( )
{
if ( m_pSetDefault - > isChecked ( ) )
{
theConf - > SetValue ( " BoxDefaults/BoxScheme " , field ( " boxVersion " ) . toInt ( ) + 1 ) ;
theConf - > SetValue ( " BoxDefaults/SeparateUser " , field ( " separateUser " ) . toBool ( ) ) ;
theConf - > SetValue ( " BoxDefaults/UseVolumeSN " , field ( " useVolumeSN " ) . toBool ( ) ) ;
theConf - > SetValue ( " BoxDefaults/AutoDelete " , field ( " autoDelete " ) . toBool ( ) ) ;
theConf - > SetValue ( " BoxDefaults/AutoRecover " , field ( " autoRecover " ) . toBool ( ) ) ;
theConf - > SetValue ( " BoxDefaults/BlockNetwork " , field ( " blockNetwork " ) . toInt ( ) ) ;
theConf - > SetValue ( " BoxDefaults/ShareAccess " , field ( " shareAccess " ) . toBool ( ) ) ;
2024-06-14 17:09:00 +01:00
theConf - > SetValue ( " BoxDefaults/PromptAccess " , field ( " promptAccess " ) . toBool ( ) ) ;
2023-01-28 13:05:37 +00:00
2024-04-25 15:50:32 +01:00
theConf - > SetValue ( " BoxDefaults/DropAdmin " , field ( " dropAdmin " ) . toBool ( ) ) ;
2023-01-28 13:05:37 +00:00
theConf - > SetValue ( " BoxDefaults/FakeAdmin " , field ( " fakeAdmin " ) . toBool ( ) ) ;
theConf - > SetValue ( " BoxDefaults/MsiExemptions " , field ( " msiServer " ) . toBool ( ) ) ;
2023-04-15 14:14:52 +01:00
theConf - > SetValue ( " BoxDefaults/BoxToken " , field ( " boxToken " ) . toBool ( ) ) ;
2023-04-29 10:55:43 +01:00
theConf - > SetValue ( " BoxDefaults/ImagesProtection " , field ( " imagesProtection " ) . toBool ( ) ) ;
2024-06-14 17:09:00 +01:00
theConf - > SetValue ( " BoxDefaults/CoverBoxedWindows " , field ( " coverBoxedWindows " ) . toBool ( ) ) ;
2024-03-26 21:39:57 +00:00
theConf - > SetValue ( " BoxDefaults/SharedTemplate " , field ( " sharedTemplate " ) . toInt ( ) ) ;
2024-08-31 11:07:16 +01:00
theConf - > SetValue ( " BoxDefaults/SharedTemplateIndex " , field ( " sharedTemplateIndex " ) . toInt ( ) ) ;
2023-01-28 13:05:37 +00:00
}
theConf - > SetValue ( " Options/InstantBoxWizard " , m_pSetInstant - > isChecked ( ) ) ;
2023-04-15 14:14:52 +01:00
theConf - > SetValue ( " Options/AdvancedBoxWizard " , ( ( CNewBoxWizard * ) wizard ( ) ) - > m_bAdvanced ) ;
2023-01-28 13:05:37 +00:00
SB_STATUS Status = ( ( CNewBoxWizard * ) wizard ( ) ) - > TryToCreateBox ( ) ;
if ( Status . IsError ( ) ) {
2023-07-01 17:54:53 +01:00
if ( Status . GetMsgCode ( ) ! = SB_Canceled )
QMessageBox : : critical ( this , " Sandboxie-Plus " , tr ( " Failed to create new box: %1 " ) . arg ( theGUI - > FormatError ( Status ) ) ) ;
2023-01-28 13:05:37 +00:00
return false ;
}
return true ;
2023-02-03 07:05:10 +00:00
}