News for hackers. Stuff that matters.
Re:Why the Windows Registry sucks technically (2010) by Someone1234 on Friday July 29, 2022 @07:22AM (#32275561)
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 database engine that supports such a layout. The Registry's Key-Value pairs are 1:1 with a database table's column-values pairs, it is just the multiple tiers of organizing "folders" above that that are a difficult implementation detail.

The UNIX way is undeniably more flexible since it isn't a virtual filesystem, it is just a filesystem. The problem is that everyone invented their own configuration format to store configuration data in /etc and there's no format agnostic API to access that information (you can open it, but can you understand it?).

Both UNIX and Windows suffer from the same orphan issue wherein information can be written, the application removed, and it is unsafe to ever remove it since you may not know the author and or all consumers.

Re:Why the Windows Registry sucks technically (2010) by bluetomcat on Friday July 29, 2022 @07:31AM (#32275628)
> The UNIX way is undeniably more flexible since it isn't a virtual filesystem, it is just a filesystem.

Unix simply doesn't have a "way" in that regard, other than a loose convention to put text files in "/etc". Every application comes up with its own format. Parsing that file is application-specific. Updating a value in a text file means re-writing the whole file again. It is a technically-inferior approach that has survived in time because text files are still text files.

Re:Why the Windows Registry sucks technically (2010) by lelanthran on Friday July 29, 2022 @08:13AM (#32275938)
> Unix simply doesn't have a "way" in that regard, other than a loose convention to put text files in "/etc".

So? The registry doesn't have much of a way either - the actual fields are simply a loose convention.

> Every application comes up with its own format.

Same with Windows applications - one application might store an IP address as a dotted-octet string, another might store it as a single 32 bit integer.

> Parsing that file is application-specific.

Same for Windows applications; the subtree for any application is very specific to that application and almost always differs from the subtree for other applications.

> Updating a value in a text file means re-writing the whole file again.

Not a problem, when it means that breaking a value in a text file breaks only that one application. Break the registry almost always breaks something else, if not the entire system.

I'm not saying files in /etc aren't without their problems, I'm saying that all /etc problems are already present in the registry, but the registry adds a few more of its own.

Re:Why the Windows Registry sucks technically (2010) by mmis1000 on Friday July 29, 2022 @12:27PM (#32278957)
> the actual fields are simply a loose convention.

Let alone some windows program end up just save a blob in it and totally ignore the typing.

Who care about the field type if I can save everything in a single blob(?

Re:Why the Windows Registry sucks technically (2010) by yndoendo on Friday July 29, 2022 @03:01PM (#32280591)
Even Microsoft likes to save blobs.

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData]\UserFilter

Re:Why the Windows Registry sucks technically (2010) by jbverschoor on Friday July 29, 2022 @08:54AM (#32276236)
I can’t and shouldn’t be able to write to /etc as an ordinary or guest user.

Er-readying values isn’t done usually with apps.

You can get corrupted files if two instances fight for the same file. If that’s your thing, please use mongo. Also, please provide support to all the users.

Lastly, if you messed up certain configuration or data files, your system won’t boot either on ANY system.

Sounds like you’re just one of many anti-windows people, exactly what was pointed out about people bashing the registry.

Re:Why the Windows Registry sucks technically (2010) by deelowe on Friday July 29, 2022 @10:04AM (#32277044)
> I can’t and shouldn’t be able to write to /etc as an ordinary or guest user.

You're right, you shouldn't. If you are able to, your distro is very odd and I'd recommend seeking a new one.

> Sounds like you’re just one of many anti-windows people, exactly what was pointed out about people bashing the registry.

There's no need to attack people.

Re:Why the Windows Registry sucks technically (2010) by chasil on Friday July 29, 2022 @10:49AM (#32277657)
This is emphatically NOT true.

If you absolutely could not write to /etc, then you would never be able to change your password.

The passwd, chsh, chfn, and other utilities allow a non-privileged user to make controlled changes to privileged files via the setuid/gid system calls.

A user can trigger controlled writes to files in /etc.

Re:Why the Windows Registry sucks technically (2010) by 5e92cb50239222b on Friday July 29, 2022 @11:20AM (#32278078)
> If you absolutely could not write to /etc, then you would never be able to change your password.

Since we're talking about Linux, I would refrain from using absolute clauses like "never".

systemd-homed allows you to create "portable" user profiles which contain everything pertaining to a particular user, including his password. So user profiles (including your files, etc) can be moved between computers simply by rsync'ing that directory, or putting it on a network share.

`homectl passwd` (which changes a portable user's password) does not require writable /etc.

I think I've seen a few other solutions like that.

https://wiki.archlinux.org/title/Systemd-homed

https://systemd.io/HOME_DIRECTORY/

Re:Why the Windows Registry sucks technically (2010) by RedShift1 on Friday July 29, 2022 @02:56PM (#32280527)
Users can not write to /etc, those programs like passwd can because they have the suid bit on and run as root regardless of which user initiated the process.
Re:Why the Windows Registry sucks technically (2010) by Blikkentrekker on Friday July 29, 2022 @12:30PM (#32278999)
It's more so that users can ask the administrator to write to `/etc/` for them.

The administrator in this case has an automated tool that handles this requæst but the actual user the writing occurs under is the root user.

Re:Why the Windows Registry sucks technically (2010) by mecsred on Friday July 29, 2022 @11:29AM (#32278220)
That's like saying you've broken RSA because you can cause controlled reads. All you have to do is send the encrypted message to the intended recipient and wait for them to decrypt it.
Re:Why the Windows Registry sucks technically (2010) by deelowe on Friday July 29, 2022 @10:56AM (#32277770)
That's being a bit pedantic innit?
Re:Why the Windows Registry sucks technically (2010) by lelanthran on Monday August 01, 2022 @04:42AM (#32303479)
Maybe in OPs opinion, using `passwd` to write to `/etc/passwd` is not the same thing as using the registry API to write to the registry?

Personally, I feel it is the same thing.

Re:Why the Windows Registry sucks technically (2010) by lelanthran on Friday July 29, 2022 @08:58AM (#32276264)
> I can’t and shouldn’t be able to write to /etc as an ordinary or guest user

I don't believe you can. What distribution is this?

Re:Why the Windows Registry sucks technically (2010) by jbverschoor on Friday July 29, 2022 @09:01AM (#32276288)
Point about /etc is that it’s just one part of “configuration”.

There’s no /etc for users. That’s why we get all these dot.dirs. At least some apps use ~/.config/

Re:Why the Windows Registry sucks technically (2010) by augustk on Friday July 29, 2022 @10:27AM (#32277353)
"$XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used."

https://specifications.freedesktop.org/basedir-spec/basedir-...

Re:Why the Windows Registry sucks technically (2010) by hiptobecubic on Friday July 29, 2022 @10:21AM (#32277285)
.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.
Re:Why the Windows Registry sucks technically (2010) by jbverschoor on Friday July 29, 2022 @04:08PM (#32281260)
Well, my git, ssh, caches of what not, almost everything is in my home directory directly. It's even worse than "My Documents"
Re:Why the Windows Registry sucks technically (2010) by viraptor on Saturday July 30, 2022 @08:20AM (#32286220)
Git uses XDG_CONFIG_HOME https://git-scm.com/docs/git-config#Files - putting the config directly in your home is just a choice.
Re:Why the Windows Registry sucks technically (2010) by jbverschoor on Sunday July 31, 2022 @02:17AM (#32293633)
It doesn’t in macOS.

It’s not a choice. It’s the default. It’s like saying it’s a choice to run mongodb without authentication.

Lastly, why should I be using XDG Desktop variables on something that don’t haveA desktop environment?

Re:Why the Windows Registry sucks technically (2010) by rad_gruchalski on Friday July 29, 2022 @07:37PM (#32282900)
„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) by yjftsjthsd-h on Friday July 29, 2022 @10:54AM (#32277723)
I'm pretty sure .local is the per-user /usr, and .config is /etc
Re:Why the Windows Registry sucks technically (2010) by db48x on Friday July 29, 2022 @11:45AM (#32278447)
You’re both correct; a fair number of applications put their configuration in ~/.local/share even though that wasn’t the intent.
Re:Why the Windows Registry sucks technically (2010) by indymike on Friday July 29, 2022 @08:39AM (#32276117)
> Updating a value in a text file means re-writing the whole file again. It is a technically-inferior approach that has survived in time because text files are still text files.

It always seems like registries are trying to solve three different problems: configuration, status and process shared state. Registries seem to work poorly compared to text files for configuration, and work somewhat well for some level of shared state. I think to compare functionality with Linux, you would have to compare /etc, .configs and the /proc filesystem.

As for tecnically inferior, the *ix approach seems to have made the right tradeoffs, via the hand of Darwin, rather than some brilliant engineering insight. The article did a good job of explaining what's wrong with Windows' implementation of the registry. What is right with the *ix approach is that configuration files are usually read on startup, and only written to when configuration is changed (which should be infrequent). This works really well for server software, command line utilities, and an awful lot of GUI software. For some GUI software, particularly where you have really complex feature sets, we need to save state of widgets (i.e. saving the default zoom level) and text files may be problematic for this (i.e two instances of the app running), and this is where the registry really shines.

Re:Why the Windows Registry sucks technically (2010) by mikepurvis on Friday July 29, 2022 @09:20AM (#32276480)
The biggest issue with etc is that it's owned by root and therefore read only from the application's point of view. So, a great fit for sysadmin-managed configuration, not so great for applications that are GUI-configurable. You end up with a tiered approach of defaults in lib, and cascaded overrides in etc and var.
Re:Why the Windows Registry sucks technically (2010) by cycomanic on Friday July 29, 2022 @10:17AM (#32277241)
> The biggest issue with etc is that it's owned by root and therefore read only from the application's point of view. So, a great fit for sysadmin-managed configuration, not so great for applications that are GUI-configurable. You end up with a tiered approach of defaults in lib, and cascaded overrides in etc and var.

What do you mean? You are mixing multiple things, most of var and lib are also only root writable (unless tied to a specific user). For GUI application you generally end up with a system where etc holds the system defaults and user configuration is in $XDG_USER_CONFIG which defaults to $HOME/.config. This is the case for the vast majority (>90%) of GUI applications.

If we're are talking state, that typically ends up $HOME/.cache (if it should be temporary) or $HOME/.local/var (if it should be persistent). There are also XDG variables for these but I forgot them at the moment.

So can you elaborate what you mean with your perceived problem?

Re:Why the Windows Registry sucks technically (2010) by ElectricalUnion on Friday July 29, 2022 @10:16AM (#32277225)
Most Linux GUI apps either litter your home folder with dotfiles, dotfolders (both disgusting) or they follow XDG Base Directory specifications and place configurations in ${XDG_CONFIG_HOME:-${HOME}/.config}
Re:Why the Windows Registry sucks technically (2010) by dklodh on Friday July 29, 2022 @01:44PM (#32279837)
Most don't even know of XDG. The reason is, there's no central documentation or route for the userland. By Linux, we understand, the kernel and to the kernel developers, that is true. So let alone the anarchy of the userland be handled by distributions and users.
Re:Why the Windows Registry sucks technically (2010) by account42 on Monday August 01, 2022 @04:03AM (#32303285)
https://specifications.freedesktop.org/basedir-spec/basedir-...

freedesktop.org is that central documentation. Sure, there are applications that don't implemente that spec but it is not for there not being any documentation but either because the maintainers of those applications don't care or because the applications are older than the spec and moving configuration is not always trivial.

Re:Why the Windows Registry sucks technically (2010) by tomcam on Friday July 29, 2022 @02:34PM (#32280323)
I don't mind dot files or dot folders, but I'm very open to better ideas. My app works on Mac, Linux, and Windows though. Any thoughts?
Re:Why the Windows Registry sucks technically (2010) by ElectricalUnion on Friday July 29, 2022 @03:00PM (#32280574)
There are several libraries that handle directory for you in the appropriate OS-specific manner.

One Rust example being https://github.com/dirs-dev/dirs-rs

> The library provides the location of these directories by leveraging the mechanisms defined by

> the XDG base directory and the XDG user directory specifications on Linux and Redox

> the Known Folder API on Windows

> the Standard Directories guidelines on macOS

Re:Why the Windows Registry sucks technically (2010) by 5e92cb50239222b on Friday July 29, 2022 @11:26AM (#32278175)
It's a great thing about etc. If your application `foobar` wants to write something to /etc and doesn't have root privileges (which it probably shouldn't), create a subdirectory /etc/foobar with owner `foobar:foober`, and write there all you want. Many applications do that and it works fine.
Re:Why the Windows Registry sucks technically (2010) by throw0101a on Friday July 29, 2022 @11:46AM (#32278449)
Strictly speaking /etc should be relatively static, and dynamic data should go into /var, so you (or the package installation) would create /var/lib/foobar with proper ownership.
Re:Why the Windows Registry sucks technically (2010) by ElectricalUnion on Friday July 29, 2022 @03:15PM (#32280725)
> Strictly speaking /etc should be relatively static

I really wish that was true but nasty stuff like wpa_supplicant/, resolv.conf (now usually a systemd-resolved managed symlink), NetworkManager/ and X11/ lives there, very mutable and often constantly changing under the hood.

Re:Why the Windows Registry sucks technically (2010) by vimsee on Friday July 29, 2022 @12:07PM (#32278681)
I have not seen any applications creating a user with the applications name. How can one avoid a naming conflict? Kate (a text editor) might be installed on a system by Kate (a person). What I have noticed however is that there are daemons running as root and is used as a "middle man" whenever an application running as a normal user needs some extra privilege.
Re:Why the Windows Registry sucks technically (2010) by pmontra on Friday July 29, 2022 @05:10PM (#32281819)
Desktop applications no, because they must run as the user (let's leave containers and sandboxes alone.) Servers yes, for example PostgreSQL creates the postgres user and runs as such.
Re:Why the Windows Registry sucks technically (2010) by silverlyra on Friday July 29, 2022 @12:44PM (#32279166)
OpenWRT worked around this by creating UCI, its own configuration system that it uses to generate all package-specific configuration files: https://openwrt.org/docs/guide-user/base-system/uci

Configuration for all supported packages is stored in files under /etc/config in UCI's own text format, and OpenWRT's init scripts generate service-specific config files based on the UCI settings when the service is (re)started. For example, to configure Samba, users don't edit smb.conf directly, they set UCI settings like samba.workgroup, sambashare.path, etc.

There's a `uci` command-line utility to read and modify settings, and UCI forms the basis for the OpenWRT web interface.

debconf does something similar for Debian packages, though I haven't seen any packages that use debconf to completely supplant vendor configuration formats the way UCI does. https://en.wikipedia.org/wiki/Debian_configuration_system

Re:Why the Windows Registry sucks technically (2010) by stockerta on Friday July 29, 2022 @08:10AM (#32275909)
I hate this fanatical love of the UNIX way. I really hate that as of today Windows is the only non UNIX OS. I trully believe that this fact set us back. No more exciting new OSes only boring unix.
Re:Why the Windows Registry sucks technically (2010) by ahartmetz on Friday July 29, 2022 @10:56AM (#32277771)
Is that you, Dave Cutler?

But more seriously, what do you want from an OS? Cleaner design? Plan 9 comes to mind. QNX is very elegant, too. Some microkernel thing? Fuchsia, but some say it's inelegant and overdesigned right off the bat. Minix has some nice properties but somehow nobody but Intel seems to use it. Also, QNX again (but as the name suggests it's similar to Unix)... Distributed computing? I don't know, seems OK to run it mostly in user space.

My favorite alternatives are Plan 9, QNX and L4 (I know it's not an OS), of which QNX is the only one I have actually used. Shame about Fuchsia, I believe the negative opinions because I looked at some documentation and code before I read them and had a sort of "THAT is supposed to be Google's better OS?!" moment.

Re:Why the Windows Registry sucks technically (2010) by Animats on Friday July 29, 2022 @03:54PM (#32281109)
QNX got a lot of things right, mainly in the area of interprocess communication. Interprocess communication came late to Unix/Linux, and it shows. Microservices under QNX work much better than under Linux. Interprocess communication is fast and works like a synchronous function call. Hard real time actually works with QNX. But QNX had nothing new on the database side.
Re:Why the Windows Registry sucks technically (2010) by kjellsbells on Friday July 29, 2022 @09:29PM (#32283522)
My concern isnt about Windows or Linux specifically but that something is lost when the garden only grows two plants. In, say, 1980 there were several unique OS streams, each with their own quirks: UNIX, Pick, VMS, etc.

It seems strange that we are essentially trading on isotopes of OS thinking from about 2000 when Linux took the mantle of UNIX and Windows converged on the XP code.

Is this it? Is producing an OS now so incredibly expensive and hard that we are never going to try again, and just keep bolting things on to what we have? I feel a little sad at that, even if the reasoning is impeccable.

Re:Why the Windows Registry sucks technically (2010) by palata on Saturday July 30, 2022 @03:26AM (#32284997)
Maybe it converged, just like other industries? Say, cars or planes have not fundamentally changed in decades. But would there be other designs that would make them so much better that it would be worth changing? That's not clear to me...
Re:Why the Windows Registry sucks technically (2010) by MomoXenosaga on Saturday July 30, 2022 @05:37AM (#32285482)
There's no money to be made in making an OS. Back when I was a child people were literally waiting outside stores for a new Windows. Windows 11 is given away for free.
Re:Why the Windows Registry sucks technically (2010) by BlueTemplar on Saturday July 30, 2022 @04:31AM (#32285234)
We'll always have TempleOS ! /ducks (RIP)
Re:Why the Windows Registry sucks technically (2010) by stragies on Friday July 29, 2022 @04:02PM (#32281198)
RIM (The Blackberry people) bought QNX. Do you know, if they have been good shepherds? Has that helped, or disadvantaged QNX as a viable solution proposal in the project space it had?.
Re:Why the Windows Registry sucks technically (2010) by ahartmetz on Friday July 29, 2022 @08:50PM (#32283293)
I'm not well informed. AFAIK customers like Porsche and Ford (with the fairly successful Sync 3 infotainment system) are still using it. I do know that Dan Dodge, QNX founder, developer 1 and great guy (speaker of my all time favorite conference keynote), has left Blackberry. Rumor has it that he was unhappy with the new leadership and direction for QNX.
Re:Why the Windows Registry sucks technically (2010) by f1refly on Friday July 29, 2022 @09:46AM (#32276803)
The people at nixos and guix are doing it differently. No longer is the configurarion just state in files, scattered who knows where that cannot be understood fully by anyone. Insteady everything is defined centrally and then neatly versioned and managed by the system. If you think the unix way of throwing files in a directory sucks, check them out!
Re:Why the Windows Registry sucks technically (2010) by behnamoh on Friday July 29, 2022 @12:28PM (#32278972)
Unfortunately, Nix's documentation sucks. Plus, there's a steep learning curve to the Nix programming language. I don't understand why they couldn't just use a language instead of inventing one that is only usable within the Nix system.

Overall, really cool idea (dropped my jaw when I first saw it in action), but poorly implemented.

Re:Why the Windows Registry sucks technically (2010) by pongo1231 on Friday July 29, 2022 @01:39PM (#32279787)
Wouldn't say there's a steep learning curve for the language itself, it's pretty easy to get a grasp around it imo. Here's a helpful page I used to quickly get familiar with the language: https://github.com/tazjin/nix-1p

What's rather messy about Nix is nixpkgs with its helper functions all over the place alongside pretty shallow / non-existent documentation (which is unrelated to the language). Thankfully they've started to work on that recently: https://discourse.nixos.org/t/documentation-team-flattening-...

Re:Why the Windows Registry sucks technically (2010) by momentoftop on Friday July 29, 2022 @02:25PM (#32280239)
I think it's all too easy to say they should have just used an existing language. The most obvious feature of the nix language is that it's lazy, because they want their enormous collection of configuration dictionaries computed on demand. There are no mainstream languages that are lazy.

Well, there's Haskell, and I expect any Haskell programmer to be able to pick up Nix very quickly.

Guix has gone with a strict language, Scheme, but I understand they have their own monadic DSL to cope with the peculiarities of following the Nix model. So again, not something that a mainstream language can do well, and even as a Schemer, you're going to have to learn their macro language.

Re:Why the Windows Registry sucks technically (2010) by nomel on Friday July 29, 2022 @12:13PM (#32278765)
This sounds incredible, assuming there's a clean way to pin versions/source of applications. It might make the fabled idea of a reproducible system possible.
Re:Why the Windows Registry sucks technically (2010) by momentoftop on Friday July 29, 2022 @02:19PM (#32280177)
They're already getting decent reproducibility of their curated package set, but some of us want to pin to a particular version of this, especially when creating our own private packages. That's where I'm finding I really want pinning.

The latest release has included "flakes", promoted from an add-on to an opt-in feature and which, among other things, lets me pin my dependencies and the environment I need to build my private projects. I then don't have to worry about going out of sync with the main package set, and I can share private projects in a (hopefully) fully reproducible way, with people using different versions of nix.

https://xeiaso.net/blog/nix-flakes-1-2022-02-21

Re:Why the Windows Registry sucks technically (2010) by f1refly on Thursday August 04, 2022 @02:53AM (#32339974)
Guix makes a big deal out of being fully reproducible. It is possible to pin versions, you basically state "I want package X while the guix repository is at commit hash Y". Every dependency of the package will be built and made available at the appropriate version and everything will work out. I used this to roll back fprintd when it broke due to a broken dependency and it worked without problems.
Re:Why the Windows Registry sucks technically (2010) by daxvena on Friday July 29, 2022 @08:58AM (#32276267)
I get where you're coming from, but I think the biggest pro for the "UNIX way" is that text on a filesystem extremely accessible. You don't need a specialized tool to read & modify configuration, you just need a text editor. And while there's no standard for how the data is structured, it's usually pretty easy to figure it out from context.

I think it's also really easy to underestimate all the tooling built around text. As soon as you try out some other way, you loose out on version control, diffing, grepping, and a whole bunch of other general tools built for text.

I think the only way to get around this is to build generalized tools for working with binary data as a data structure. The problem with this approach is that now you need to maintain a database that describes every possible binary format, where text editors only really have to concern themselves with ASCII & unicode to be useful for most cases.

Re:Why the Windows Registry sucks technically (2010) by pie_flavor on Friday July 29, 2022 @02:20PM (#32280189)
General Linux tools built for text, in a world where everything is plain text and the shell doesn't know how to navigate anything other than a file system. In PowerShell you can cd into HKEY_LOCAL_MACHINE as easily as any drive, and Select-String is perfectly capable of searching registry keys.

The baseline is only text and files on systems that don't have anything better to offer.

Re:Why the Windows Registry sucks technically (2010) by cma on Friday July 29, 2022 @02:42PM (#32280381)
Isnt there FuseFS for that? It can show the gconf registry as a file tree, allowing you to use tools like recursive diff etc. https://metacpan.org/release/LSIM/GConf-FS-0.01

Something flexible like FuseFS is sorely missing on windows, the stuff google drive had to do creating a new letter drive is pretty gnarly.

Re:Why the Windows Registry sucks technically (2010) by pie_flavor on Friday July 29, 2022 @02:51PM (#32280478)
Re:Why the Windows Registry sucks technically (2010) by cma on Friday July 29, 2022 @03:36PM (#32280944)
Interesting, I hadn't seen that. Did Google Drive go with the virtual drive letter thing mainly for backwards compatibility to older windows?
Re:Why the Windows Registry sucks technically (2010) by pxc on Friday July 29, 2022 @05:35PM (#32282038)
> The baseline is only text and files on systems that don't have anything better to offer.

Also pretty much all external programs on Windows. Anything that isn't itself implemented as a PowerShell cmdlet has this problem. And it's all shell-specific.

Re:Why the Windows Registry sucks technically (2010) by throwaheyy on Saturday July 30, 2022 @01:31PM (#32288594)
Not really, if it’s a .NET assembly Powershell can dynamically load, call and use types from it. Not to mention first-class support for standard data interchange formats like JSON, XML etc without having to convert back/forth from text or use tools to process it.
Re:Why the Windows Registry sucks technically (2010) by pxc on Sunday July 31, 2022 @12:49AM (#32293260)
In a few situations, actually calling .NET code from PowerShell doesn't suck, like setting persistent environment variables.

But in tons of situations actually doing anything that way involves a ton of boilerplate, and it's very clunky. It's acceptable for automation, but it's not something that feels very good to do in an interactive shell.

Stuff like Convert-FromJson is nice, but it's not as nice as whole ecosystem there the interchange format for external programs is sort of just 'understood'. It's also not streaming— it reads in a single JSON object as a string. So you need some extra boilerplate if the expectation is that you're piping output from a command that yields a stream of data.

PowerShell is great, but an environment where streaming objects in some other format between different programs, regardless of the languages they're in or the runtimes they use, would be better and closer to a real version of 'Unix pipelines but with objects'.

Re:Why the Windows Registry sucks technically (2010) by guhidalg on Friday July 29, 2022 @10:18AM (#32277249)
Windows and macOS dominate because 99.9% of users do not care about the difference between registries, file systems, text or binary tools, UNIX-like, POSIX, etc… none of these things matter to them! They just want to use a computer and get on with their life.

If you lament this as a programmer, build applications that only work on your OS of choice, make them so good or take a dependency on a feature not available with macOS or Windows so that it can’t be ported, and then you can show the world the light of the UNIX mentality or whatever.

Re:Why the Windows Registry sucks technically (2010) by mhink on Friday July 29, 2022 @01:43PM (#32279832)
> Windows and macOS dominate because 99.9% of users do not care about the difference between registries, file systems, text or binary tools, UNIX-like, POSIX, etc… none of these things matter to them! They just want to use a computer and get on with their life.

The flip side of this argument is that the experience of using computers for that 99.9% of users sucks.

As software engineers, it's almost our responsibility to argue in favor of better platforms, because every day not spent fighting the platform is a day we could be building better experiences for our users. (Not to mention, every day the platform doesn't inadvertently mess up the user experience is a day of smaller support costs.)

Re:Why the Windows Registry sucks technically (2010) by pie_flavor on Friday July 29, 2022 @02:25PM (#32280229)
The registry does not impact those users' experience. Needing to learn how to use a shell, does.
Re:Why the Windows Registry sucks technically (2010) by yndoendo on Friday July 29, 2022 @03:22PM (#32280792)
I would disagree that it does impact users' experience because when the registry gets corrupt you have to start by installing Windows from scratch. Nothing like Windows 10 update disabling registry backups to save space on low capacity storage and finding out after the fact when attempting to recover Windows 10.

Secondly with device drivers being tied to the registry there is not a simple system upgrade of taking out the hard drive and placing it into a new computer.

Just not everyday occurrences for most but still exist.

Re:Why the Windows Registry sucks technically (2010) by ajolly on Friday July 29, 2022 @06:11PM (#32282340)
Windows these days works extremely well with just taking out the hard drive and placing it into a different computer, even across different processor brands completely different hardware etc.

I personally do this all the time. At most you get an extra restart the first time the drive is in a new set of hardware and after that you're good to go.

My main Windows install is probably 8 years old at this point, it's gone between multiple motherboards.

The biggest annoyance is a few pieces of software that tie activation to the motherboard.

If you want to make it even more portable you can install Windows to a vmdk.

And if you want to get a special complicated, you can have that vmdk act as essentially a secondary variant of your main operating system complete with symlinking most of the files and application info, to both save space and so you have most of the same state across both os's, but still can play around and easily roll back any changes.

Re:Why the Windows Registry sucks technically (2010) by pie_flavor on Saturday July 30, 2022 @05:54PM (#32290745)
The registry does not get corrupt. This is not a thing that happens without the system files themselves being corrupted. People blame any old problem on the registry the way they blame any old problem on /etc. Nor, in the case of an actual registry problem, do you have to reinstall Windows from scratch; restoring the registry from backup is the entire point of system restore points, which are created on every update and most program installs. As a bonus, yes, I did upgrade my computer that way. This stuff is pure superstition.
Re:Why the Windows Registry sucks technically (2010) by dmitriid on Friday July 29, 2022 @04:51PM (#32281623)
I've reinstalled Linux due to borked sound on update way more times than I reinstalled Windows due to corrupt registry.

And cumulatively I spent significantly less time on Linux than I did on Windows.

Re:Why the Windows Registry sucks technically (2010) by daxvena on Friday July 29, 2022 @05:48PM (#32282165)
I'm not saying the UNIX philosophy is the "best" way, I'm just stating why it's valuable.

Of course most people don't care about those things, but as a developer, the main issue I see with Windows and macOS, is that they build specialized interfaces that lock you into certain ways of doing things, which may be convenient, but are difficult to migrate away from, and a pain to automate and reproduce.

I really value that the UNIX philosophy is geared more towards building simple tools that are designed to be combined with other simple tools to solve a more complex problem, and that it doesn't try to lock you into using any particular tool to solve a problem.

So no, I may not provide binaries for Windows & Mac for personal projects, but I'm not going to be openly hostile towards people who want to build things from source or contribute fixes for Windows & macOS.

Re:Why the Windows Registry sucks technically (2010) by marcosdumay on Friday July 29, 2022 @11:21AM (#32278100)
What good does having a non-UNIX OS do if it insists on doing everything worse than UNIX?

The bet on "everything is an object" was a honest and competent one, but unfortunately it didn't work. "Everything is a file" works better on practice. Unfortunately, that was the last real attempt on Windows to improve things.

Yes, the lack of diversity in OSes is bad. But Windows doesn't fix it. (Android and iOS were the last large attempt of innovation there, and implemented some really good things, but it's also useless to have the OSes completely managed by large corporations that antagonize both their customers and society as a whole.)

Re:Why the Windows Registry sucks technically (2010) by plonk on Friday July 29, 2022 @05:48PM (#32282161)
> The bet on "everything is an object" was a honest and competent one, but unfortunately it didn't work. "Everything is a file" works better on practice.

With the right interface, the object approach can be more pleasant to use. Administration via PowerShell is way more consistent than in Bash.

Re:Why the Windows Registry sucks technically (2010) by TristanBall on Sunday July 31, 2022 @06:55AM (#32294735)
In what way did it "not work"?

Unless you meant OS/2? My understanding is the original intent there was very much to make everything an object,and the UI fully composable based on that ( in the sense of being able to link things together semi-arbitrarily, like pipes, only they never got that far )

But that's based on a half remembered article from years ago, I may have that completely wrong.

Agree with the other post that PowerShell's object view of the environment is pretty nice - not always a panacea of course, but mostly highly functional and productive

Re:Why the Windows Registry sucks technically (2010) by ElectricalUnion on Friday July 29, 2022 @10:22AM (#32277294)
The problem is that UNIX, while it reeks, it's good enough for most people to not care about it.

Plan 9 was supposed to be the better designed UNIX all around and it did not even dent it. It wasn't significantly better that UNIX to displace it.

http://www.catb.org/esr/writings/taoup/html/plan9.html

> We know what Unix's future used to look like. It was designed by the research group at Bell Labs that built Unix and called ‘Plan 9 from Bell Labs’.[154] Plan 9 was an attempt to do Unix over again, better.

> The long view of history may tell a different story, but in 2003 it looks like Plan 9 failed simply because it fell short of being a compelling enough improvement on Unix to displace its ancestor. Compared to Plan 9, Unix creaks and clanks and has obvious rust spots, but it gets the job done well enough to hold its position. There is a lesson here for ambitious system architects: the most dangerous enemy of a better solution is an existing codebase that is just good enough.

Re:Why the Windows Registry sucks technically (2010) by chasil on Friday July 29, 2022 @10:55AM (#32277749)
I think also that BSD (and later Linux) made UNIX free, and I assume Plan 9 was not.

UNIX was also written to run on minimal hardware. Even if Multics had been open-sourced, UNIX would still have won.

Re:Why the Windows Registry sucks technically (2010) by pjmlp on Friday July 29, 2022 @11:03AM (#32277859)
UNIX has been free since V6, that is why it got adopted by everyone, and then AT&T sued Berkley when they got the opportunity to actually be allowed to charge for it.
Re:Why the Windows Registry sucks technically (2010) by ziml77 on Friday July 29, 2022 @11:37AM (#32278322)
I agree on this. There may be better ways to do things, but people are so sure that UNIX perfected everything 50 years ago that the alternatives don't get explored. Personally I'm not convinced that plain text is naturally better than other options, because what even constitutes plain text? We have ways of encoding our languages into bits on a disk, but without a decoder it really doesn't have any meaning. So how is that different from any other way you can encode data? Isn't the important thing that we have tools that make it easy and consistent to work with the data?
Re:Why the Windows Registry sucks technically (2010) by tpoacher on Friday July 29, 2022 @12:11PM (#32278732)
Actually there are lots of exciting non unix OS.

https://distrowatch.com/dwres.php?resource=links

It's just that they don't have market share or a raison-d'etre for widespread adoption.

Re:Why the Windows Registry sucks technically (2010) by smm11 on Friday July 29, 2022 @12:33PM (#32279028)
Be and Morph are worth a look.
Re:Why the Windows Registry sucks technically (2010) by flohofwoe on Friday July 29, 2022 @09:33AM (#32276650)
It's interesting though that "boring UNIX" has survived, while most non-UNIX operating systems have gone the way of the Dodo ;)
Re:Why the Windows Registry sucks technically (2010) by marcodiego on Friday July 29, 2022 @10:52AM (#32277705)
I'd complement it: the fact "that as of today Windows is the only non UNIX OS" AND "this fanatical love of the UNIX way" sets us back.
Re:Why the Windows Registry sucks technically (2010) by RajT88 on Friday July 29, 2022 @01:07PM (#32279428)
TempleOS is radically different than either Windows or Unixy OS's.

I would actually not even compare it to them, and just say it's flat out Radical.

Re:Why the Windows Registry sucks technically (2010) by jabbany on Friday July 29, 2022 @07:42AM (#32275713)
Modern Linux DEs have an arguably worse version by not only having traditional `/etc` for some types of configurations but _also_ having a "registry" that's really similar to the Windows one for GUI apps... (re: gconf for Gnome)
Re:Why the Windows Registry sucks technically (2010) by marcosdumay on Friday July 29, 2022 @11:14AM (#32277990)
"Most" here means the one DE that had a Windows fan rewrite its entire config engine with the only goal of being like Windows. An action that created quite a lot of problems soon after the change.
Re:Why the Windows Registry sucks technically (2010) by xattt on Friday July 29, 2022 @08:32AM (#32276069)
Is Gconf any different from OSX defaults?
Re:Why the Windows Registry sucks technically (2010) by arsome on Friday July 29, 2022 @07:38AM (#32275678)
To be fair, Microsoft doesn't rely on the registry for complex configurations either, even IIS uses .config files.
Re:Why the Windows Registry sucks technically (2010) by layer8 on Friday July 29, 2022 @11:25AM (#32278155)
You can’t look at HKEY_CLASSES_ROOT and claim with a straight face it’s not complex, and it’s a central piece to how a lot of things work in Windows.
Re:Why the Windows Registry sucks technically (2010) by JonathonW on Friday July 29, 2022 @12:35PM (#32279058)
HKCR has a lot of entries, but the data underneath those entries isn't particularly complex.

Its only really big misstep (apart from the fundamental issues with the registry in general) is that file associations and COM registrations are all intermingled in the same namespace. But those can be and are interconnected (see how the Office file types handle their registrations, for example), so it's kind of understandable how they ended up where they did.

Re:Why the Windows Registry sucks technically (2010) by layer8 on Friday July 29, 2022 @02:29PM (#32280275)
The semantics of those entries and their possible subkeys is exceedingly complex. It started out reasonably simple, but features upon features were added with each Windows release, in addition to the application-specific behaviors.
Re:Why the Windows Registry sucks technically (2010) by justsomehnguy on Friday July 29, 2022 @10:48AM (#32277650)
> even IIS uses .config files.

Except that is for serving from a single file share ir a replicated site across a farm of IISes.

This has nothing with 'complex configurations'

Re:Why the Windows Registry sucks technically (2010) by qsort on Friday July 29, 2022 @07:46AM (#32275737)
Is there any "way" at all that doesn't suck though? Not having "a way" in this sense is more like a feature, a single source of truth works well if it really is treated as such by all actors.

Configurations under unix are a mixture of stdin, config files, env variables and bespoke solutions.

Under Windows, you have all of the above and on top of that the registry.

Any attempt at a solution in this regard risks being a rerun of the notorious xkcd: 14 ways to specify configurations -> this should satisfy everyone -> 15 ways to specify configurations.

Re:Why the Windows Registry sucks technically (2010) by bluetomcat on Friday July 29, 2022 @08:02AM (#32275845)
On a more philosophical level, the Unix convention is the "liberal" one, giving application writers more freedoms. Liberty enables more flexible applications and more chaos at the same time. A highly structured approach might be beneficial in the short run, but it might prove to be burdening beyond its due date.
Re:Why the Windows Registry sucks technically (2010) by trevorishere on Friday July 29, 2022 @08:54AM (#32276232)
Application writers are free to use which ever format they choose on Windows, as well. The Registry is just yet another option -- Microsoft does not force developers to use it. I don't see the Unix convention as the more "liberal" one, here. It typically has _one less_ option.
Re:Why the Windows Registry sucks technically (2010) by nomel on Friday July 29, 2022 @12:22PM (#32278889)
> The Registry is just yet another option

It's not just "another option". It's a system standard option that exists, and can be easily accessed programmatically. There's no equivalent in Unix, since there is no standard, and whatever is available will depend on the distribution.

"Here's a built in option, but do whatever" is very different than "do whatever!".

Re:Why the Windows Registry sucks technically (2010) by trevorishere on Friday July 29, 2022 @12:43PM (#32279164)
Do you know where Microsoft calls out the Registry as the current best practice in https://docs.microsoft.com/en-us/windows/apps/?
Re:Why the Windows Registry sucks technically (2010) by nomel on Friday July 29, 2022 @04:02PM (#32281206)
My point was that having something built into the system is very different than having a dependency stricken free for all that is outside of the system. For this reason, especially for the majority of Window's life, it was not just "another option", it was a "hey, this is built in" option.

As your link show, Windows has homogeneity, with good config options built into the frameworks. In those frameworks, those built in config options can't be consider just "another option". There's no real homogeneity in *nix, so the only options is misc files to put misc paths.

Re:Why the Windows Registry sucks technically (2010) by tfigment on Friday July 29, 2022 @08:37AM (#32276105)
Its partly about where burden is placed. Making it easy for developers sometimes makes it hard on users and admins. And some times it becomes security issue because of varied approaches. Not sure there is right answer especially in open source where its hard to get devs.
Re:Why the Windows Registry sucks technically (2010) by flohofwoe on Friday July 29, 2022 @09:30AM (#32276594)
I would actually be better if most of the data that applications store in the registry would instead live in simple text files in the AppData directory (which shouldn't be hidden by default). The registry should be restricted to Windows configuration data (like file types and their associated programs), and information that needs to be shared between installed applications.
Re:Why the Windows Registry sucks technically (2010) by WorldMaker on Friday July 29, 2022 @01:38PM (#32279785)
That's been the recommendation since Windows 95. It's easy to suggest and hard to enforce.
Re:Why the Windows Registry sucks technically (2010) by marcodiego on Friday July 29, 2022 @10:50AM (#32277672)
> Unix simply doesn't have a "way" in that regard

Yes. Nothing standardized in this area in UNIX/linux-land. We do have FHS, some xdg specifications and the series of configurations options that were born with dconf which resemble windows registry a bit.

Re:Why the Windows Registry sucks technically (2010) by MaxBarraclough on Friday July 29, 2022 @04:09PM (#32281277)
> a loose convention to put text files in "/etc".

For user-specific configuration there's also ~, as with ~/.vimrc and ~/.bashrc. Windows has something similar in C:\Users\theuser\AppData.

edit And ~/.config/, as others have mentioned.

Re:Why the Windows Registry sucks technically (2010) by kalleboo on Friday July 29, 2022 @10:19AM (#32277271)
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)
Re:Why the Windows Registry sucks technically (2010) by pxc on Friday July 29, 2022 @07:24PM (#32282824)
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) by LexGray on Friday July 29, 2022 @03:07PM (#32280645)
At least that used to be the macOS method. Once Apple moved most of their apps to the cloud there are constantly open databases pushing settings updates from device to device. Things often start breaking these days if you try to fix things through direct file manipulation.

With luck you might be able to find the correct terminal commands to disable services and fingers crossed they don't automatically restart themselves before you are done editing.

Re:Why the Windows Registry sucks technically (2010) by throw0101a on Friday July 29, 2022 @11:54AM (#32278543)
> 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.

(Open)LDAP uses a hierarchical structure and saves its data in a database:

* https://en.wikipedia.org/wiki/Lightning_Memory-Mapped_Databa...

* https://www.openldap.org/software/man.cgi?query=slapd-mdb

Re:Why the Windows Registry sucks technically (2010) by pjmlp on Friday July 29, 2022 @11:00AM (#32277825)
What UNIX way?

The religious text files scattered everywhere on the FOSS clones?

The adoption of registry ideas by GNOME on gconf?

The configuration databases used by HP-UX and Aix?

The plists used by NeXTSTEP and macOS?

The settings per app used on Android (technically UNIX based at its Linux kernel)

Re:Why the Windows Registry sucks technically (2010) by jollybean on Friday July 29, 2022 @01:49PM (#32279876)
Exactly this.

Unix is a bit of a mess, at least that's understandable because it's 'open'.

MS registry is a bit nutty, it should be refactored in some simple, clean way, which is apparently extremely difficult to do for big companies, especially those that consider 'backwards compatibility' to be 'everything'.

Re:Why the Windows Registry sucks technically (2010) by dmitriid on Friday July 29, 2022 @05:36PM (#32282045)
> especially those that consider 'backwards compatibility' to be 'everything'.

Thank god there are companies that still think about backwards compatibility and are not intent in breaking everything because there's a shiny new thing ... ahem ... "refactoring in some simple clean way"

Re:Why the Windows Registry sucks technically (2010) by jollybean on Saturday July 30, 2022 @11:27AM (#32287537)
Making things clear is not some kind of 'shiny new thing' that the kids are dancing to - it's rational.

'Backwards Focus Absolutism' means we live in a world of stupid cobwebs and terrible design. The Windows Registry is a hack, it was originally designed to do something mundane and simple. It just grew, like a virus.

Re:Why the Windows Registry sucks technically (2010) by dmitriid on Saturday July 30, 2022 @12:04PM (#32287836)
> 'Backwards Focus Absolutism' means we live in a world of stupid cobwebs and terrible design

It also means that until ~Windows 7/10 you could run even win3.1-era apps. And you didn't run into situations like "any 32-bit apps no longer work" or "any apps not updated in more than a year will be removed" as we've seen with Apple.

Re:Why the Windows Registry sucks technically (2010) by zaptheimpaler on Saturday July 30, 2022 @05:38AM (#32285489)
Do you happen to know Linus' "first rule of kernel development"?

"If a change results in user programs breaking, it's a bug in the kernel. We never EVER blame the user programs. How hard can this be to understand?" - from his famous rant [1]

So Linux prioritizes backwards compat as well. It would be insane for any project relied on by half the computing world not to. MS just throwing out their registry and rewriting it would probably break a million programs and possibly break literal billions of people's computers in some way. Its a universal problem - the more dependants any piece of code has, the harder it is to change.

[1] https://lkml.org/lkml/2012/12/23/75

Re:Why the Windows Registry sucks technically (2010) by jollybean on Saturday July 30, 2022 @11:25AM (#32287519)
"It would be insane for any project relied on by half the computing world not to."

I think this is insane and narrow minded.

I suggest there should be 'eras' of version where things do change.

If they make OS changes, notify early, prepare basic materials, create 'auto-updaters' and allow a few years for change.

But it needs to be done.

Re:Why the Windows Registry sucks technically (2010) by pjmlp on Saturday July 30, 2022 @06:58AM (#32285796)
Which is a reason no one has deep knowledge about all the ioctl variants out there on Linux, as new ones get introduced, sometimes to work around backwards compatibility guarantees.
Re:Why the Windows Registry sucks technically (2010) by nikau on Saturday July 30, 2022 @02:29AM (#32284775)
And at least in unix you can quickly ripgrep through the usual home and /etc/ directories looking for something, whereas searching in regedit takes forever for some reason.
Re:Why the Windows Registry sucks technically (2010) by pjmlp on Saturday July 30, 2022 @03:12AM (#32284958)
Re:Why the Windows Registry sucks technically (2010) by nikau on Sunday July 31, 2022 @08:44AM (#32295145)
Ahh yes the big boy UNIXes that are on life support for the few remaining stragglers willing to pay massive support contracts on legacy systems.
Re:Why the Windows Registry sucks technically (2010) by pjmlp on Friday July 29, 2022 @02:05PM (#32280049)
You missed the "closed" UNIXes on my comment.
Re:Why the Windows Registry sucks technically (2010) by marcosdumay on Friday July 29, 2022 @11:10AM (#32277943)
Doing that in a database is easy. You just write your keys on the "/root/path/subpath" format, and search the strings starting with some text. Most database engines have this kind of search heavily optimized. (And the ones that don't cost hundreds of thousands per core, so who cares?)

The one thing you lose by using a real database is that filesystems are only locally coherent, while databases try very hard to be globally coherent. If it has heavy access, the database way will lose performance much faster.

Re:Why the Windows Registry sucks technically (2010) by gregmac on Friday July 29, 2022 @11:39AM (#32278347)
Agreed, and displaying this like a tree is then a UI concern.

I think you'd get slightly more performance if you were to store "Folder" and "Key" separately -- either three fields or using a parent-child table. You'd be able to index "Folder", and it would make building the tree structure itself easier and more efficient, and looking up all the values in a specific tree simpler.

Re:Why the Windows Registry sucks technically (2010) by cma on Friday July 29, 2022 @02:57PM (#32280540)
You could do the paths in reverse (root last), to speed up any string comparisons, since prefix almost always matches and is maybe more wasted work the other way.
Re:Why the Windows Registry sucks technically (2010) by debevv on Friday July 29, 2022 @02:58PM (#32280546)
The concept of a system-wide hierarchical key-value store is actually very useful is some environments. I had to develop one some time ago [1] for an embedded system, since is super useful to have a single point of truth/configuration/state, if every application agrees on using it (which is the case in such systems were every application is known in advance and developed in house)

[1] https://github.com/debevv/camellia

Re:Why the Windows Registry sucks technically (2010) by rwmj on Friday July 29, 2022 @04:54PM (#32281653)
Xen (the hypervisor) had a thing called XenStore which was a system-wide key-value store with triggers: https://wiki.xenproject.org/wiki/XenStore
Re:Why the Windows Registry sucks technically (2010) by Someone on Friday July 29, 2022 @08:06AM (#32275877)
> and there's no format agnostic API to access that information (you can open it, but can you understand it?).

One of the critiques in this article is that, because you have to know/guess/assume what encoding is used for various strings, there isn’t one for the registry, either.

If so, both approaches suffer from that (but Unix a bit more because it tends to store multiple items under a file system ‘key’, while Windows programs rarely store multiple items under a single registry key)

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?

Re:Why the Windows Registry sucks technically (2010) by rwmj on Friday July 29, 2022 @08:50AM (#32276200)
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.)

Re:Why the Windows Registry sucks technically (2010) by magicalhippo on Friday July 29, 2022 @09:25AM (#32276529)
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 buffer pointed to by pvData.

[1]: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf...

Re:Why the Windows Registry sucks technically (2010) by rwmj on Friday July 29, 2022 @09:55AM (#32276908)
The first thing to know about Microsoft documentation is it's almost always wrong.
Re:Why the Windows Registry sucks technically (2010) by magicalhippo on Friday July 29, 2022 @04:59PM (#32281706)
I've been coding against the Win32 API since Windows 95. While I won't argue it's perfect, it's certainly nowhere near "almost always wrong".

Anyway, where in the hivex code do you handle these non-Unicode encoded REG_SZ values?

Btw, the comment for hivex_value_multiple_strings is based on a mistaken interpretation of the documentation. There's nothing contradictory to what MoveFileEx does[1], it simply has a list with a single entry in the case of deletions, and a list with two entries in case of renames.

The REG_MULTI_SZ documentation[2] just points out, correctly, that you can't have a zero-length string within a list of other strings (ie with at least one non-empty string after it). This is of course obvious and hence redundant, but they highlight it for novice programmers.

[1]: https://docs.microsoft.com/en-us/windows/win32/api/winbase/n...

[2]: https://docs.microsoft.com/en-us/windows/win32/sysinfo/regis...

Re:Why the Windows Registry sucks technically (2010) by pie_flavor on Friday July 29, 2022 @02:35PM (#32280337)
This is categorically incorrect. The documentation for the function is entirely accurate. What is true is that the regedit program is more than a featureless wrapper around the API functions (unlike the first thing to know about Linux desktop software). The heuristic is performed for the user who probably doesn't know what they want; the straight exactly-as-you-asked-for-it conversion is performed for the programmer who does. (And it's only a heuristic for values; the encoding for keys is assumed from the file like TFA says, but which one it is is stored in a flag bit.)
Re:Why the Windows Registry sucks technically (2010) by int_19h on Friday July 29, 2022 @08:15PM (#32283129)
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) by samanator on Friday July 29, 2022 @09:17AM (#32276437)
Maybe there isn't a database engine that explicitly supports file system data structures, but you could implement a filesystem in the application layer using SQLite as a storage mechanism.

Here's an example of someone doing that very thing.

https://github.com/guardianproject/libsqlfs

Re:Why the Windows Registry sucks technically (2010) by tauroid on Friday July 29, 2022 @09:51AM (#32276865)
For those looking for a more up to date alternative, with a non-hardcoded DB file path, try https://github.com/greenbender/sqlfs (not affiliated, just had a look in this area a few weeks ago)
Re:Why the Windows Registry sucks technically (2010) by Blikkentrekker on Friday July 29, 2022 @11:07AM (#32277907)
> The UNIX way is undeniably more flexible since it isn't a virtual filesystem, it is just a filesystem. The problem is that everyone invented their own configuration format to store configuration data in /etc and there's no format agnostic API to access that information (you can open it, but can you understand it?).

It's an interesting point and it would really be nice if there were some kind of standard, especially a standardized C library within the standard C library for configuration files, but in practice almost all of them are also easily understood `key=value` pairs that only differ by how they denote this.

Still, it would be very nice to be able to inspect and modify them by standardized tools but in practice almost any configuration file opened is obvious.

Re:Why the Windows Registry sucks technically (2010) by AtNightWeCode on Friday July 29, 2022 @12:12PM (#32278753)
There is nothing wrong with a kv hierarchy for config. Used in more modern tools as well like Consul. The problem here is the poor implementation and naive security considerations.

Today, there is no broadly used file system that can replace any of this. The difference in performance is just too big.

Re:Why the Windows Registry sucks technically (2010) by adrian_b on Friday July 29, 2022 @08:00AM (#32275835)
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 private directory.

In my opinion this is the only sane way of managing software packages, because otherwise, also on Linux, but especially on Windows, I have wasted far too much time during the years with debugging various problems caused by the installation/uninstallation programs.

Re:Why the Windows Registry sucks technically (2010) by sumtechguy on Friday July 29, 2022 @10:58AM (#32277791)
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 lookups). In practice it became a huge mess because thousands of applications now keep their settings in there and poor cleanup practices like you see. When like 99% of the use cases out there would be perfectly well suited to just using the forever deprecated win32 INI API to manage settings and MS just saying 'put your config files in these places for different effects'. Instead they said 'put it all in the registry'. Looking back at it, it is now 100% clear it was a bad design decision.
Re:Why the Windows Registry sucks technically (2010) by int_19h on Friday July 29, 2022 @08:18PM (#32283142)
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.
Re:Why the Windows Registry sucks technically (2010) by nikau on Saturday July 30, 2022 @02:35AM (#32284806)
Good to see MS practising what they preach on newly written applications:

https://docs.microsoft.com/en-us/deployedge/configure-micros...

> You can also use REGEDIT.exe on a target computer to view the registry settings that store group policy settings. These policy settings are located at this registry path: HKLM\SOFTWARE\Policies\Microsoft\Edge.

Re:Why the Windows Registry sucks technically (2010) by int_19h on Saturday July 30, 2022 @05:16AM (#32285408)
This is a group policy, not a setting. That makes a big difference in the right context - policies are meant for things that are typically centrally managed in enterprise environments, so the ability for the admin to remotely control every setting individually is important, and requires some kind of central system registry for OS tooling to work with.
Re:Why the Windows Registry sucks technically (2010) by nikau on Monday August 01, 2022 @03:26AM (#32303116)
Yep, but it still sucks if you are a user trying to figure out how a setting is applied, first delve into some seemingly proprietary config db for edge, and then realise its actually configured via a registry gpo.
Re:Why the Windows Registry sucks technically (2010) by revolvingocelot on Friday July 29, 2022 @08:08AM (#32275889)
>the various Linux-based systems where any software package is installed only inside a private directory

Which are these? I assume Qubes OS sidesteps the problem entirely... NixOS?

Re:Why the Windows Registry sucks technically (2010) by swinglock on Friday July 29, 2022 @08:27AM (#32276028)
NixOS, mostly, but not for application data (/var usually), which is closer to the registry.
Re:Why the Windows Registry sucks technically (2010) by t0mek on Friday July 29, 2022 @04:50PM (#32281610)
> 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

Apache Jackrabbit Oak [1] implements a tree-format data model called JCR [2]. It's used as database engine for the Adobe Experience Manager (enterprise-level CMS).

[1] https://jackrabbit.apache.org/oak/docs/ [2] https://en.wikipedia.org/wiki/Content_repository_API_for_Jav...

Re:Why the Windows Registry sucks technically (2010) by chasil on Friday July 29, 2022 @11:08AM (#32277927)
"The format is... endian-specific."

Wasn't there a SPARC port of Windows? Did it run on any other big-endian machines? Were the MIPS and POWER ports little-endian?

In any case, I can see why Microsoft paid SQLite for a custom set of features.

Re:Why the Windows Registry sucks technically (2010) by rwmj on Friday July 29, 2022 @04:57PM (#32281676)
It's a very good question! There was also an Alpha port (both-endian and 64 bit). I've never seen a SPARC, POWER, MIPS or Alpha Windows registry so I don't know if hivex could decode them.
Re:Why the Windows Registry sucks technically (2010) by the_why_of_y on Saturday July 30, 2022 @06:42AM (#32285728)
Larry Osterman said in 2005: A decision was made VERY long ago that Windows would not be ported to a big-endian processor.

https://web.archive.org/web/20190108142751/https://blogs.msd...

Re:Why the Windows Registry sucks technically (2010) by tablespoon on Friday July 29, 2022 @07:20PM (#32282801)
> 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) by pram on Friday July 29, 2022 @08:53AM (#32276226)
AIX has a registry-like database for configuration called ODM that is like you’re describing.
Re:Why the Windows Registry sucks technically (2010) by silvestrov on Friday July 29, 2022 @09:33AM (#32276649)
If I was to reimplement it, I would not let any app read the DB directly.

Instead I would make an HTTP like interface where you talk to a service that provides the get/set functionality and which always use a text format like an extended JSON with native support for date, int32, etc.

This also enabled much easier and better backwards compability as you can specify app-version in the requests, so a version 5 server can respond in version 4 format.

With a service it doesn't matter if things are stored as a single sqlite DB or as multiple files.

Re:Why the Windows Registry sucks technically (2010) by gizmo on Friday July 29, 2022 @09:42AM (#32276758)
You can do everything you describe with a regular function call. Introducing an unnecessary service for something as trivial as config management is even worse than the broken Registry status quo.
Re:Why the Windows Registry sucks technically (2010) by imtringued on Friday July 29, 2022 @12:23PM (#32278897)
In theory all we need is a libconfig with a standardized interface and distro specific implementations.

There would be two use cases, storing hierarchical/tree like data aka JSON, YAML, etc and arbitrary graph like data with complex references.

The same could be done with the shell. libcli would be called to parse the command line arguments and your program will have an entry point that receives the parsed data.

libcli could also be used to produce structured program outputs which then can be fed into applications, possibly skipping the serialisation deserialization steps.

Since libcli will have a standard interface each distro can choose their own CLI format or whether they output their data as JSON or CBOR.

In both cases the benefit is that the choice of the data storage mechanism has been decoupled from the application.

Re:Why the Windows Registry sucks technically (2010) by rwmj on Friday July 29, 2022 @04:58PM (#32281690)
Augeas does this already: https://github.com/hercules-team/augeas
Re:Why the Windows Registry sucks technically (2010) by kreco on Friday July 29, 2022 @09:42AM (#32276760)
Is this sarcastic?

I mean, the versioning part sounds good, but JSON like request?

I do believe people don't know what inefficient/efficient a system can be depending on the data format they are using.

Re:Why the Windows Registry sucks technically (2010) by monocasa on Friday July 29, 2022 @11:20AM (#32278081)
That's sort of already the case. Normal apps aren't really supposed to read it, the kernel hides the implementation, and get/set/etc is all system calls.

It's tooling created for security and forensics that tries to manually read it.

Re:Why the Windows Registry sucks technically (2010) by sumtechguy on Friday July 29, 2022 @03:30PM (#32280878)
https://docs.microsoft.com/en-us/windows/win32/sysinfo/regis...

Registry settings already have ACL items applied. You can see this behavior if you log in as a non admin user then try to view another users registry settings.

https://docs.microsoft.com/en-us/windows/win32/sysinfo/regis... The thing is pretty free form with a choice of some very basic data types dword/qword and strings ascii/unicode/lists of strings.

Adding a wrapper around the existing call to go towards a json schema registry could be a helpful thing.

Re:Why the Windows Registry sucks technically (2010) by layer8 on Friday July 29, 2022 @11:29AM (#32278216)
All the aspects you mention can be realized by a programmatic OS API as well. No need to sandwich a network layer and a weakly-typed data format (JSON) in between.
Re:Why the Windows Registry sucks technically (2010) by secondcoming on Friday July 29, 2022 @01:04PM (#32279386)
I assume the service will run in a docker container too??
Re:Why the Windows Registry sucks technically (2010) by pie_flavor on Friday July 29, 2022 @02:38PM (#32280356)
The article's complaints about the format being undocumented are ill-founded, because Microsoft repeatedly tells developers not to read the registry directly, and call the exquisitely documented functions instead. The applications that didn't listen to Microsoft and depended on particular features are most of why it hasn't updated to modern standards in the first place.
Re:Why the Windows Registry sucks technically (2010) by rwmj on Friday July 29, 2022 @04:59PM (#32281705)
How's that supposed to work if you're modifying it in an offline image from a Linux host?
Re:Why the Windows Registry sucks technically (2010) by pie_flavor on Saturday July 30, 2022 @05:58PM (#32290763)
With DISM.
Re:Why the Windows Registry sucks technically (2010) by rwmj on Sunday July 31, 2022 @10:31AM (#32295735)
DISM is a proprietary Windows tool, so no use at all for modifying an offline image from a Linux host.
Re:Why the Windows Registry sucks technically (2010) by pie_flavor on Monday August 01, 2022 @12:32PM (#32308561)
I'm sure it runs under Wine. But knowing that that's how you service the image means you have no reason to be using a Linux host to do it.
Re:Why the Windows Registry sucks technically (2010) by rougka on Friday July 29, 2022 @11:12AM (#32277967)
the registry needs to be read by device drivers including the drivers for tcp and nics, including during very early boot. this would make HTTP a challenge. Also implementing a json parser in the kernel sounds like a bad idea
Re:Why the Windows Registry sucks technically (2010) by m_mueller on Friday July 29, 2022 @08:12PM (#32283106)
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) by TedDoesntTalk on Friday July 29, 2022 @09:20AM (#32276479)
Heierarcical databases support the registry format. But they are popular in the 70s?
Re:Why the Windows Registry sucks technically (2010) by NonNefarious on Friday July 29, 2022 @02:35PM (#32280332)
key/value pairs