Şu kodumda da reg ekleme işlemini reg helper yerine SetACL kullan string tempExePath =…
- User
Şu kodumda da reg ekleme işlemini reg helper yerine SetACL kullan string tempExePath = Path.Combine(Path.GetTempPath(), "SetACL.exe"); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("QuickOptimizer.Files.SetACL.exe")) using (var fileStream = new FileStream(tempExePath, FileMode.Create, FileAccess.Write)) { stream.CopyTo(fileStream); }
// Sahipliği almak için SetACL komutu string takeOwnershipArgs = @"-on ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"" -ot reg -actn setowner -ownr ""n: Administrators"""; ExecuteSetAcl(tempExePath, takeOwnershipArgs);
// Yöneticilere tam kontrol izinleri vermek için SetACL komutu string grantPermissionsArgs = @"-on ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"" -ot reg -actn ace -ace ""n: Administrators;p:full"""; ExecuteSetAcl(tempExePath, grantPermissionsArgs);
// Geçici olarak oluşturulan SetACL.exe dosyasını sil File.Delete(tempExePath); try { RegHelper.SetValue(RegistryHive.LocalMachine, @"Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", 0, RegistryValueKind.DWord);
} catch (Exception) { }
- Assistant