Live data from Hacker News

Why the Windows Registry sucks technically (2010)

rwmj.wordpress.com

281–290 of 342 posts

Re: Why the Windows Registry sucks technically (2010)

#281
post #39

A point being overlooked by article and commenters: the records in the registry probably use in the order of 10-100 bytes each, while every actual file takes up at least around 1024 (EDIT: maybe more like 4096?) bytes. Putting tiny 'files' into a special format is a no-brainer on the older computers that existed when the Registry was first created. I am assuming this was one of the motivations to create the Registry…

Extracted from the "Rationale" section of https://en.wikipedia.org/wiki/Windows_Registry 1) Since file parsing is done much more efficiently with a binary format, it may be read from or written to more quickly than a text INI file. 2) Strongly typed data can be stored in the registry, as opposed to the text information stored in .INI files. 3) Because user-based registry settings are loaded from a user-specific path…

I don't really see a reason to believe this list is comprehensive, especially looking at the sources.

Re: Why the Windows Registry sucks technically (2010)

#282
When a problem like this has equally bad solutions between Windows or Linux (or macos) it means the problem really isn't solved yet. This is kind of exciting, actually. It is one of those spaces where the XKCD "standards" joke plays out, but there really is an opportunity for someone to come along and solve it.

Re: Why the Windows Registry sucks technically (2010)

#283

I really appreciate when people use technical facts to criticize something, like with this. It is a well written take-down of the implementation of the Windows Registry as of both today and 2010. I suspect if the concept of the registry was created today it would look more like a database (e.g. Sqlite), although organizing it like a virtual FileSystem does have a certain appeal, and unfortunately I don't know of a da…

> I suspect if the concept of the registry was created today it would look more like a database (e.g. Sqlite), although organizing it like a virtual FileSystem does have a certain appeal, and unfortunately I don't know of a database engine that supports such a layout.

I think you might mean relational database. IIRC, the registry is already a database, just not a relational one.

Re: Why the Windows Registry sucks technically (2010)

#284

I really appreciate when people use technical facts to criticize something, like with this. It is a well written take-down of the implementation of the Windows Registry as of both today and 2010. I suspect if the concept of the registry was created today it would look more like a database (e.g. Sqlite), although organizing it like a virtual FileSystem does have a certain appeal, and unfortunately I don't know of a da…

I'm a big fan of the macOS method where there's an OS API to manipulate the user defaults (as its called) but they are actually just stored as files in a standardized format (usually XML). You get the pros of the standardization and the pros of user manipulation (like easily deleting the corrupted settings of some app by removing one or two files)

Plasma/KDE has this with the kreadconfig5 and kwriteconfig5 commands, and it uses a simple INI-like format: https://userbase.kde.org/KDE_System_Administration/Configura...

GNOME has the gsettings command for this, which is the equivalent of the `defaults` command in macOS. Many guides still refer users to the `dconf` command, though, which is technically a lower-level tool but basically does the same thing for 99.999% of GNOME installations. (Users/distro-makers can actually choose the storage format on GNOME's case.)

Re: Why the Windows Registry sucks technically (2010)

#285

Earlier quoted context omitted.

.config/ and .local/ are the de facto /etc for users, but there is the set of XDG_ environment variables that are intended to fill that role.

Well, my git, ssh, caches of what not, almost everything is in my home directory directly. It's even worse than "My Documents"

„My Documents” isn’t the same as a home directory. Home directory in recent Windows versions is „C:\Users\CurrentUserName”. Or better: %homedrive%%homepath%.

Re: Why the Windows Registry sucks technically (2010)

#286
In theory it is a great concept. "lets put all the configuration in one place" in reality it ends up being super annoying, It is hard to say why, but after a bit of thought I think my main objection to the registry is that it is yet another tree but this one is out of band. windows is already bad about this, what with the drive letters, and the way the shell(explorer) tries to present it's own magical imaginary view of the filesystem. the registry just takes that and dials it to 11, now you have a special tree, that needs it's own specific tools to use.

I think one of the key innovations of unix was the unix filesystem and the way it made everything one tree, one unified interface for everything is an amazing concept, In fact I think that the real innovation of unix was it's simplicity. now later this was messed up (yeah berkeley, I am putting most of the blame for that on you) with sockets, sysctl, etc. Or in short every unix interface that ignores the one true API, the filesystem(which is for the most part open, read write, seek, close)

In conclusion, whenever I see a tree but whoever made it decided that no, we are a special snowflake, and are not going to attach this tree to the main tree of data on your system(the filesystem) it bugs me. The rogues gallery here include gnome config, sysctl, dbus, and yes the windows registry.

Re: Why the Windows Registry sucks technically (2010)

#287
post #61

Earlier quoted context omitted.

> Manually editing the registry though... That way lies madness. It's much scarier and it's much more fragile. How... exactly? There's no way to create a syntax error as trivial as you can in config files. How is using regedit or powershell commands more fragile (I understand "scarier" in a way everything you're not used to is scary).

Well the article points to a way of preventing following entries to be read by having an entry in non alphabetical order. But how often have you ran into syntax errors for system configuration files in Linux? I can't say that this has been much of an issue in my experience.

That's because the article is about doing binary edits to to the registry files themselves, something no application or user should ever do. Instead changes should be done through the API or the regedit program.

Re: Why the Windows Registry sucks technically (2010)

#288

I really appreciate when people use technical facts to criticize something, like with this. It is a well written take-down of the implementation of the Windows Registry as of both today and 2010. I suspect if the concept of the registry was created today it would look more like a database (e.g. Sqlite), although organizing it like a virtual FileSystem does have a certain appeal, and unfortunately I don't know of a da…

hence I’ve always appreciated how mac OSX has done it: filesystem, but with a standard file format (plist files). Any well behaved mac app, if it misbehaves I can just go and delete the app settings plist and it’s just like a reinstall, since everything else is in a readonly bundle.

Re: Why the Windows Registry sucks technically (2010)

#289
post #54

Earlier quoted context omitted.

I do wonder what RegEdit.exe does here. Does it infer encoding, have a long list of key-to-encoding mappings, or a combination of the two? I did a bit of experimentation on this too and we think it has a heuristic to guess encodings of strings. (Which to be fair isn't a terrible idea - it's very easy and almost entirely reliable to determine if a string is ASCII/UTF-8 or UTF-16LE which are the major encodings found.)

Based on the documentation[1], it seems clear that strings are stored in Unicode (which should be UTF-16LE). If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, and the ANSI version of this function is used (either by explicitly calling RegGetValueA or by not defining UNICODE before including the Windows.h file), this function converts the stored Unicode string to an ANSI string before copying it to the b…

To be more precise, like most of Windows, it just stores 16-bit codepoints as such, meaning that it's not necessarily always valid UTF-16LE (in the presence of invalid surrogate pairs).

Re: Why the Windows Registry sucks technically (2010)

#290

Earlier quoted context omitted.

The problem of removing applications together with their configurations is trivially solved in the various Linux-based systems where any software package is installed only inside a private directory. Any files that would be expected to be in shared directories like /usr/bin, /usr/lib or /etc, are replaced by symbolic links. Except for symbolic links, the installation of a package must not change anything outside its…

You can do similar on windows. However, the registry was turned into trying to solve a slightly different issue of roaming users, and centrally managed settings, split by machine and user, and using what became active directory. They started off with OLE and its central store of holding name value pairs in a tree. Basically making the registry do at least 4 different things. Only one of them it does 'ok' (COM/OLE loo…

It should be noted that putting configuration into files rather than registry has been the standing recommendation on Windows for a very long time now. For example, .NET 2.0 (2005) added a standard facility for application settings, and it was implemented on top of XML .config files.
Post reply on HN