Using Registry Keys
-
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.
-
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.
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.
-
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.
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]
-
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.
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.
-
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.
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.
-
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]
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... -
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.
I use XML for simple things and a database for more complex things. The registry is evil.
-
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.
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.
-
I use XML for simple things and a database for more complex things. The registry is evil.
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.
-
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.
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.
-
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.
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.
-
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.