Re: Best way to store "registry" config data for portable apps?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 05/19/04


Date: Wed, 19 May 2004 18:11:02 -0400

The notion of per-directory initialization is common. But in the cases where I need that,
I prefer to use XML representations, rather than .INI files, for all the previuosly cited
reasons: XML, like the Registry, is hierarchical, can store complex information easily,
and do not have artificial upper bounds on the amount of data. .INI files require complex
data require a complex parser (while XML uses a complex parser, it is the same parser as
every other XML data structure uses). But the parsing was always a problem (as I say,
think about how you would store window placement data, fonts, and similar complex
information using a .INI file.

Driver information is HKEY_LOCAL_MACHINE, and as such, it would not make sense to have
multiple instances of this.

So if I needed to keep this information local, I'd use XML. What I tend to do right now is
do queries into the XML structure to locate the attribute I need, and then I can iterate
the subtrees or use attributes to retrieve the attributes I need.

I've thought about writing this up, but I need to seriously "sanitize" it to remove
proprietary code before I can write it up, and I have limited time right now.
                                        joe

On Wed, 19 May 2004 14:53:15 GMT, John <zjboyguard-newsgrpsDELETETHISTOUSE@yahoo.com>
wrote:

>On Tue, 18 May 2004 00:58:10 -0400, Joseph M. Newcomer <newcomer@flounder.com> wrote:
>> It is a simple choice. .INI files are obsolete. So there is no decision process involved.
>
>Joe,
>
>I don't actually disagree with you, but I have a question in another direction. The questions pretty much boils down to how to deal with a problem which I think the registry is not designed to address.
>
>I have one of those 256MB portable USB portable storage thingee's. I've noticed that whenever you install or run a Windows app from this USB drive, the app stores/extracts it's usage info from the system registry. This doesn't sound like it would be a problem, but in practice I've found it has annoying consequences.
>
>An aspect of an app specific .INI file which I (think I) like is that if you have the same app installed on different media the configuration data for the app is easily localized to the separate .INI files stored with the app.
>
>Is there some "standard"/recommended way to store "portable" configuration data in Windows? A way to save app config/install info which is specific to the media you're running the application from?
>
>-irrational john

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: Registry replacement advice
    ... depending on OS), a la, INI files. ... usually a better choice than rolling 'ur own - XML, database, etc. ... AllUsers/AppData, others in the Registry, etc. ... replacement for INI files uses an XML format instead of Key/Value pairs, ...
    (microsoft.public.vb.general.discussion)
  • Re: [INI Specs]
    ... Key0="What are the specs for INI files? ... If the file has the 2 byte prefix for Unicode, ... W function, you can save Unicode data, however, you must create the file ... Another alternative is XML, which has no size limit and can use UTF-8. ...
    (microsoft.public.vb.general.discussion)
  • Re: Google and validation
    ... INI files, but one can use an XML application that stores the same ... I believe QuickBooks' SDK uses XML as well in its calls and replies. ... Ant (apache) ...
    (alt.internet.search-engines)
  • Re: INI or XML
    ... Many people prefer XML files over standard INI files because of the "XML hype". ... INI files are more readable and even an "untrained" user will be able to edit them. ... Alternatively you can write the data to the registry using 'SaveSetting'/'GetSetting' or the 'Microsoft.Win32.Registry' class. ... Storing and loading user preferences ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Using a Xml Reader II
    ... Going to get some cuban coffee;) ... So far I'm finding that trying to use XML instead of .INI files is ... > For instance, if I wanted a string from an .INI file, I would use ...
    (microsoft.public.dotnet.languages.csharp)