This commit is contained in:
DavidXanatos 2024-03-02 13:02:26 +01:00
parent 45ed7b91dc
commit c4581a32db
4 changed files with 138 additions and 131 deletions

View File

@ -4,6 +4,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.13.2 / 5.68.2] - 2024-02-??
### Added
- Sandman, Menu entry to restart Sandman as admin [#3581](https://github.com/sandboxie-plus/Sandboxie/issues/3581) (thx Yeyixiao)
- Add options Block screencapture/screenshot feature for opened windows [#624](https://github.com/sandboxie-plus/Sandboxie/issues/624) [#1985](https://github.com/sandboxie-plus/Sandboxie/issues/1985)
## [1.13.1 / 5.68.1] - 2024-02-27

View File

@ -1551,6 +1551,24 @@ _FX BOOLEAN Gui_CanForwardMsg(
}
//---------------------------------------------------------------------------
// Gui_ProtectScreen
//---------------------------------------------------------------------------
_FX VOID Gui_ProtectScreen(HWND hWnd)
{
if (SbieApi_QueryConfBool(NULL, L"IsProtectScreen", FALSE))
{
typedef BOOL(*LPSETWINDOWDISPLAYAFFINITY)(HWND, DWORD);
LPSETWINDOWDISPLAYAFFINITY pSetWindowDisplayAffinity = (LPSETWINDOWDISPLAYAFFINITY)
Ldr_GetProcAddrNew(DllName_user32, L"SetWindowDisplayAffinity","SetWindowDisplayAffinity");
if (pSetWindowDisplayAffinity)
pSetWindowDisplayAffinity(hWnd, 0x00000001);
}
}
//---------------------------------------------------------------------------
// Gui_WindowProcW
//---------------------------------------------------------------------------
@ -1576,6 +1594,9 @@ _FX LRESULT Gui_WindowProcW(
else
new_lParam = lParam;
if (uMsg == WM_CREATE)
Gui_ProtectScreen(hWnd);
wndproc = __sys_GetPropW(hWnd, (LPCWSTR)Gui_WindowProcOldW_Atom);
if (DLL_IMAGE_OFFICE_EXCEL == Dll_ImageType) {
@ -1608,29 +1629,6 @@ _FX LRESULT Gui_WindowProcW(
return lResult;
}
_FX VOID ProtectScreen(HWND hWnd) {
WCHAR buffer[BOXNAME_COUNT] = { L"\0" };
SbieApi_QueryProcess(GetCurrentProcess(), buffer, 0, 0, 0);
if (SbieApi_QueryConfBool(buffer, L"IsProtectScreen", FALSE)) {
OSVERSIONINFOEX os;
os.dwOSVersionInfoSize = sizeof(os);
if (GetVersionEx(&os))
{
if (os.dwMajorVersion == 6) {
HMODULE hDll = GetModuleHandleW(L"user32.dll");
if (hDll != NULL && hDll != INVALID_HANDLE_VALUE) {
typedef BOOL(*LPSETWINDOWDISPLAYAFFINITY)(HWND, DWORD);
LPSETWINDOWDISPLAYAFFINITY swda =(LPSETWINDOWDISPLAYAFFINITY) GetProcAddress(hDll, "SetWindowDisplayAffinity");
if (swda) {
swda(hWnd, 0x00000001);
}
}
}
}
}
}
//---------------------------------------------------------------------------
// Gui_WindowProcA
//---------------------------------------------------------------------------
@ -1651,11 +1649,12 @@ _FX LRESULT Gui_WindowProcA(
if (uMsg == WM_SETTEXT && Gui_ShouldCreateTitle(hWnd))
new_lParam = (LPARAM)Gui_CreateTitleA((UCHAR *)lParam);
if (uMsg == WM_CREATE)
ProtectScreen(hWnd);
else
new_lParam = lParam;
if (uMsg == WM_CREATE)
Gui_ProtectScreen(hWnd);
wndproc = __sys_GetPropW(hWnd, (LPCWSTR)Gui_WindowProcOldA_Atom);
lResult = __sys_CallWindowProcA(wndproc, hWnd, uMsg, wParam, new_lParam);
@ -1679,8 +1678,10 @@ _FX LRESULT Gui_DefWindowProcW(
if (uMsg == WM_SETTEXT && Gui_ShouldCreateTitle(hWnd))
new_lParam = (LPARAM)Gui_CreateTitleW((WCHAR *)lParam);
else if (uMsg == WM_CREATE || uMsg == WM_NCCREATE)
else if (uMsg == WM_CREATE || uMsg == WM_NCCREATE) {
Gui_ProtectScreen(hWnd);
Gui_CREATESTRUCT_Restore(lParam);
}
lResult = __sys_DefWindowProcW(hWnd, uMsg, wParam, new_lParam);
@ -1705,8 +1706,10 @@ _FX LRESULT Gui_DefWindowProcA(
if (uMsg == WM_SETTEXT && Gui_ShouldCreateTitle(hWnd))
new_lParam = (LPARAM)Gui_CreateTitleA((UCHAR *)lParam);
else if (uMsg == WM_CREATE || uMsg == WM_NCCREATE)
else if (uMsg == WM_CREATE || uMsg == WM_NCCREATE) {
Gui_ProtectScreen(hWnd);
Gui_CREATESTRUCT_Restore(lParam);
}
lResult = __sys_DefWindowProcA(hWnd, uMsg, wParam, new_lParam);

View File

@ -1347,44 +1347,6 @@
<string>Box Protection</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_15">
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_52">
<property name="text">
<string>Sandboxie-Plus is able to create confidential sandboxes that provide robust protection against unauthorized surveillance or tampering by host processes. By utilizing an encrypted sandbox image, this feature delivers the highest level of operational confidentiality, ensuring the safety and integrity of sandboxed processes.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="chkConfidential">
<property name="text">
<string>Protect processes within this box from host processes</string>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QPushButton" name="btnHostProcessDeny">
<property name="text">
<string>Deny Process</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="3">
<widget class="QCheckBox" name="chkNotifyProtect">
<property name="text">
<string>Issue message 1318/1317 when a host process tries to access a sandboxed process/the box root</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="chkLessConfidential">
<property name="text">
<string>Allow useful Windows processes access to protected processes</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_19">
<property name="orientation">
@ -1398,47 +1360,14 @@
</property>
</spacer>
</item>
<item row="4" column="3">
<spacer name="verticalSpacer_40">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="3">
<spacer name="verticalSpacer_31">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>76</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="3">
<widget class="QPushButton" name="btnDelHostProcess">
<item row="12" column="0" colspan="3">
<widget class="QCheckBox" name="chkNotifyProtect">
<property name="text">
<string>Remove</string>
<string>Issue message 1318/1317 when a host process tries to access a sandboxed process/the box root</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QPushButton" name="btnHostProcessAllow">
<property name="text">
<string>Allow Process</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<item row="6" column="0" colspan="3">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Protect processes in this box from being accessed by specified unsandboxed host processes.</string>
@ -1448,6 +1377,41 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="chkProtectWindow">
<property name="text">
<string>Prevents getting an image of the window in the sandbox.</string>
</property>
</widget>
</item>
<item row="11" column="3">
<widget class="QPushButton" name="btnDelHostProcess">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="8" column="3">
<widget class="QPushButton" name="btnHostProcessDeny">
<property name="text">
<string>Deny Process</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="chkConfidential">
<property name="text">
<string>Protect processes within this box from host processes</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="chkLessConfidential">
<property name="text">
<string>Allow useful Windows processes access to protected processes</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_47">
<property name="minimumSize">
@ -1467,14 +1431,30 @@
</property>
</widget>
</item>
<item row="9" column="3">
<item row="10" column="3">
<widget class="QCheckBox" name="chkShowHostProcTmpl">
<property name="text">
<string>Show Templates</string>
</property>
</widget>
</item>
<item row="6" column="0" rowspan="5" colspan="3">
<item row="1" column="0">
<widget class="QLabel" name="lblBoxProtection">
<property name="font">
<font>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="toolTip">
<string>Protect the sandbox integrity itself</string>
</property>
<property name="text">
<string>Box Protection</string>
</property>
</widget>
</item>
<item row="7" column="0" rowspan="5" colspan="3">
<widget class="QTreeWidget" name="treeHostProc">
<property name="sortingEnabled">
<bool>true</bool>
@ -1496,30 +1476,49 @@
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblBoxProtection">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="toolTip">
<string>Protect the sandbox integrity itself</string>
</property>
<item row="7" column="3">
<widget class="QPushButton" name="btnHostProcessAllow">
<property name="text">
<string>Box Protection</string>
<string>Allow Process</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="chkProtectWindow">
<item row="9" column="3">
<spacer name="verticalSpacer_31">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>76</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_52">
<property name="text">
<string>Prevents getting an image of the window in the sandbox.</string>
<string>Sandboxie-Plus is able to create confidential sandboxes that provide robust protection against unauthorized surveillance or tampering by host processes. By utilizing an encrypted sandbox image, this feature delivers the highest level of operational confidentiality, ensuring the safety and integrity of sandboxed processes.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_41">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabPrivileges">

View File

@ -507,7 +507,6 @@ void CSandMan::CreateMenus(bool bAdvanced)
m_pNewBox = m_pMenuFile->addAction(CSandMan::GetIcon("NewBox"), tr("Create New Box"), this, SLOT(OnSandBoxAction()));
m_pNewGroup = m_pMenuFile->addAction(CSandMan::GetIcon("Group"), tr("Create Box Group"), this, SLOT(OnSandBoxAction()));
m_pImportBox = m_pMenuFile->addAction(CSandMan::GetIcon("UnPackBox"), tr("Import Box"), this, SLOT(OnSandBoxAction()));
m_pImportBox->setEnabled(CArchive::IsInit());
m_pMenuFile->addSeparator();
m_pRunBoxed = m_pMenuFile->addAction(CSandMan::GetIcon("Run"), tr("Run Sandboxed"), this, SLOT(OnSandBoxAction()));
@ -538,7 +537,7 @@ void CSandMan::CreateMenus(bool bAdvanced)
}
m_pMenuFile->addSeparator();
m_pRestart = m_pMenuFile->addAction(CSandMan::GetIcon("Exit"), tr("Restart As Admin"), this, SLOT(OnRestartAsAdmin()));
m_pRestart = m_pMenuFile->addAction(CSandMan::GetIcon("Shield9"), tr("Restart As Admin"), this, SLOT(OnRestartAsAdmin()));
m_pExit = m_pMenuFile->addAction(CSandMan::GetIcon("Exit"), tr("Exit"), this, SLOT(OnExit()));
@ -693,7 +692,7 @@ void CSandMan::CreateOldMenus()
m_pSetupWizard = NULL;
//m_pUpdateCore = NULL;
}
m_pRestart = m_pMenuFile->addAction(CSandMan::GetIcon("Exit"), tr("Restart As Admin"), this, SLOT(OnRestartAsAdmin()));
m_pRestart = m_pMenuFile->addAction(CSandMan::GetIcon("Shield9"), tr("Restart As Admin"), this, SLOT(OnRestartAsAdmin()));
m_pExit = m_pMenuFile->addAction(CSandMan::GetIcon("Exit"), tr("Exit"), this, SLOT(OnExit()));
m_pMenuView = m_pMenuBar->addMenu(tr("&View"));
@ -1299,7 +1298,9 @@ void CSandMan::CheckForUpdates(bool bManual)
}
#include "SandManTray.cpp"
void CSandMan::OnRestartAsAdmin() {
void CSandMan::OnRestartAsAdmin()
{
theAPI->Disconnect();
WCHAR buf[255] = { 0 };
GetModuleFileNameW(NULL, buf, 255);
@ -1313,6 +1314,7 @@ void CSandMan::OnRestartAsAdmin() {
ShellExecuteEx(&se);
OnExit();
}
void CSandMan::OnExit()
{
m_bExit = true;
@ -2677,11 +2679,8 @@ void CSandMan::OnHotKey(size_t id)
case HK_SUSPEND:
{
for (auto each : theAPI->GetAllBoxes().toStdMap()) {
each.second->SetSuspendedAll(TRUE);
}
for (auto each : theAPI->GetAllBoxes())
each->SetSuspendedAll(TRUE);
break;
}
@ -2773,7 +2772,6 @@ void CSandMan::AddLogMessage(const QDateTime& TimeStamp, const QString& Message,
pItem->setText(1, Message);
#endif
m_pMessageLog->GetView()->verticalScrollBar()->setValue(m_pMessageLog->GetView()->verticalScrollBar()->maximum());
}