Change registry key values Windows

Asked

Viewed 1,406 times

3

It is possible to build an application which it searches for a key in the Windows registry with an exact name and when finding change its value by a user-defined value?

If possible what is the best language to implement this? VB.NET?!

  • 2

    It seems to me that your question is too wide. Not to mention you may be breaching some Microsoft usage term :P

  • 2

    It’s possible, I’ve done something similar in C++.

  • 4

    @I don’t think you’re breaking any laws. Being that it is just a software that does exactly the same thing you can do manually, there is no way you have an extra privilege only because it is changing keys through code.

  • 1

    @Math, I just assumed that I could break it. Now whether you do it or not, I don’t know. But you might actually be right :)

  • Do you have any more instruction to give me @Math?! A light, a path? D I don’t know where to start...

  • 2

    @Luitame the answer below should help you. If it was in C++ I would say to use TRegistry.

  • Vlw @Math... I saw the answer now! Abs

Show 2 more comments

2 answers

6

Yes, it is possible.

In C#:

using (RegistryKey key = Registry.LocalMachine.OpenSubKey("oMeuCaminho"))
{
    if (key != null) 
        key.SetValue("nomeDaMinhaChave", "valorDaMinhaChave", RegistryValueKind.String);
}

Or in VB.NET:

Registry.SetValue("oMeuCaminho", "nomeDaMinhaChave", "valorDaMinhaChave")

(More information about the Registry class in MSDN)

  • vlw! @Omni for feedback...

0

the best way I could find was this

c#

const string userRoot = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings";
           // onde "1" vc habilita o proxy e "0" vc desabilita.
            Registry.SetValue(userRoot, "ProxyEnable", "1", RegistryValueKind.DWord);
          // informe o endereço ip junto da porta para acesso ao proxy, vazio "" desabilita função
            Registry.SetValue(userRoot, "ProxyServer", "192.168.0.254:2555", RegistryValueKind.String);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.