From 33170d82cb8373467d7906dccf8bd969456ccc56 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Sun, 5 Jun 2022 14:38:55 +0200 Subject: [PATCH] Update SboxHostDll.cpp --- Sandboxie/SboxHostDll/SboxHostDll.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Sandboxie/SboxHostDll/SboxHostDll.cpp b/Sandboxie/SboxHostDll/SboxHostDll.cpp index 6576320b..d592a33e 100644 --- a/Sandboxie/SboxHostDll/SboxHostDll.cpp +++ b/Sandboxie/SboxHostDll/SboxHostDll.cpp @@ -1,5 +1,6 @@ /* * Copyright 2004-2020 Sandboxie Holdings, LLC + * Copyright 2022 David Xanatos, xanasoft.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,6 +42,15 @@ BOOL SboxHostDll_OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHA if (bRet) { + // todo: + //HANDLE hAltToken = (HANDLE)SbieApi_QueryProcessInfoEx((HANDLE)GetProcessId(ProcessHandle), 'ptok', 0); + //if (hAltToken) { + // CloseHandle(hToken); + // if (phTokenOut) + // *phTokenOut = hAltToken; + // bRet = TRUE; + //} + if (SbieApi_QueryProcessInfo((HANDLE)GetProcessId(ProcessHandle), 0) & SBIE_FLAG_VALID_PROCESS) { BOOL bNeedAnotherValidToken = FALSE; @@ -55,7 +65,12 @@ BOOL SboxHostDll_OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHA if(token.GetUser(&userSid)) { // this token is usable for clicktorun service - if (lstrcmpi(userSid.Sid(), _T("S-1-5-7"))==0) + + // + // keep the 2nd option in sync with SandboxieSid[12] in DriverAssistSid.cpp + // + + if (lstrcmpi(userSid.Sid(), _T("S-1-5-7"))==0 || _wcsnicmp(userSid.Sid(), _T("S-1-5-100-"), 10)==0) { if(token.GetLogonSid(&logonSid)) {