Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed Feb 1, 2021
1 parent cb9b4b0 commit e88b739
Show file tree
Hide file tree
Showing 29 changed files with 11,251 additions and 8,051 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ This project adheres to [Semantic Versioning](http://semver.org/).





## [0.6.7 / 5.47.1] - 2021-02-01

### Added
- added UI Language auto detection

### Fixed
- fixed brave.exe is now properly recognized as chrome based not firefox based
- fixed issue introduced in 0.6.5 with recent edge builds
-- the 0.6.5 behavioure can be set ona per process basis using "RpcMgmtSetComTimeout=POPPeeper.exe,n"
- fixed grouping issues
- fixed main windows restore state from tray



## [0.6.5 / 5.47.0] - 2021-01-31

### Added
Expand Down
4 changes: 2 additions & 2 deletions Sandboxie/common/my_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#ifndef _MY_VERSION_H
#define _MY_VERSION_H

#define MY_VERSION_BINARY 5,47,0
#define MY_VERSION_STRING "5.47.0"
#define MY_VERSION_BINARY 5,47,1
#define MY_VERSION_STRING "5.47.1"
#define MY_VERSION_COMPAT "5.46.0" // this refers to the driver ABI compatibility

// These #defines are used by either Resource Compiler, or by NSIC installer
Expand Down
64 changes: 39 additions & 25 deletions Sandboxie/core/dll/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,8 @@ _FX BOOLEAN Config_MatchImageGroup(
//---------------------------------------------------------------------------


_FX WCHAR* Config_MatchImageAndGetValue(WCHAR* value)
_FX WCHAR* Config_MatchImageAndGetValue(WCHAR* value, ULONG* pMode)
{
ULONG image_len = (wcslen(Dll_ImageName) + 1) * sizeof(WCHAR);
WCHAR* image_lwr = Dll_AllocTemp(image_len);
if (!image_lwr) {
SbieApi_Log(2305, NULL);
return NULL;
}
memcpy(image_lwr, Dll_ImageName, image_len);
_wcslwr(image_lwr);
//image_len = wcslen(image_lwr);

//
// if the setting indicates an image name followed by a comma,
// then match the image name against the executing process.
Expand All @@ -242,9 +232,11 @@ _FX WCHAR* Config_MatchImageAndGetValue(WCHAR* value)
else
inv = FALSE;

if (pMode) *pMode = inv ? 1 : 0; // 1 - match by negation, 0 - exact match

ULONG len = (ULONG)(tmp - value);
if (len) {
match = Config_MatchImage(value, len, image_lwr, 1);
match = Config_MatchImage(value, len, Dll_ImageName, 1);
if (inv)
match = !match;
if (!match)
Expand All @@ -253,13 +245,32 @@ _FX WCHAR* Config_MatchImageAndGetValue(WCHAR* value)

value = tmp ? tmp + 1 : NULL;
}
else {

Dll_Free(image_lwr);
if (pMode) *pMode = 2; // 2 - global default
}

return value;
}


//---------------------------------------------------------------------------
// Config_GetSettingsForImageName_bool
//---------------------------------------------------------------------------


BOOLEAN Config_GetSettingsForImageName_bool(const WCHAR* setting, BOOLEAN defval)
{
WCHAR value[16];
Config_GetSettingsForImageName(setting, value, sizeof(value), NULL);
if (*value == L'y' || *value == L'Y')
return TRUE;
if (*value == L'n' || *value == L'N')
return FALSE;
return defval;
}


//---------------------------------------------------------------------------
// Config_InitPatternList
//---------------------------------------------------------------------------
Expand All @@ -280,7 +291,7 @@ _FX BOOLEAN Config_InitPatternList(const WCHAR* setting, LIST* list)
break;
++index;

WCHAR* value = Config_MatchImageAndGetValue(conf_buf);
WCHAR* value = Config_MatchImageAndGetValue(conf_buf, NULL);
if (value)
{
pat = Pattern_Create(Dll_Pool, value, TRUE);
Expand All @@ -302,7 +313,7 @@ _FX NTSTATUS Config_GetSettingsForImageName(
const WCHAR* setting, WCHAR* value, ULONG value_size, const WCHAR* deftext)
{
WCHAR conf_buf[2048];
WCHAR* found_value = NULL;
ULONG found_mode = -1;

ULONG index = 0;
while (1) {
Expand All @@ -313,19 +324,22 @@ _FX NTSTATUS Config_GetSettingsForImageName(
break;
++index;

WCHAR* value = Config_MatchImageAndGetValue(conf_buf);
if (!value)
ULONG mode = -1;
WCHAR* found_value = Config_MatchImageAndGetValue(conf_buf, &mode);
if (!found_value || mode > found_mode)
continue;
if (found_value) {
SbieApi_Log(2302, L"%S - %S [%S]", setting, Dll_ImageName, Dll_BoxName);
break;
}
found_value = value;
//if (found_value) {
// SbieApi_Log(2302, L"%S - %S [%S]", setting, Dll_ImageName, Dll_BoxName);
// break;
//}
wcscpy_s(value, value_size / sizeof(WCHAR), found_value);
found_mode = mode;
}

if (found_value) wcscpy_s(value, value_size / sizeof(WCHAR), found_value);
else if (deftext) wcscpy_s(value, value_size / sizeof(WCHAR), deftext);
else value[0] = L'\0';
if (found_mode == -1) {
if (deftext) wcscpy_s(value, value_size / sizeof(WCHAR), deftext);
else value[0] = L'\0';
}

return STATUS_SUCCESS;
}
3 changes: 1 addition & 2 deletions Sandboxie/core/dll/dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -741,13 +741,12 @@ BOOLEAN ComDlg32_Init(HMODULE);
//---------------------------------------------------------------------------


WCHAR* Config_MatchImageAndGetValue(WCHAR* value);

BOOLEAN Config_InitPatternList(const WCHAR* setting, LIST* list);

NTSTATUS Config_GetSettingsForImageName(
const WCHAR* setting, WCHAR* value, ULONG value_size, const WCHAR* deftext);

BOOLEAN Config_GetSettingsForImageName_bool(const WCHAR* setting, BOOLEAN defval);

//---------------------------------------------------------------------------

Expand Down
8 changes: 4 additions & 4 deletions Sandboxie/core/dll/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ _FX void Dll_SelectImageType(void)
L"waterfox.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,
L"palemoon.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,
L"basilisk.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,
L"seamonkey.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,
L"seamonkey.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,

L"wmplayer.exe", (WCHAR *)DLL_IMAGE_WINDOWS_MEDIA_PLAYER,
L"winamp.exe", (WCHAR *)DLL_IMAGE_NULLSOFT_WINAMP,
Expand All @@ -575,9 +575,9 @@ _FX void Dll_SelectImageType(void)
L"neon.exe", (WCHAR *)DLL_IMAGE_GOOGLE_CHROME,
L"maxthon.exe", (WCHAR *)DLL_IMAGE_GOOGLE_CHROME,
L"vivaldi.exe", (WCHAR *)DLL_IMAGE_GOOGLE_CHROME,
L"brave.exe", (WCHAR *)DLL_IMAGE_GOOGLE_CHROME,
L"browser.exe", (WCHAR *)DLL_IMAGE_GOOGLE_CHROME, // Yandex Browser
L"msedge.exe", (WCHAR *)DLL_IMAGE_GOOGLE_CHROME, // Modern Edge is Chromium-based
L"brave.exe", (WCHAR *)DLL_IMAGE_GOOGLE_CHROME,
L"browser.exe", (WCHAR *)DLL_IMAGE_GOOGLE_CHROME, // Yandex Browser
L"msedge.exe", (WCHAR *)DLL_IMAGE_GOOGLE_CHROME, // Modern Edge is Chromium-based
L"GoogleUpdate.exe", (WCHAR *)DLL_IMAGE_GOOGLE_UPDATE,

L"AcroRd32.exe", (WCHAR *)DLL_IMAGE_ACROBAT_READER,
Expand Down
5 changes: 1 addition & 4 deletions Sandboxie/core/dll/file_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ _FX BOOLEAN File_InitFileMigration(void)
Config_InitPatternList(L"CopyAlways", &File_MigrationOptions[FILE_COPY_CONTENT]);
Config_InitPatternList(L"DontCopy", &File_MigrationOptions[FILE_DONT_COPY]);

WCHAR conf[16];
Config_GetSettingsForImageName(L"CopyBlockDenyWrite", conf, sizeof(conf), NULL);
if (*conf == L'y' || *conf == L'Y')
File_MigrationDenyWrite = TRUE;
File_MigrationDenyWrite = Config_GetSettingsForImageName_bool(L"CopyBlockDenyWrite", FALSE);

File_InitCopyLimit();

Expand Down
10 changes: 6 additions & 4 deletions Sandboxie/core/dll/rpcrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,13 @@ _FX BOOLEAN RpcRt_Init(HMODULE module)

SBIEDLL_HOOK(RpcRt_, RpcBindingCreateW);

__sys_RpcMgmtSetComTimeout = (P_RpcMgmtSetComTimeout)Ldr_GetProcAddrNew(DllName_rpcrt4, L"RpcMgmtSetComTimeout", "RpcMgmtSetComTimeout");
if(Config_GetSettingsForImageName_bool(L"RpcMgmtSetComTimeout", TRUE))
__sys_RpcMgmtSetComTimeout = (P_RpcMgmtSetComTimeout)Ldr_GetProcAddrNew(DllName_rpcrt4, L"RpcMgmtSetComTimeout", "RpcMgmtSetComTimeout");
}

WCHAR wsTraceOptions[4];
if (SbieApi_QueryConf(NULL, L"IpcTrace", 0, wsTraceOptions, sizeof(wsTraceOptions)) == STATUS_SUCCESS && wsTraceOptions[0] != L'\0')
if ((Dll_OsBuild >= 8400) // win8 and above
&& SbieApi_QueryConf(NULL, L"IpcTrace", 0, wsTraceOptions, sizeof(wsTraceOptions)) == STATUS_SUCCESS && wsTraceOptions[0] != L'\0')
{
#ifdef _WIN64

Expand Down Expand Up @@ -461,7 +463,7 @@ _FX ULONG RpcRt_RpcBindingFromStringBindingW(
//OutputDebugString(msg);
SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, msg, FALSE);
}
//__sys_RpcMgmtSetComTimeout(*OutBinding, RPC_C_BINDING_TIMEOUT); // this breaks things
if(__sys_RpcMgmtSetComTimeout) __sys_RpcMgmtSetComTimeout(*OutBinding, RPC_C_BINDING_TIMEOUT);
return status;
}

Expand Down Expand Up @@ -525,7 +527,7 @@ _FX RPC_STATUS RpcRt_RpcBindingCreateW(
//OutputDebugString(msg);
SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, msg, FALSE);
}
//__sys_RpcMgmtSetComTimeout(*Binding, RPC_C_BINDING_TIMEOUT); // this breaks things
if (__sys_RpcMgmtSetComTimeout) __sys_RpcMgmtSetComTimeout(*Binding, RPC_C_BINDING_TIMEOUT);
return status;
}

Expand Down
Binary file modified Sandboxie/install/Templates.ini
Binary file not shown.
1 change: 1 addition & 0 deletions SandboxiePlus/MiscHelpers/Common/ComboInputDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ CComboInputDialog::CComboInputDialog(QWidget *parent) :
{
setModal(true);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
d->combo->setFocus();
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject()));
connect(d->buttonBox, SIGNAL(clicked(QAbstractButton*)),
Expand Down
2 changes: 1 addition & 1 deletion SandboxiePlus/SandMan/Forms/RecoveryWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</size>
</property>
<property name="windowTitle">
<string>SandboxiePlus Settings</string>
<string>SandboxiePlus - Recovery</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
Expand Down
3 changes: 3 additions & 0 deletions SandboxiePlus/SandMan/Forms/SettingsWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
<property name="text">
<string>Use Dark Theme</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="1">
Expand Down
2 changes: 1 addition & 1 deletion SandboxiePlus/SandMan/Forms/SnapshotsWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</size>
</property>
<property name="windowTitle">
<string>SandboxiePlus Settings</string>
<string>SandboxiePlus - Snapshots</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
Expand Down
3 changes: 2 additions & 1 deletion SandboxiePlus/SandMan/Models/SbieModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ QList<QVariant> CSbieModel::MakeBoxPath(const QVariant& Name, const QMap<QString
QString ParentID = FindParent(Name, Groups);

QList<QVariant> Path;
if (!ParentID.isEmpty() && ParentID != Name)
if (!ParentID.isEmpty() && ParentID != Name
&& !Groups.value(CSbieModel__RemoveGroupMark(Name.toString())).contains(CSbieModel__RemoveGroupMark(ParentID)))
{
Path = MakeBoxPath(ParentID, Groups);
Path.append(ParentID);
Expand Down
33 changes: 17 additions & 16 deletions SandboxiePlus/SandMan/SandMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "Windows/RecoveryWindow.h"
#include <QtConcurrent>
#include "../MiscHelpers/Common/SettingsWidgets.h"
#include "Windows/NewBoxWindow.h"
#include "Windows/OptionsWindow.h"
#include <QProxyStyle>

Expand Down Expand Up @@ -99,8 +98,7 @@ CSandMan::CSandMan(QWidget *parent)

m_LanguageId = 1033; // lang en_us
LoadLanguage();
if (theConf->GetBool("Options/DarkTheme", false))
SetDarkTheme(true);
SetUITheme();

m_bExit = false;

Expand Down Expand Up @@ -1063,15 +1061,7 @@ void CSandMan::OnNotAuthorized(bool bLoginRequired, bool& bRetry)

void CSandMan::OnNewBox()
{
CNewBoxWindow NewBoxWindow(this);
bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false);
NewBoxWindow.setWindowFlag(Qt::WindowStaysOnTopHint, bAlwaysOnTop);
if (NewBoxWindow.exec() == 1)
{
theAPI->ReloadBoxes();
m_pBoxView->Refresh();
m_pBoxView->SelectBox(NewBoxWindow.m_Name);
}
m_pBoxView->AddNewBox();
}

void CSandMan::OnEmptyAll()
Expand Down Expand Up @@ -1319,7 +1309,7 @@ void CSandMan::OnSettings()

void CSandMan::UpdateSettings()
{
SetDarkTheme(theConf->GetBool("Options/DarkTheme", false));
SetUITheme();

//m_pBoxView->UpdateRunMenu();

Expand Down Expand Up @@ -1620,7 +1610,7 @@ void CSandMan::OnSysTray(QSystemTrayIcon::ActivationReason Reason)
NullifyTrigger = false;
return;
}
setWindowState(Qt::WindowActive);
this->setWindowState((this->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
SetForegroundWindow(MainWndHandle);
} );
}
Expand Down Expand Up @@ -1944,8 +1934,16 @@ void CSandMan::OnAbout()
QMessageBox::aboutQt(this);
}

void CSandMan::SetDarkTheme(bool bDark)
void CSandMan::SetUITheme()
{
bool bDark;
int iDark = theConf->GetInt("Options/UseDarkTheme", 2);
if (iDark == 2) {
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat);
bDark = (settings.value("AppsUseLightTheme") == 0);
} else
bDark = (iDark == 1);

if (bDark)
{
QApplication::setStyle(QStyleFactory::create("Fusion"));
Expand Down Expand Up @@ -1986,7 +1984,10 @@ void CSandMan::LoadLanguage()
m_Translation.clear();
m_LanguageId = 0;

QString Lang = theConf->GetString("Options/Language");
QString Lang = theConf->GetString("Options/UiLanguage");
if(Lang.isEmpty())
Lang = QLocale::system().name();

if (!Lang.isEmpty())
{
m_LanguageId = LocaleNameToLCID(Lang.toStdWString().c_str(), 0);
Expand Down
5 changes: 3 additions & 2 deletions SandboxiePlus/SandMan/SandMan.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#define VERSION_MJR 0
#define VERSION_MIN 6
#define VERSION_REV 5
#define VERSION_REV 7
#define VERSION_UPD 0


Expand Down Expand Up @@ -235,7 +235,7 @@ private slots:
CProgressDialog* m_pProgressDialog;
CPopUpWindow* m_pPopUpWindow;

void SetDarkTheme(bool bDark);
void SetUITheme();
QString m_DefaultStyle;
QPalette m_DefaultPalett;

Expand All @@ -244,6 +244,7 @@ private slots:
QByteArray m_Translation;
public:
quint32 m_LanguageId;
bool m_DarkTheme;
};

extern CSandMan* theGUI;
1 change: 1 addition & 0 deletions SandboxiePlus/SandMan/SandMan.qc.pro
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ win32:RC_FILE = SandMan.rc
TRANSLATIONS += sandman_de.ts \
sandman_pt.ts \
sandman_ru.ts \
sandman_pl.ts \
sandman_tr.ts \
sandman_zh.ts \
sandman_zh-TW.ts
Loading

0 comments on commit e88b739

Please sign in to comment.