[*] NT security: do not contaminate the caller thread of AuProcesses with user-switching elevation.

This commit is contained in:
Reece Wilson 2024-11-18 21:29:04 +00:00
parent 188dfd9459
commit e63903d0f4

View File

@ -650,7 +650,7 @@ namespace Aurora::Processes
} }
BOOL Exec(LPCWSTR lpApplicationName, BOOL ExecOnThread(LPCWSTR lpApplicationName,
LPWSTR lpCommandLine, LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes,
@ -993,6 +993,40 @@ namespace Aurora::Processes
pSetSecurityDescriptorDacl(&this->sd, TRUE, NULL, FALSE); pSetSecurityDescriptorDacl(&this->sd, TRUE, NULL, FALSE);
} }
} }
BOOL Exec(LPCWSTR lpApplicationName,
LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCWSTR lpCurrentDirectory,
LPSTARTUPINFOW lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation)
{
BOOL bRet = false;
if (auto pThread = AuThreads::Spawn([&]()
{
bRet = ExecOnThread(lpApplicationName,
lpCommandLine,
lpProcessAttributes,
lpThreadAttributes,
bInheritHandles,
dwCreationFlags,
lpEnvironment,
lpCurrentDirectory,
lpStartupInfo,
lpProcessInformation);
}, false))
{
pThread->GetShutdownWaitable()->Lock();
}
return bRet;
}
}; };
AUKN_SYM void RunAs(StartupParameters &startupParameters, AUKN_SYM void RunAs(StartupParameters &startupParameters,