From 843def289d328989d69ee9351bd5612f3bf17c01 Mon Sep 17 00:00:00 2001 From: love-code-yeyixiao <188240888@qq.com> Date: Sat, 8 Jun 2024 17:39:57 +0800 Subject: [PATCH] Fix --- Sandboxie/core/dll/sysinfo.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Sandboxie/core/dll/sysinfo.c b/Sandboxie/core/dll/sysinfo.c index 5e59ade4..16ec7a0f 100644 --- a/Sandboxie/core/dll/sysinfo.c +++ b/Sandboxie/core/dll/sysinfo.c @@ -336,21 +336,26 @@ _FX void SysInfo_DiscardProcesses(SYSTEM_PROCESS_INFORMATION *buf) next = (SYSTEM_PROCESS_INFORMATION *) (((UCHAR *)curr) + curr->NextEntryOffset); if (next == curr) break; - - SbieApi_QueryProcess(next->UniqueProcessId, boxname, NULL, tempSid, &tempSession); + WCHAR* imageFileName = NULL; + SbieApi_QueryProcess(next->UniqueProcessId, boxname,imageFileName, tempSid, &tempSession); BOOL hideProcess = FALSE; - if(_wcsnicmp(tempSid, L"S-1-5-18",8) != 0 && _wcsnicmp(tempSid, L"S-1-5-80",8) != 0 && _wcsnicmp(tempSid, L"S-1-5-20", 8) != 0 && _wcsnicmp(tempSid, L"S-1-5-6", 7) != 0 && SbieApi_QueryConfBool(NULL, L"HideNonSystemProcesses", FALSE)) { + if(_wcsnicmp(tempSid, L"S-1-5-18",8) != 0 && _wcsnicmp(tempSid, L"S-1-5-80",8) != 0 && _wcsnicmp(tempSid, L"S-1-5-20", 8) != 0 && _wcsnicmp(tempSid, L"S-1-5-6", 7) != 0 && SbieApi_QueryConfBool(NULL, L"HideNonSystemProcesses", FALSE) && !*boxname) { hideProcess = TRUE; } else if (hideOther && *boxname && _wcsicmp(boxname, Dll_BoxName) != 0) { hideProcess = TRUE; } - else if(next->ImageName.Buffer) { + else + if (SbieApi_QueryConfBool(NULL, L"HideSbieProcesses", FALSE)&&*imageFileName&&(wcsstr(imageFileName, L"Sandboxie") != NULL ||wcsstr(imageFileName, L"Sbie") != NULL)) { + + hideProcess = TRUE; + } + else if(hiddenProcesses && next->ImageName.Buffer) { WCHAR* imagename = wcschr(next->ImageName.Buffer, L'\\'); if (imagename) imagename += 1; // skip L'\\' else imagename = next->ImageName.Buffer; - if (hiddenProcesses && !*boxname || _wcsnicmp(imagename, L"Sandboxie", 9) == 0) { + if ( !*boxname || _wcsnicmp(imagename, L"Sandboxie", 9) == 0) { for (hiddenProcessesPtr = hiddenProcesses; *hiddenProcessesPtr != L'\0'; hiddenProcessesPtr += wcslen(hiddenProcessesPtr) + 1) { if (_wcsicmp(imagename, hiddenProcessesPtr) == 0) { hideProcess = TRUE; @@ -358,12 +363,6 @@ _FX void SysInfo_DiscardProcesses(SYSTEM_PROCESS_INFORMATION *buf) } } } - if (!hideProcess) { - if (_wcsnicmp(imagename, L"Sandboxie", 9) == 0 || _wcsnicmp(imagename, L"Sbie", 4) == 0) { - if (SbieApi_QueryConfBool(NULL, L"HideSbieProcesses", FALSE)) - hideProcess = TRUE; - } - } } if (!hideProcess)