This commit is contained in:
DavidXanatos 2024-03-03 12:06:46 +01:00
parent 272e6c5f67
commit 688889d681
2 changed files with 42 additions and 6 deletions

View File

@ -8,7 +8,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added ### Added
- added menu entry to restart Sandman as admin [#3581](https://github.com/sandboxie-plus/Sandboxie/issues/3581) (thx Yeyixiao) - added menu entry to restart Sandman as admin [#3581](https://github.com/sandboxie-plus/Sandboxie/issues/3581) (thx Yeyixiao)
- Added the option to prevent sandboxed programs from accessing the images of the window outside the sandbox [#624](https://github.com/sandboxie-plus/Sandboxie/issues/624) [#1985](https://github.com/sandboxie-plus/Sandboxie/issues/1985) (thx Yeyixiao) - Added the option to prevent sandboxed programs from accessing the images of the window outside the sandbox [#1985](https://github.com/sandboxie-plus/Sandboxie/issues/1985) (thx Yeyixiao)
- added option to block taking screen capture/screenshot of sandboxed processes [#624](https://github.com/sandboxie-plus/Sandboxie/issues/624) (thx Yeyixiao)
- Sandman, suspend all processes [#3582](https://github.com/sandboxie-plus/Sandboxie/issues/3582) - Sandman, suspend all processes [#3582](https://github.com/sandboxie-plus/Sandboxie/issues/3582)
### Fixed ### Fixed

View File

@ -100,9 +100,14 @@ static LONG Gui_GetRawInputDeviceInfoW(
_Inout_ LPVOID pData, _Inout_ PUINT pcbSize); _Inout_ LPVOID pData, _Inout_ PUINT pcbSize);
static HDC Gui_GetDC(HWND hWnd); static HDC Gui_GetDC(HWND hWnd);
static HDC Gui_GetWindowDC(HWND hWnd); static HDC Gui_GetWindowDC(HWND hWnd);
static HDC Gui_GetDCEx(HWND hWnd, HRGN hrgnClip, DWORD flags); static HDC Gui_GetDCEx(HWND hWnd, HRGN hrgnClip, DWORD flags);
static BOOL Gui_PrintWindow(HWND hwnd,HDC hdcBlt,UINT nFlags); static BOOL Gui_PrintWindow(HWND hwnd,HDC hdcBlt,UINT nFlags);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -1466,6 +1471,7 @@ _FX BOOL Gui_ImmAssociateContextEx(
return ok; return ok;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Gui_GetDC // Gui_GetDC
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -1474,12 +1480,16 @@ _FX BOOL Gui_ImmAssociateContextEx(
_FX HDC Gui_GetDC(HWND hWnd) _FX HDC Gui_GetDC(HWND hWnd)
{ {
if (SbieApi_QueryConfBool(NULL, L"IsBlockCapture", FALSE)) { if (SbieApi_QueryConfBool(NULL, L"IsBlockCapture", FALSE)) {
if (hWnd == NULL || hWnd == __sys_GetDesktopWindow()) { if (hWnd == NULL || hWnd == __sys_GetDesktopWindow()) {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
return NULL; return NULL;
} }
ULONG_PTR pid=0, tid=0; ULONG_PTR pid=0, tid=0;
if (!Gui_IsSameBox(hWnd, &pid, &tid)) { if (!Gui_IsSameBox(hWnd, &pid, &tid)) {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
return NULL; return NULL;
} }
@ -1487,15 +1497,24 @@ _FX HDC Gui_GetDC(HWND hWnd)
return __sys_GetDC(hWnd); return __sys_GetDC(hWnd);
} }
//---------------------------------------------------------------------------
// Gui_GetWindowDC
//---------------------------------------------------------------------------
_FX HDC Gui_GetWindowDC(HWND hWnd) _FX HDC Gui_GetWindowDC(HWND hWnd)
{ {
if (SbieApi_QueryConfBool(NULL, L"IsBlockCapture", FALSE)) { if (SbieApi_QueryConfBool(NULL, L"IsBlockCapture", FALSE)) {
if (hWnd == NULL || hWnd == __sys_GetDesktopWindow()) { if (hWnd == NULL || hWnd == __sys_GetDesktopWindow()) {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
return NULL; return NULL;
} }
ULONG_PTR pid = 0, tid = 0; ULONG_PTR pid = 0, tid = 0;
if (!Gui_IsSameBox(hWnd, &pid, &tid)) { if (!Gui_IsSameBox(hWnd, &pid, &tid)) {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
return NULL; return NULL;
} }
@ -1503,35 +1522,51 @@ _FX HDC Gui_GetWindowDC(HWND hWnd)
return __sys_GetWindowDC(hWnd); return __sys_GetWindowDC(hWnd);
} }
//---------------------------------------------------------------------------
// Gui_GetDCEx
//---------------------------------------------------------------------------
_FX HDC Gui_GetDCEx(HWND hWnd,HRGN hrgnClip,DWORD flags) _FX HDC Gui_GetDCEx(HWND hWnd,HRGN hrgnClip,DWORD flags)
{ {
if (SbieApi_QueryConfBool(NULL, L"IsBlockCapture", FALSE)) { if (SbieApi_QueryConfBool(NULL, L"IsBlockCapture", FALSE)) {
if (hWnd == NULL || hWnd == __sys_GetDesktopWindow()) { if (hWnd == NULL || hWnd == __sys_GetDesktopWindow()) {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
return NULL; return NULL;
} }
ULONG_PTR pid = 0, tid = 0; ULONG_PTR pid = 0, tid = 0;
if (!Gui_IsSameBox(hWnd, &pid, &tid)) { if (!Gui_IsSameBox(hWnd, &pid, &tid)) {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
return NULL; return NULL;
} }
} }
return __sys_GetWindowDC(hWnd); return __sys_GetWindowDC(hWnd);
} }
_FX BOOL Gui_PrintWindow(
HWND hwnd,
HDC hdcBlt, //---------------------------------------------------------------------------
UINT nFlags // Gui_PrintWindow
) { //---------------------------------------------------------------------------
_FX BOOL Gui_PrintWindow(HWND hwnd, HDC hdcBlt, UINT nFlags)
{
if (SbieApi_QueryConfBool(NULL, L"IsBlockCapture", FALSE)) { if (SbieApi_QueryConfBool(NULL, L"IsBlockCapture", FALSE)) {
if (hwnd == NULL || hwnd == __sys_GetDesktopWindow()) { if (hwnd == NULL || hwnd == __sys_GetDesktopWindow()) {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
return 0; return 0;
} }
ULONG_PTR pid = 0, tid = 0; ULONG_PTR pid = 0, tid = 0;
if (!Gui_IsSameBox(hwnd, &pid, &tid)) { if (!Gui_IsSameBox(hwnd, &pid, &tid)) {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
return 0; return 0;
} }