• Welcome to Valhalla Legends Archive.
 

Registry vs. .ini

Started by iago, November 18, 2004, 05:32 PM

Previous topic - Next topic

iago

Since people suck at going off topic in different threads, I'll just start this here:

Quote from: Zakath on November 18, 2004, 12:03 PM
Quote from: iago on November 18, 2004, 11:57 AM1. I format frequently, and it's much easier to back up programs that don't have a presence in the registry.
See, I consider formatting a time consuming nuisance. I do it as infrequently as I can practically manage.
Quote2. Programs are more easily ported to/used in Linux if they don't use the registry.
This is a chat client that is completely based on the Windows API we're talking about here. There'd be no point in porting it to linux; it'd make far more sense to just write a new one from scratch. :P
Quote3. It's much easier to find/edit configurations by hand if they are files.  Unless they put the files somewhere stupid. but eh.
Pfft...what are you doing editing these things by hand, anyway? That's what the config dialog is for. :)

1. What if something happens and you're forced to format?  It's a real pain to get registry information over only for what you need. 

2. I'm talking about in general. 

3. There are libraries to do it for you.  I tend to use java.util.Properties, and I've seen one in VB.

And what if some setting stops the program from starting that you need to edit? 
What if you need to do a find/replace that'll change a dozen or a hundred keys? 
What if regedit gets infected with a virus, or maybe you can't run ANY programs?  If your startup file was stored as an .ini, you could easily stop the virus from starting up.

I'm sure there's other reasons, but those are good ones :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


MyndFyre

Quote from: iago on November 18, 2004, 05:32 PM
Since people suck at going off topic in different threads

I know that comment was directed at me.  Bite me.  :p
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

iago

Quote from: MyndFyre on November 18, 2004, 09:09 PM
Quote from: iago on November 18, 2004, 05:32 PM
Since people suck at going off topic in different threads

I know that comment was directed at me. Bite me. :p
Also Zakath :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Zakath

Well, it's not like there was much to say about the real thread. :P
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Skywing

You can actually back up and restore the registry, in part or in whole (little known as this may be).

mynameistmp

Is this supposed to be a discussion about the pros and cons of either method of storing configuration info (registry/.ini)?

Is it only registry vs .ini , or is it more broad; binary vs plain text ?
"This idea is so odd, it is hard to know where to begin in challenging it." - Martin Barker, British scholar

iago

Skywing -- It's troublesome to back up the registry, though.  It's much easier when you can just copy the folders over and watch it continue to work. 
Tmp -- Meh, both is good :)

Another thing that I like that Windows programs never seem to do is store configuration files in my home folder.  Tmp actually taught me the most about this, but what's really handy is to set up Linux like:
- Install the OS on one partition, like 2gb
- Install /home on a different partition, probably another 2gb
- Install /usr/local on a third partition, make it big

Then install any software to /usr/local.  All software puts its settings in your home folder.  So if something comes up and you need to reinstall the OS (like a couple weeks ago I stupidly did a recursive chown as root from the wrong folder), I can blow out the os (format my OS partition) and reinstall it, and all my software still works!  I didn't have to reinstall Apache, I didn't have to reinstall Java, etc.  Doing that is *extremely* handy!  The only thing I lost was my /etc/passwd and /etc/hosts, which wasn't a big deal.

That's a little off the main topic, but it still applies to configuration files vs. registry.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Skywing

Actually, they probably are, you just don't realize it (the hive backing HKCU is stored in your user profile directory).

Arta

hmm, if you had lots of programs to back up, it might be easier if they all used registry: backing up a section of the registry is probably easier than finding 283723 different configuration files :)

MyndFyre

Quote from: iago on November 19, 2004, 07:34 AM
Another thing that I like that Windows programs never seem to do is store configuration files in my home folder.  Tmp actually taught me the most about this, but what's really handy is to set up Linux like:
- Install the OS on one partition, like 2gb
- Install /home on a different partition, probably another 2gb
- Install /usr/local on a third partition, make it big

I realize you're comparing Windows to Linux at this point, but I thought I'd make the point that the "Designed for Windows" Logo Program requires that you use the Registry and user home folders to store settings and logs and output files.  I've followed that practice somewhat with my bot's development (which is on hold atm) -- it stores installation path in HKLM\Software\ArmaBot, and user profile path in HKCU\Software\ArmaBot.

When it starts, if you don't have a folder already in your My Documents folder called ArmaBot (or if it's beta, whatever version it is), it creates one, and stores a few different configuration settings there.  My directory structure looks like this:
--My Documents\
-----ArmaBot Beta 1\
-------ProfilesList.xml (which is just a list of the profile names, in this case, DTAAUSEast and MFUSWest).
-------DTAAUSEast\
----------ArmaBot.BinaryData.dat (user list)
----------DTAAUSEast.acp (XML file containing settings)
----------Logs\
-------------*.abl (Binary chat logs)
-------MFUSWest\
----------ArmaBot.BinaryData.dat (user list)
----------MFUSWest.acp (XML file containing settings)
----------Logs\
-------------*.abl (Binary chat logs)

This has gotten to be quite a bit off-topic, but I thought since you said that Windows apps don't do that with your home directory, I thought I'd show you that a combo of home directory settings files and registry settings would be good.  ;)
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

iago

Well, the reason I got into that Linux topic is because Linux doesn't have a registry, and everything uses textfiles, which I like.

Arta -- "scp -r ~ mybackupserver:/bak"
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


mynameistmp

One thing I don't like about configurations stored in a binary format is that you can't use simple CLI operations to edit them (unless someone has created end-user applications, which is just another layer for bugs to reside). Unrealircd configuration files can get fairly cumbersome so I typically edit them using a combination of stream editors. I could run a command like sed <oldconf >newconf -e 's/network.old.name/network.new.name/' to change the network name of the ircd. I'm not sure how you'd perform an operation like that on a configuration stored in binary format.
 
I figure by now MS must have implemented a solution for the registry creep phenomenon. Does anyone here know how they've solved it ? I was never really a fan of that either.
"This idea is so odd, it is hard to know where to begin in challenging it." - Martin Barker, British scholar

Kp

Quote from: Arta[vL] on November 19, 2004, 07:57 AMhmm, if you had lots of programs to back up, it might be easier if they all used registry: backing up a section of the registry is probably easier than finding 283723 different configuration files :)

If all the files are stored in a centralized per-user directory, either way is easy.  iago was advocating storing data in per-user areas, not in the directory to which the binary was installed.

On a related note, and somewhat addressed to Skywing: how do you backup HKCU?  I've found that it's always locked when I'm logged in, so I have to log out and relog as a dedicated backup user (whose registry I don't mind losing) just to back up *my* ntuser.dat (which holds HKCU, as I understand it).  This is annoying and I'd be happy to hear a better solution.  Ideally, Windows oughtn't be setting a no-sharing lock on the file (instead, share it read-only).
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Skywing

I think you're supposed to use RegSaveKey(Ex).

Regedt32 lets you do this.

MyndFyre

Quote from: Kp on November 19, 2004, 06:16 PM
On a related note, and somewhat addressed to Skywing: how do you backup HKCU?  I've found that it's always locked when I'm logged in, so I have to log out and relog as a dedicated backup user (whose registry I don't mind losing) just to back up *my* ntuser.dat (which holds HKCU, as I understand it).  This is annoying and I'd be happy to hear a better solution.  Ideally, Windows oughtn't be setting a no-sharing lock on the file (instead, share it read-only).

I just use regedit.  With HKCU (or any other part of the hive(s)) selected, go to File->Export, and you'll generate a fine text-format file containing the registry data for that branch and all sub-branches.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.