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. Using Registry Keys

Using Registry Keys

Scheduled Pinned Locked Moved C#
questionvisual-studiowindows-adminxmllounge
12 Posts 7 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.
  • R Offline
    R Offline
    Richard Blythe
    wrote on last edited by
    #1

    Hello All, For the past few apps, I have used XML files to store user preferences and other program related data. Lately, I've been thinking about transitioning to registry keys for storing program values. My two main reasons are: 1. They are lightweight. 2. More concealed from the user. However, I've read that issues can arise between 32bit and 64bit machines. What is the general opinion on using registry keys vs XML?

    The mind is like a parachute. It doesn’t work unless it’s open.

    M T L P L 6 Replies Last reply
    0
    • R Richard Blythe

      Hello All, For the past few apps, I have used XML files to store user preferences and other program related data. Lately, I've been thinking about transitioning to registry keys for storing program values. My two main reasons are: 1. They are lightweight. 2. More concealed from the user. However, I've read that issues can arise between 32bit and 64bit machines. What is the general opinion on using registry keys vs XML?

      The mind is like a parachute. It doesn’t work unless it’s open.

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      I would any day go xml configuration. Advantage is portability. You can just copy paste your application directory and you are ready to go. As far as security is concerned and you do not want user to tweak it, better encrypt it :)

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      R 1 Reply Last reply
      0
      • R Richard Blythe

        Hello All, For the past few apps, I have used XML files to store user preferences and other program related data. Lately, I've been thinking about transitioning to registry keys for storing program values. My two main reasons are: 1. They are lightweight. 2. More concealed from the user. However, I've read that issues can arise between 32bit and 64bit machines. What is the general opinion on using registry keys vs XML?

        The mind is like a parachute. It doesn’t work unless it’s open.

        T Offline
        T Offline
        The Man from U N C L E
        wrote on last edited by
        #3

        You are correct regarding the 32 bit/64 bit issue. The keys would be stored in separate points in the registry, however this should not be a problem generaly. The only issue is if you create registry keys as part of your installer (which is always 32 bit) then they will not be available to the appliction running in 64 bit. However if your app just generated the keys if missing then there is no problem. As the other poster said, use of the registry makes you application non-portable, but that may not be an issue. The main question should be, do you need secure storage of this information? If the answer is yes, then encrypt it and store it in the registry. If the answer is no then xml is the easier, quicker and more simply manageable route to take.

        If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

        D 1 Reply Last reply
        0
        • M Manas Bhardwaj

          I would any day go xml configuration. Advantage is portability. You can just copy paste your application directory and you are ready to go. As far as security is concerned and you do not want user to tweak it, better encrypt it :)

          Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          R Offline
          R Offline
          Richard Blythe
          wrote on last edited by
          #4

          I would rather the user not see it all. :) I agree that being portable is a great reason to use XML.

          The mind is like a parachute. It doesn’t work unless it’s open.

          1 Reply Last reply
          0
          • R Richard Blythe

            Hello All, For the past few apps, I have used XML files to store user preferences and other program related data. Lately, I've been thinking about transitioning to registry keys for storing program values. My two main reasons are: 1. They are lightweight. 2. More concealed from the user. However, I've read that issues can arise between 32bit and 64bit machines. What is the general opinion on using registry keys vs XML?

            The mind is like a parachute. It doesn’t work unless it’s open.

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

            Personally I hate Windows registry. I would stick with XML. Issues could arise from different machines but if you are accessing the registry locally then it shouldn't be a problem. What I am saying is if you develop a x86 application it will read from the x86 (wow6432node) on a x64 system. Also I noticed you are trying to keep it away from the user. Just because it is in the registry doesn't mean it is secure. I would stick with XML and just encrypt your values and decrypt them in your application. This way a user cannot read it. You could also run into permission problems using the registry. I've seen problems where people were running McAfee and it did some weird stuff with not letting values in the registry being edited/removed.

            1 Reply Last reply
            0
            • T The Man from U N C L E

              You are correct regarding the 32 bit/64 bit issue. The keys would be stored in separate points in the registry, however this should not be a problem generaly. The only issue is if you create registry keys as part of your installer (which is always 32 bit) then they will not be available to the appliction running in 64 bit. However if your app just generated the keys if missing then there is no problem. As the other poster said, use of the registry makes you application non-portable, but that may not be an issue. The main question should be, do you need secure storage of this information? If the answer is yes, then encrypt it and store it in the registry. If the answer is no then xml is the easier, quicker and more simply manageable route to take.

              If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              The Man from U.N.C.L.E. wrote:

              (which is always 32 bit)

              Not true as of Windows Installer 2.0 when 64-bit support for IA64 platforms was added. That support has since grown to cover everything 64-bit available today.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008
              But no longer in 2009...

              1 Reply Last reply
              0
              • R Richard Blythe

                Hello All, For the past few apps, I have used XML files to store user preferences and other program related data. Lately, I've been thinking about transitioning to registry keys for storing program values. My two main reasons are: 1. They are lightweight. 2. More concealed from the user. However, I've read that issues can arise between 32bit and 64bit machines. What is the general opinion on using registry keys vs XML?

                The mind is like a parachute. It doesn’t work unless it’s open.

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                I use XML for simple things and a database for more complex things. The registry is evil.

                R 1 Reply Last reply
                0
                • R Richard Blythe

                  Hello All, For the past few apps, I have used XML files to store user preferences and other program related data. Lately, I've been thinking about transitioning to registry keys for storing program values. My two main reasons are: 1. They are lightweight. 2. More concealed from the user. However, I've read that issues can arise between 32bit and 64bit machines. What is the general opinion on using registry keys vs XML?

                  The mind is like a parachute. It doesn’t work unless it’s open.

                  L Offline
                  L Offline
                  Lukasz Nowakowski
                  wrote on last edited by
                  #8

                  It was repeated on the forum several times. Registry is bad. You don't know if your application's user will be able to access registry. Only administrators can do it (I don't remember how it was on Windows XP, but I'm sure that's true for Vista and 7). Another thing is that when your user wants to check, what you store, he can also check registry. It's not hidden from users. I would recommend (as people answered here) encrypting your XML configuration and store it somewhere in user profile directory. This way checking what you store will be difficult (but not impossible).

                  Don't forget to rate answer, that helped you. It will allow other people find their answers faster.

                  1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    I use XML for simple things and a database for more complex things. The registry is evil.

                    R Offline
                    R Offline
                    Richard Blythe
                    wrote on last edited by
                    #9

                    All of these answers have been great. I think I'll stick to XML.

                    PIEBALDconsult wrote:

                    The registry is evil.

                    I'll stay away from the curse. :laugh:

                    The mind is like a parachute. It doesn’t work unless it’s open.

                    1 Reply Last reply
                    0
                    • R Richard Blythe

                      Hello All, For the past few apps, I have used XML files to store user preferences and other program related data. Lately, I've been thinking about transitioning to registry keys for storing program values. My two main reasons are: 1. They are lightweight. 2. More concealed from the user. However, I've read that issues can arise between 32bit and 64bit machines. What is the general opinion on using registry keys vs XML?

                      The mind is like a parachute. It doesn’t work unless it’s open.

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

                      Btw, you probably know this, but you can't really keep anything from the user. Normal users aren't going to mess around with the registry or even XML files. Users like me will still mess around with encrypted data, and you can't do anything about it, the way to decrypt it will be in the application.

                      R 1 Reply Last reply
                      0
                      • L Lost User

                        Btw, you probably know this, but you can't really keep anything from the user. Normal users aren't going to mess around with the registry or even XML files. Users like me will still mess around with encrypted data, and you can't do anything about it, the way to decrypt it will be in the application.

                        R Offline
                        R Offline
                        Richard Blythe
                        wrote on last edited by
                        #11

                        harold aptroot wrote:

                        Normal users aren't going to mess around with the registry or even XML files.

                        You right. I seem to proccess the end user's mind set through my own curiosity driven brain. :-D I store my XML file within the CommonAppDataPath folder which is buried deep inside the drive's root directory. This should be hidden enough for a normal user.

                        The mind is like a parachute. It doesn’t work unless it’s open.

                        L 1 Reply Last reply
                        0
                        • R Richard Blythe

                          harold aptroot wrote:

                          Normal users aren't going to mess around with the registry or even XML files.

                          You right. I seem to proccess the end user's mind set through my own curiosity driven brain. :-D I store my XML file within the CommonAppDataPath folder which is buried deep inside the drive's root directory. This should be hidden enough for a normal user.

                          The mind is like a parachute. It doesn’t work unless it’s open.

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

                          Most people don't even know that such a place exists :)

                          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