Собственно выполняет ли нижепоставленый код отключение UAC, рабочий ли способ?
Код:
using System;
using System.IO;
using Microsoft.Win32;
namespace autostart
{
class Program
{
static void Main()
{
try
{
var uac = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", true);
if (uac != null)
if (uac.GetValue("EnableLUA") != null)
uac.SetValue("EnableLUA", "0");
Console.WriteLine("UAC desactivated");
}
catch (Exception c)
{
Console.WriteLine("Writing in registry failed " + c);
}
try
{
var uac = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", true);
if (uac != null)
if (uac.GetValue("EnableLUA") != null)
uac.SetValue("EnableLUA", "0");
Console.WriteLine("UAC desactivated");
}
catch (Exception c)
{
Console.WriteLine("Writing in registry failed " + c);
}
}
}
}