This commit is contained in:
DavidXanatos 2024-03-02 13:43:45 +01:00
parent c4581a32db
commit cdd64732eb
2 changed files with 13 additions and 12 deletions

View File

@ -8,7 +8,8 @@ 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)

View File

@ -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,17 +2156,18 @@ 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);
@ -2177,6 +2176,7 @@ MSG_HEADER *ProcessServer::SuspendAllHandler(MSG_HEADER *msg)
CloseHandle(hProcess);
}
}
HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, pids);