Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to create registry key in Windows VISTA OS ?

How to create registry key in Windows VISTA OS ?

Scheduled Pinned Locked Moved C#
csharpwindows-adminhelptutorialquestion
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi All I want to create below key in Vista OS in my C# application. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System After the key creation i want to write NoDispCPL (DWORD)value to 1. On vista onwards i am anable to create the key. Can any one help ? Thanking You, Sunil G.

    M 1 Reply Last reply
    0
    • L Lost User

      Hi All I want to create below key in Vista OS in my C# application. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System After the key creation i want to write NoDispCPL (DWORD)value to 1. On vista onwards i am anable to create the key. Can any one help ? Thanking You, Sunil G.

      M Offline
      M Offline
      monstale
      wrote on last edited by
      #2

      Hi, could you send code, how you create the key, please greetz

      L 1 Reply Last reply
      0
      • M monstale

        Hi, could you send code, how you create the key, please greetz

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Hi, I am using below method to write value RegistryKey myRegKey = Registry.CurrentUser; myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); Registry.SetValue(myRegKey.ToString(), "NoDispCPL", 123, RegistryValueKind.DWord); Regards, Sunil G.

        M C 2 Replies Last reply
        0
        • L Lost User

          Hi, I am using below method to write value RegistryKey myRegKey = Registry.CurrentUser; myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); Registry.SetValue(myRegKey.ToString(), "NoDispCPL", 123, RegistryValueKind.DWord); Regards, Sunil G.

          M Offline
          M Offline
          monstale
          wrote on last edited by
          #4

          Hi, what you do exactly mean by "unable to create" ? Is there an error, or do you don't find the key in registry? This article might help in last case: Windows Vista inbuilt sandbox registry[^] Hope it helps bye

          L 1 Reply Last reply
          0
          • M monstale

            Hi, what you do exactly mean by "unable to create" ? Is there an error, or do you don't find the key in registry? This article might help in last case: Windows Vista inbuilt sandbox registry[^] Hope it helps bye

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Hi, I am not getting any error and also registry is not created. Exe is runing under system account. If I run as an administrator then only it creates the registry. Regards, Sunil G.

            M B 2 Replies Last reply
            0
            • L Lost User

              Hi, I am not getting any error and also registry is not created. Exe is runing under system account. If I run as an administrator then only it creates the registry. Regards, Sunil G.

              M Offline
              M Offline
              monstale
              wrote on last edited by
              #6

              Hi, did you try do read the key by your program or with regedit? Try to read it by your program ;-) bye

              L 1 Reply Last reply
              0
              • M monstale

                Hi, did you try do read the key by your program or with regedit? Try to read it by your program ;-) bye

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Hi, I have tried to read/write by regedit, it works fine. but through my program it does not work. Bye

                1 Reply Last reply
                0
                • L Lost User

                  Hi, I am not getting any error and also registry is not created. Exe is runing under system account. If I run as an administrator then only it creates the registry. Regards, Sunil G.

                  B Offline
                  B Offline
                  bgmeek
                  wrote on last edited by
                  #8

                  User Account Control (UAC) is the problem here. It only allows administrators to change or add keys, reading keys is no problem. There is no way to bypass this, unless you disable UAC.

                  1 Reply Last reply
                  0
                  • L Lost User

                    Hi, I am using below method to write value RegistryKey myRegKey = Registry.CurrentUser; myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); Registry.SetValue(myRegKey.ToString(), "NoDispCPL", 123, RegistryValueKind.DWord); Regards, Sunil G.

                    C Offline
                    C Offline
                    Calla
                    wrote on last edited by
                    #9

                    Some people have suggested that the UAC might be the problem here, and it could be if you don't force your application to be run under the admin account. But, try this as well: When you open the myRegKey make sure you open it for both reading AND writing. This is done by using the OpenSubKey method like this: myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", true); (You left out the second parameter..) Good luck!

                    L 1 Reply Last reply
                    0
                    • C Calla

                      Some people have suggested that the UAC might be the problem here, and it could be if you don't force your application to be run under the admin account. But, try this as well: When you open the myRegKey make sure you open it for both reading AND writing. This is done by using the OpenSubKey method like this: myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", true); (You left out the second parameter..) Good luck!

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      It is not working. Can u give me sample code?

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups