Author Topic: Why does the launcher write into HKLM?  (Read 4056 times)

0 Members and 1 Guest are viewing this topic.

Offline Chewie

  • 22
Why does the launcher write into HKLM?
Hallo everyone!

I played your Freespace 2 builds quite some time, and I recognized something which I don't quite understand:

As this project is about extending the Freespace 2 engine with features for a more up-to-date gameplay feeling, why does the launcher (and possibly the game) still need administrator rights to work properly? I haven't yet looked in the code, but when I click "Apply" in the launcher, I get some errors about data not being set. After checking with RegMon, I saw that data is to be written in HKEY_LOCAL_MACHINE\Software\Volition\FreeSpace2, which on a default windows system is only permitted for administrators.

I know that there are too many users out there working all day as administrators (which is quite a security risk as we all know), but I hope these numbers are shrinking, especially with Windows Vista.

So why do you still insist in writing your data in this path in the registry and don't change to HKEY_CURRENT_USER?

If there already has been a discussion about this topic, I would be glad to get a link to it, because I didn't find one.

Thanks in advance and please don't get me wrong, I truly appreciate the work you guys have done. I'm just conviced that proper integration into the operating system is essential for any application.

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: Why does the launcher write into HKLM?
We're actually moving to ini files instead of using the registry, but that isn't going to happen until after the 3.6.* series of builds.  For now we just use what the game was originally written for, and that is HKLM (evil as that may be).

 

Offline Chewie

  • 22
Re: Why does the launcher write into HKLM?
Ok, I see.

Will those ini files reside in the program directory or will they be located somewhere under %APPDATA%? Because the first way would be as evil as the HKLM solution ;)

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: Why does the launcher write into HKLM?
Initially in the game directory.  We are actually debating the move to %APPDATA% for 3.7.  Since we support Linux and OS X, and already have separate read/write directory roots on that side, the code already has everything needed to do this, but there is some debate as to how much trouble this change will be for the Windows users.

So, it will move to an %APPDATA% type thing (the debate is more about whether the write root should be somewhere that is hidden by default, or visible by default) in a few months.  But that will happen only after (hopefully, shortly after) the change to ini files, since the new Launcher has to be completed for all of it to actually work.

 

Offline neoterran

  • 210
Re: Why does the launcher write into HKLM?
you will need to run the launcher (and the game) in elevated mode in windows vista due to this btw.
Official Taylor Fan Club Member.
Chief Grognard.
"How much code could a coder code if a coder could code code?"

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: Why does the launcher write into HKLM?
If by appdata you mean the subfolders under Documents and Settings on XP, I would much rather have it in the game directory. I hate how most programs these days put their files in obscure locations all over the place.

 

Offline Chewie

  • 22
Re: Why does the launcher write into HKLM?
If by appdata you mean the subfolders under Documents and Settings on XP, I would much rather have it in the game directory. I hate how most programs these days put their files in obscure locations all over the place.

Well, an obscure location is not necessary, at least %APPDATA%\Freespace2 (maybe c:\Documents and Settings\Application Data\Freespace2) doesn't sound obscure to me. Furthermore, Windows is a multi-user system. So if several users want to use an application, they can all have their own program settings. If you would store your data at a central location, they couldn't.

Or maybe the user could select if he wants to store this information user-based or centrally. But then, this choice also would have to be stored somewhere ;-)

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: Why does the launcher write into HKLM?
To tell you the truth, if it's outside the game directory it's too obscure as far as I'm concerned. :p I'm the only one who uses my machines and I like to be able to copy my game installations between computers while retaining all the configuration data, by just packing up the entire directory and putting it on some sort of removable media. This used to work well several years ago but these days it's often impossible, as the games scatter their files everywhere among the OS directories.

As you said, the best thing would be to just make it the user's choice with a command line flag or something like that. I've seen a few programs that do it that way.

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: Why does the launcher write into HKLM?
1) It's going to happen, because it must ... deal with it
2) It's not going to be optional ... deal with it

:D

 
Re: Why does the launcher write into HKLM?
To tell you the truth, if it's outside the game directory it's too obscure as far as I'm concerned. :p I'm the only one who uses my machines and I like to be able to copy my game installations between computers while retaining all the configuration data, by just packing up the entire directory and putting it on some sort of removable media. This used to work well several years ago but these days it's often impossible, as the games scatter their files everywhere among the OS directories.
I second that emotion.

 

Offline Chewie

  • 22
Re: Why does the launcher write into HKLM?
Well, then you are using the wrong operating system  ;)

Seperating program binaries and program data (generated by the user) is essential for operating systems like Windows and Unix (Linux/MacOS included).

 
Re: Why does the launcher write into HKLM?
I'm not sure what your definition of essential is, when it's quite possible to put everything in one directory, without creating one registry entry, just like the DOS days. For example, I can run 7zip or µTorrent standalone, or I can choose to "install" them, which I choose not to.

All these OS's are determined to run in a network environment it seems, and so they trip all over themselves dealing with the concomitant security issues. My PC is not networked and never has been, so as far as I'm concerned that's a bunch of wasteful overhead.

I think it's stupid that Windows wants to get on the internet every time I boot. My mother may think it's neat to have automatic updates for every piece of software on her machine but I don't.

I don't see why all the network stuff can't be stripped out of the OS, and let some piece of external hardware deal with the firewalling and virus checking. I don't understand why I can't load some type of stripped down XBox type OS on my PC. I often dream of how fast my machine would be then.

This situation isn't going to change and I know that, but it doesn't mean I don't have the right to think it's stupid. It's no benefit to me when 90% of my patches are related to internet security, and none to performance.

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: Why does the launcher write into HKLM?
I can't see how this even does anything for network security. The only point of it seems to be to accomodate multiple users, which should be (and is already, for the most part) incorporated into the game itself. You could instead have a system where you can switch between multiple configuration profiles through the Launcher (or through pilots, if the command lines and other options eventually get integrated into the game) and store them in a master file, which would be a lot more convenient and flexible than going through the OS user profiles.

At least it won't be any worse than the current system. :p But I agree with Huggybaby that scattering files around like this makes no sense at all.

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: Why does the launcher write into HKLM?
The reason to have two locations is so that one is guaranteed to be writable.  On an UNIX for example, you can install the game anywhere on the filesystem, but you will never be able to play it because the game couldn't write pilot files or config files or anything else to disk.  File permissions would prevent it.  On a properly setup machine, regardless of OS, that is how it should be, you would only be able to modify your own files.

There are already people using the game who can't save files in c:\Games\FreeSpace2, and that number will only grow as Microsoft finally wakes up to basic filesystem security.  To their credit, Microsoft has done a pretty good job of move people to a non-retarded way of doing things, however slowly that might be happening.  Everyone is still stuck in the DOS days though, but that just isn't how the world works any more, it's not how its worked for quite some time.

 

Offline Selectah

  • 27
  • Unsuspended
Re: Why does the launcher write into HKLM?
Well, then you are using the wrong operating system  ;)
We have a winner.
Selectah Fan Club Member

disregard this post

 

Offline Selectah

  • 27
  • Unsuspended
Re: Why does the launcher write into HKLM?
Everyone is still stuck in the DOS days though, but that just isn't how the world works any more
And another.
Selectah Fan Club Member

disregard this post

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: Why does the launcher write into HKLM?
The reason to have two locations is so that one is guaranteed to be writable.  On an UNIX for example, you can install the game anywhere on the filesystem, but you will never be able to play it because the game couldn't write pilot files or config files or anything else to disk.  File permissions would prevent it.  On a properly setup machine, regardless of OS, that is how it should be, you would only be able to modify your own files.

There are already people using the game who can't save files in c:\Games\FreeSpace2, and that number will only grow as Microsoft finally wakes up to basic filesystem security.  To their credit, Microsoft has done a pretty good job of move people to a non-retarded way of doing things, however slowly that might be happening.  Everyone is still stuck in the DOS days though, but that just isn't how the world works any more, it's not how its worked for quite some time.

I'm not sure what you mean by "basic filesystem security." I can only think of one reason why the Freespace directory should be write protected on a single-user machine: if it's being run directly off removable media for some reason, but I would think that is very uncommon. Even if it is useful in some cases to store the profiles outside the game folder, why there can't be a choice? For example, why can't FS2 search for the profiles and configuration files in both its own folder and the OS user directory (with some order of precedence, which isn't relevant)? I must be missing something here.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: Why does the launcher write into HKLM?
Basically, the problem is that things were set up inefficiently in the first place.

Even if you don't use a computer network, having everything "perishable" - ie customized by the user - in a central location means that it's extremely easy to back _everything_ up. Under Linux, all you need to do is copy your home directory someplace else and you've got a full backup of all your critical data - at least in theory.

The problem is that way back in the DOS days, there was no central location. And even these days, it's easier to just stuff everything in the app's folder rather than figure out where it should go. Granted, my forays into my user profile under Windows make me wish for the relatively straightforward Linux home directory, but the merits of a filesystem are probably not the topic of discussion here...


The reason that I can see a FS2 folder being write-protected is if you were going with the Linux style of having everything locked down, when using normal user access, so as to secure the file from some malicious program playing havoc with system or program files, and generally planting itself in various places in devious ways. This is generally the way that Linux distros are set up by default; so that if a virus infects every accessible file on the system when it's run by a normal user, fixing it is simply a matter of purging the virus from the home directory and/or restoring from backups. So it's in the interests of crossplatform compatibility to have fs2_open support separate pilotfile directories. Doing the same thing under Windows is simply standardizing the interface.

From a practical point of view, considering the history of it all, it's arguable; it's hard enough to walk people through fixing bugs in FS2 without having a whole nother set of folders to deal with. But at the same time, it's a step in the direction that most programs should be going.
-C

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: Why does the launcher write into HKLM?
Quote
Even if you don't use a computer network, having everything "perishable" - ie customized by the user - in a central location means that it's extremely easy to back _everything_ up. Under Linux, all you need to do is copy your home directory someplace else and you've got a full backup of all your critical data - at least in theory.

Yes, I can see the advantage of that, although it would make individual programs harder to transport. But on XP, there is no one central location for these things. My games put their files in their own folders, in Documents and Settings, in My Documents and even in the Windows system folder. On top of that, the Documents and Settings folder also contains a lot of OS-critical data and you often can't simply dump a backup on top of it without messing something up. In practice, I find it much more convenient to have everything for a given game in one place. Most of the Unreal-based games, for example, are like this (and have nothing in the registry either), which makes them very easy to transfer between computers.

As for write protecting the FS directory just for virus protection, surely that's going a bit too far with it. I think at that point, it would become an inconvenience more than anything else. You might as well write protect the profile folder as well if you're that concerned about viruses. :p

Quote
So it's in the interests of crossplatform compatibility to have fs2_open support separate pilotfile directories. Doing the same thing under Windows is simply standardizing the interface.

That makes sense, but why does that imply forcing the game to use separate profile directories?

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: Why does the launcher write into HKLM?
... I can only think of one reason why the Freespace directory should be write protected on a single-user machine ...
That's the issue though, it's not a single-user machine, it's multi-user, whether just one person is using it or not.  It's the old DOS/Win9x mentality, where you, the user, is basically God on that machine.  On a modern, multi-user OS, you want to be a normal man, and humble man, and just be allowed to mess around with your tiny corner of the world.  It's fine to go play God occasion, but it's not really a job that you want full-time.

In other words, you don't really want to run as a user which has the power to do anything.  What you want is full control over your tiny bit of the computer and only switch to an admin user when you need to (to add something new to the system, or remove something).  System wide files and config can't be changed by you normally, which means that viruses and nasty little spyware programs have great difficulty messing up your computer.  Once you start doing this, and get used to it, it's actually kind of nice.

As WMCoolmon said, Windows is still behind the times on this actually being easy.  But on my Linux box for instance, I have $HOME on a separate hard drive.  All of my own files go there, and programs and system config to on a drive which I don't have write access to as my normal user.  When it's time to upgrade to a new OS version I simply erase everything except for $HOME, and install the new OS.  When it starts up for the first time I just setup my username that I used before, and all of my settings are just as I left them.  This means that I can download a new version of Linux, reboot the computer and install it, reboot the computer to start running it, and that's all, no extra config, nothing.  It takes all of 30 minutes and I've switched to a new OS and am immediately back doing e-mail, web browsing, coding, etc.

As for write protecting the FS directory just for virus protection, surely that's going a bit too far with it. I think at that point, it would become an inconvenience more than anything else. You might as well write protect the profile folder as well if you're that concerned about viruses. :p
The point is that the FS directory would be write protected by default.  You wouldn't change anything regarding that, it's just how the user permissions would be set, when set properly.  Protecting the profile folder wouldn't be an issue though, since it shouldn't contain executable files for viruses to infect. :)

Quote
So it's in the interests of crossplatform compatibility to have fs2_open support separate pilotfile directories. Doing the same thing under Windows is simply standardizing the interface.
That makes sense, but why does that imply forcing the game to use separate profile directories?
It can't be selectable by it's very nature.  It's all or nothing.  But it doesn't really have anything to do with cross-platform support, it has to do with supporting current and future Windows versions.  We do it with the Linux and OS X builds because that is simply how it's done.  Windows is getting to that point, and is largely there already, so we are just playing catch-up on that side.