Question

I'm porting a game to Windows and wonder how, for example, highscore data should be stored so that all users on the same system can share the data. Ideally the data shouldn't be writeable by the users themselfs, only by the application (in this case game) owning the data. Apart from the pure technical details I also wonder about best practise.

On Unix this can be achieved by setting the set-UID bit on the executable and let the executable and the shared file in question belong to the same system-user (games in my case). There is also a best practise to place such files in /var/lib/games.

Était-ce utile?

La solution

First, what you can't do:

  1. You can't let some executable change some value, but prevent the user running it from doing so.
  2. You can't make some executable run under a specific account, unless you use some sort of loader (another executable) that will ensure that.
  3. You can't use the registry to store shared data, unless your users are running as administrators (which should not be an option).

Now, what you can do:

  1. Use a database...
  2. Use the ProgramData folder ("All Users" on XP).
  3. Use some loader to keep your app running under the same user, which opens both that user's registry and AppData folder (bad idea - just mentioning as it is technically possible).

If #1 is not possible, I'd go for #2.

A good read about this topic: Where Should I Store my Data and Configuration Files if I Target Multiple OS Versions?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top