From 17d928d4566653b9e6cad656d127d892ad6a8bbc Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Sat, 9 Mar 2024 11:58:40 +0100 Subject: [PATCH] 1.13.3 --- CHANGELOG.md | 8 +++++ Sandboxie/common/my_version.h | 4 +-- Sandboxie/core/dll/gui.c | 35 +++++++++---------- Sandboxie/core/dll/gui_p.h | 4 +++ Sandboxie/core/dll/guiclass.c | 3 ++ Sandboxie/core/dll/sh.c | 4 --- SandboxiePlus/SandMan/SandMan.cpp | 2 +- .../UGlobalHotkey/uglobalhotkey.qc.pro | 7 ++++ SandboxiePlus/version.h | 2 +- 9 files changed, 42 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3578c74d..74e9ee4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/). +## [1.13.3 / 5.68.3] - 2024-02-?? + +### Fixed +- fixed issues with "IsProtectScreen=y" [3656](https://github.com/sandboxie-plus/Sandboxie/pull/3656#discussion_r1518549704) + + + + ## [1.13.2 / 5.68.2] - 2024-03-07 ### Added diff --git a/Sandboxie/common/my_version.h b/Sandboxie/common/my_version.h index a741aa65..a7244f23 100644 --- a/Sandboxie/common/my_version.h +++ b/Sandboxie/common/my_version.h @@ -21,8 +21,8 @@ #ifndef _MY_VERSION_H #define _MY_VERSION_H -#define MY_VERSION_BINARY 5,68,2 -#define MY_VERSION_STRING "5.68.2" +#define MY_VERSION_BINARY 5,68,3 +#define MY_VERSION_STRING "5.68.3" #define MY_ABI_VERSION 0x56800 // These #defines are used by either Resource Compiler or NSIS installer diff --git a/Sandboxie/core/dll/gui.c b/Sandboxie/core/dll/gui.c index bd7448bd..d1386d50 100644 --- a/Sandboxie/core/dll/gui.c +++ b/Sandboxie/core/dll/gui.c @@ -263,6 +263,8 @@ static HWND Gui_CreateWindowExW( static BOOLEAN Gui_CanForwardMsg( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam/*, LRESULT* plResult*/); +static VOID Gui_ProtectScreen(HWND hWnd); + static LRESULT Gui_DefWindowProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -1391,6 +1393,9 @@ _FX HWND Gui_CreateWindowExW( --TlsData->gui_create_window; + if (hwndResult && !hWndParent && Gui_UseProtectScreen) + Gui_ProtectScreen(hwndResult); + // // replace window procedure // @@ -1499,6 +1504,9 @@ _FX HWND Gui_CreateWindowExA( --TlsData->gui_create_window; + if (hwndResult && !hWndParent && Gui_UseProtectScreen) + Gui_ProtectScreen(hwndResult); + // // replace window procedure // @@ -1563,14 +1571,12 @@ _FX BOOLEAN Gui_CanForwardMsg( _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); - } + typedef BOOL(*LPSETWINDOWDISPLAYAFFINITY)(HWND, DWORD); + static LPSETWINDOWDISPLAYAFFINITY pSetWindowDisplayAffinity = NULL; + if(!pSetWindowDisplayAffinity) + pSetWindowDisplayAffinity = (LPSETWINDOWDISPLAYAFFINITY)Ldr_GetProcAddrNew(DllName_user32, L"SetWindowDisplayAffinity", "SetWindowDisplayAffinity"); + if (pSetWindowDisplayAffinity) + pSetWindowDisplayAffinity(hWnd, 0x00000001); } @@ -1599,9 +1605,6 @@ _FX LRESULT Gui_WindowProcW( else new_lParam = lParam; - if (uMsg == WM_CREATE) - Gui_ProtectScreen(hWnd); - if (uMsg == WM_QUERYENDSESSION) { if (SbieApi_QueryConfBool(NULL, "BlockInterferePower", FALSE)) @@ -1663,8 +1666,6 @@ _FX LRESULT Gui_WindowProcA( else new_lParam = lParam; - if (uMsg == WM_CREATE) - Gui_ProtectScreen(hWnd); if (uMsg == WM_QUERYENDSESSION) { if (SbieApi_QueryConfBool(NULL, "BlockInterferePower", FALSE)) @@ -1693,10 +1694,8 @@ _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) { - Gui_ProtectScreen(hWnd); + else if (uMsg == WM_CREATE || uMsg == WM_NCCREATE) Gui_CREATESTRUCT_Restore(lParam); - } lResult = __sys_DefWindowProcW(hWnd, uMsg, wParam, new_lParam); @@ -1721,10 +1720,8 @@ _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) { - Gui_ProtectScreen(hWnd); + else if (uMsg == WM_CREATE || uMsg == WM_NCCREATE) Gui_CREATESTRUCT_Restore(lParam); - } lResult = __sys_DefWindowProcA(hWnd, uMsg, wParam, new_lParam); diff --git a/Sandboxie/core/dll/gui_p.h b/Sandboxie/core/dll/gui_p.h index 2822bf85..2afd486b 100644 --- a/Sandboxie/core/dll/gui_p.h +++ b/Sandboxie/core/dll/gui_p.h @@ -56,6 +56,9 @@ #define WM_DDE_EXECUTE (WM_DDE_FIRST+8) #define WM_DDE_LAST (WM_DDE_FIRST+8) +#define GET_WIN_API(name, lib) \ + P_##name name = Ldr_GetProcAddrNew(lib, #name, #name); \ + if(!name) return NULL; //--------------------------------------------------------------------------- // Prototypes @@ -468,6 +471,7 @@ typedef BOOL(*P_GetOpenFileNameW)(LPVOID lpofn); extern BOOLEAN Gui_RenameClasses; extern BOOLEAN Gui_OpenAllWinClasses; // not running in a restricted job +extern BOOLEAN Gui_UseProtectScreen; extern BOOLEAN Gui_UseProxyService; diff --git a/Sandboxie/core/dll/guiclass.c b/Sandboxie/core/dll/guiclass.c index d568a1e4..08941a80 100644 --- a/Sandboxie/core/dll/guiclass.c +++ b/Sandboxie/core/dll/guiclass.c @@ -105,6 +105,7 @@ static ULONG_PTR Gui_HighestAddress = 0; BOOLEAN Gui_RenameClasses = TRUE; BOOLEAN Gui_OpenAllWinClasses = FALSE; +BOOLEAN Gui_UseProtectScreen = FALSE; //--------------------------------------------------------------------------- @@ -191,6 +192,8 @@ _FX BOOLEAN Gui_InitClass(HMODULE module) } } + Gui_UseProtectScreen = SbieApi_QueryConfBool(NULL, L"IsProtectScreen", FALSE); + // // hook functions // diff --git a/Sandboxie/core/dll/sh.c b/Sandboxie/core/dll/sh.c index c966ec30..858c640d 100644 --- a/Sandboxie/core/dll/sh.c +++ b/Sandboxie/core/dll/sh.c @@ -430,10 +430,6 @@ HICON SH32_BorderToIcon(HICON hIcon, COLORREF color) typedef BOOL(*P_DeleteObject)(HGDIOBJ ho); typedef BOOL(*P_DeleteDC)(HDC hdc); -#define GET_WIN_API(name, lib) \ - P_##name name = Ldr_GetProcAddrNew(lib, #name, #name); \ - if(!name) return NULL; - GET_WIN_API(GetDC, DllName_user32); GET_WIN_API(ReleaseDC, DllName_user32); GET_WIN_API(GetIconInfo, DllName_user32); diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 43f1a05c..d7c54b63 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -2450,7 +2450,7 @@ void CSandMan::OnStatusChanged() } int DynData = theAPI->IsDyndataActive(); - if (DynData != 1) + if (DynData != 1 && COnlineUpdater::VersionToInt(theAPI->GetVersion()) >= COnlineUpdater::VersionToInt("5.68.0")) { RTL_OSVERSIONINFOEXW versionInfo; memset(&versionInfo, 0, sizeof(RTL_OSVERSIONINFOEXW)); diff --git a/SandboxiePlus/UGlobalHotkey/uglobalhotkey.qc.pro b/SandboxiePlus/UGlobalHotkey/uglobalhotkey.qc.pro index 4b3f1742..3db825cd 100644 --- a/SandboxiePlus/UGlobalHotkey/uglobalhotkey.qc.pro +++ b/SandboxiePlus/UGlobalHotkey/uglobalhotkey.qc.pro @@ -15,6 +15,13 @@ include(uglobalhotkey-headers.pri) include(uglobalhotkey-sources.pri) include(uglobalhotkey-libs.pri) +CONFIG(release, debug|release):{ +QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO +QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO +} + +QMAKE_CXXFLAGS_RELEASE -= -O2 + MY_ARCH=$$(build_arch) equals(MY_ARCH, ARM64) { # message("Building ARM64") diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index da96d42a..9a874e06 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -2,7 +2,7 @@ #define VERSION_MJR 1 #define VERSION_MIN 13 -#define VERSION_REV 2 +#define VERSION_REV 3 #define VERSION_UPD 0 #ifndef STR