Trying to get process to launch with UAC

Not really much luck at present, so have decided to add this functionality later.
This commit is contained in:
Terry MacDonald 2021-11-23 21:25:58 +13:00
parent 6a9f3abc6d
commit f6be9e04b2
2 changed files with 14 additions and 14 deletions

View File

@ -67,23 +67,23 @@ namespace DisplayMagician.Processes
{
logger.Warn($"ProcessUtils/StartProcess: {executable} {arguments} was unable to be started by TryExecute, so attempting with TryExecute_Impersonate");
ImpersonationProcess impProcessCreated;
if (IsImpersonated())
//if (IsImpersonated())
//{
//logger.Trace($"ProcessUtils/StartProcess: Useer CAN be impersonated, so trying to run {executable} {arguments} with TryExecute_Impersonated");
if (TryExecute_Impersonated(executable, arguments, out impProcessCreated))
{
logger.Trace($"ProcessUtils/StartProcess: Useer CAN be impersonated, so trying to run {executable} {arguments} with TryExecute_Impersonated");
if (TryExecute_Impersonated(executable, arguments, out impProcessCreated))
{
logger.Trace($"ProcessUtils/StartProcess: {executable} {arguments} has successfully been started by TryExecute_Impersonated");
processCreated = impProcessCreated;
}
else
{
logger.Error($"ProcessUtils/StartProcess: {executable} {arguments} was unable to be started by TryExecute_Impersonated, so giving up");
}
logger.Trace($"ProcessUtils/StartProcess: {executable} {arguments} has successfully been started by TryExecute_Impersonated");
processCreated = impProcessCreated;
}
else
{
logger.Error($"ProcessUtils/StartProcess: {executable} {arguments} was unable to be attempted by TryExecute_Impersonated as the User can't be impersonated, so giving up");
logger.Error($"ProcessUtils/StartProcess: {executable} {arguments} was unable to be started by TryExecute_Impersonated, so giving up");
}
//}
//else
//{
// logger.Error($"ProcessUtils/StartProcess: {executable} {arguments} was unable to be attempted by TryExecute_Impersonated as the User can't be impersonated, so giving up");
//}
}
if (processCreated != null && processCreated.Id > 0)

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information
[assembly: AssemblyVersion("2.1.0.358")]
[assembly: AssemblyFileVersion("2.1.0.358")]
[assembly: AssemblyVersion("2.1.0.361")]
[assembly: AssemblyFileVersion("2.1.0.361")]
[assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)]