From cdd64732eb935d53c814d685f8e2bc37d68ab1b6 Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Sat, 2 Mar 2024 13:43:45 +0100 Subject: [PATCH] 1.13.2 --- CHANGELOG.md | 7 ++++--- Sandboxie/core/svc/ProcessServer.cpp | 18 +++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dab0e26a..bc7518b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### 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) - - +- 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) (thx Yeyixiao) +- Sandman, suspend all processes [#3582](https://github.com/sandboxie-plus/Sandboxie/issues/3582) + + ## [1.13.1 / 5.68.1] - 2024-02-27 diff --git a/Sandboxie/core/svc/ProcessServer.cpp b/Sandboxie/core/svc/ProcessServer.cpp index c3887538..72c7cc1c 100644 --- a/Sandboxie/core/svc/ProcessServer.cpp +++ b/Sandboxie/core/svc/ProcessServer.cpp @@ -2106,8 +2106,6 @@ MSG_HEADER *ProcessServer::SuspendOneHandler(MSG_HEADER *msg) MSG_HEADER *ProcessServer::SuspendAllHandler(MSG_HEADER *msg) { - return SHORT_REPLY(STATUS_NOT_IMPLEMENTED); - HANDLE CallerProcessId; ULONG TargetSessionId; WCHAR TargetBoxName[BOXNAME_COUNT]; @@ -2158,24 +2156,26 @@ MSG_HEADER *ProcessServer::SuspendAllHandler(MSG_HEADER *msg) // ULONG pid_count = 0; - SbieApi_EnumProcessEx(NULL, FALSE, -1, NULL, &pid_count); // query count + SbieApi_EnumProcessEx(TargetBoxName, FALSE, TargetSessionId, NULL, &pid_count); // query count pid_count += 128; ULONG* pids = (ULONG*)HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, sizeof(ULONG) * pid_count); - SbieApi_EnumProcessEx(NULL, FALSE, -1, pids, &pid_count); // query pids + SbieApi_EnumProcessEx(TargetBoxName, FALSE, TargetSessionId, pids, &pid_count); // query pids for (ULONG i = 0; i < pid_count; ++i) { DWORD pids_i = pids[i]; HANDLE hProcess = OpenProcess(PROCESS_SUSPEND_RESUME, FALSE, pids_i); + if (hProcess) { - if (req->suspend) - NtSuspendProcess(hProcess); - else - NtResumeProcess(hProcess); + if (req->suspend) + NtSuspendProcess(hProcess); + else + NtResumeProcess(hProcess); - CloseHandle(hProcess); + CloseHandle(hProcess); + } } HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, pids);