Update SboxHostDll.cpp

This commit is contained in:
DavidXanatos 2022-06-05 14:38:55 +02:00
parent c30ec207c3
commit 33170d82cb
1 changed files with 16 additions and 1 deletions

View File

@ -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))
{