diff --git a/Sandboxie/core/dll/sysinfo.c b/Sandboxie/core/dll/sysinfo.c index ec3329a4..5e59ade4 100644 --- a/Sandboxie/core/dll/sysinfo.c +++ b/Sandboxie/core/dll/sysinfo.c @@ -302,7 +302,7 @@ _FX void SysInfo_DiscardProcesses(SYSTEM_PROCESS_INFORMATION *buf) ULONG hiddenProcessesLen = 100 * 110; // we can hide up to 100 processes, should be enough WCHAR hiddenProcess[110]; ULONG tempSession = 0; - WCHAR* tempSid = L""; + WCHAR tempSid[96] = {0}; for (ULONG index = 0; ; ++index) { NTSTATUS status = SbieApi_QueryConfAsIs(NULL, L"HideHostProcess", index, hiddenProcess, 108 * sizeof(WCHAR)); @@ -336,13 +336,13 @@ _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); - //SbieApi_QueryProcess(next->UniqueProcessId, boxname, NULL, 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)) { - // hideProcess = TRUE; - //} - //else + 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)) { + hideProcess = TRUE; + } + else if (hideOther && *boxname && _wcsicmp(boxname, Dll_BoxName) != 0) { hideProcess = TRUE; } @@ -358,12 +358,12 @@ _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) { + if (_wcsnicmp(imagename, L"Sandboxie", 9) == 0 || _wcsnicmp(imagename, L"Sbie", 4) == 0) { + if (SbieApi_QueryConfBool(NULL, L"HideSbieProcesses", FALSE)) + hideProcess = TRUE; + } + } } if (!hideProcess)