Fixed bug with startprograms UI not clearing

This commit is contained in:
Terry MacDonald 2021-11-20 21:38:26 +13:00
parent 5b15dd367e
commit 10d387d53b
3 changed files with 25 additions and 9 deletions

View File

@ -424,6 +424,7 @@ namespace DisplayMagician
try
{
if (CreateProcessWithPriorityAsRestrictedUser(executable, arguments, ProcessUtils.TranslatePriorityToClass(processPriority), out processInfo))
//if (CreateProcessWithPriority(executable, arguments, ProcessUtils.TranslatePriorityToClass(processPriority), out processInfo))
{
if (processInfo.dwProcessId > 0)
{
@ -487,6 +488,17 @@ namespace DisplayMagician
{
// Start the process using built in process library
ProcessStartInfo psi = new ProcessStartInfo();
string extension = Path.GetExtension(executable);
if (extension.Equals("com", StringComparison.CurrentCultureIgnoreCase)
|| extension.Equals("exe", StringComparison.CurrentCultureIgnoreCase)
|| extension.Equals("msi", StringComparison.CurrentCultureIgnoreCase))
{
psi.UseShellExecute = false;
}
else
{
psi.Verb = "Open";
}
psi.FileName = executable;
psi.Arguments = arguments;
psi.WorkingDirectory = Path.GetDirectoryName(executable);
@ -603,7 +615,7 @@ namespace DisplayMagician
sInfoEx.StartupInfo.cb = Marshal.SizeOf(sInfoEx);
try
{
success = CreateProcess(fileName, cmd.ToString(), ref pSec, ref tSec, false, processFlags, IntPtr.Zero, null, ref sInfoEx, out pInfo);
success = CreateProcess(null, cmd.ToString(), ref pSec, ref tSec, false, processFlags, IntPtr.Zero, null, ref sInfoEx, out pInfo);
}
catch (Exception ex)
{
@ -613,7 +625,7 @@ namespace DisplayMagician
{
try
{
success = CreateProcess(fileName, cmd.ToString(), IntPtr.Zero, IntPtr.Zero, false, processFlags, IntPtr.Zero, null, ref sInfoEx, out pInfo);
success = CreateProcess(null, cmd.ToString(), IntPtr.Zero, IntPtr.Zero, false, processFlags, IntPtr.Zero, null, ref sInfoEx, out pInfo);
}
catch (Exception ex)
{
@ -646,14 +658,14 @@ namespace DisplayMagician
if (!CreateProcessAsUser(
hRestrictedToken,
fileName,
null,
cmd.ToString(),
IntPtr.Zero,
IntPtr.Zero,
true, // inherit handle
0,
IntPtr.Zero,
Path.GetDirectoryName(fileName),
null,
ref si,
out pi))
{

View File

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

View File

@ -1663,6 +1663,10 @@ namespace DisplayMagician.UIForms
spOrder++;
}
}
else
{
flp_start_programs.Controls.Clear();
}
// Setup the single stop program we're beginning with
if (_shortcutToEdit.StopPrograms is List<StopProgram> && _shortcutToEdit.StopPrograms.Count > 0)