Trivial task. Add to branch

HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Run

key. How I do it:

static void SetRegistryValue(string path, string key, object value) { using (var currKey = Registry.CurrentUser.OpenSubKey(path, true)) { if (currKey != null) { currKey.SetValue(key, value, RegistryValueKind.ExpandString); currKey.Close(); } } } 

Then

 SetRegistryValue(@"Software\Microsoft\Windows\CurrentVersion\Run", "key", "value"); 

As a result, falls into

System.UnauthorizedAccessException: An attempt to perform an unauthorized operation.

After that, I just did not try. Tested even with level = "highestAvailable" in the manifest - the same thing.

I'm on board Windows 10 Pro Insider Preview. I ran the test on a machine with Windows 7 - everything works fine. What is the problem?

  • one
    A similar question in English: stackoverflow.com/questions/11768172/… The author claims that the problem was in the antivirus, there are other suggestions in the answers. - default locale
  • one
    @VladD: Yes, I already looked in the logs. Just even thought about him was not. - Eduard Design
  • one
    If the problem is solved, publish the solution in the answer and mark it as correct. - default locale
  • one
    @defaultlocale: Since the idea is yours, it makes sense for you to publish the solution (and get your well-deserved points). - VladD
  • one
    @VladD thanks, but for the answer to be useful, you need to include specific information (what was blocked, how to disable the lock, how to check), which I do not possess. I’m too lazy to write a detailed answer (a-la that needs to be checked in such cases) :) - default locale

1 answer 1

Access to the startup keys in the registry without warning blocked antivirus 360 Internet Security.