UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStarâ„¢
https://usdx.eu
GNU General Public License v2.0
832 stars 160 forks source link

[Windows] UAC, force/ask-for elevation #116

Closed RattleSN4K3 closed 8 years ago

RattleSN4K3 commented 8 years ago

On systems with security features in place (such as UAC), it is impossible to automatically get write access to system folders which are readonly. By installing/extracting the game into a system folder such as ProgramFiles, the user normal user won't be able to start the game without an immediate crash (at startup). The game doesn't ask for elevation (write access), and the non-elevated process will try to create files into the installation folder which results into a crash.

This happens for the game and is not specifically related to how the game is installed/extracted onto the system. Whenever the installation folder is in a system folder, UAC and such prevents write access resulting into the mentioned crash.

Advanced users might know how to react in such cases (running the game as administrator) but it should be handled by the game itself - using AppData or elevate the process.

basisbit commented 8 years ago

The installation folder in %program files% should geht read/write for all loggin in users. This should be done by the installer. Any other solution will cause various issues when adding or editing songs, having the same configuration for all users, later on installing updates,......

RattleSN4K3 commented 8 years ago

"read/write for all loggin in users" what is this in a Windows context?

In case you mean the file/folder permission in Windows, this is not available on every systems (Home etc.) and not on every drive (Fat32).

In case you really mean changing the permission (takeown/cacls/iacls/), this is not recommended at all. And this is would only fix the problem installed the game throught the installer but not extracted or installed from the probable or any other archive. Also relevant: http://nsis.sourceforge.net/Best_practices

There is no workaround for this problem except using AppData* and/or elevate the process. It is not the installer's fault defaulting to ProgramFiles (yes, it could point to another location if no write access is allowed).

Repo streps:

  1. Download the game's portable installer https://github.com/UltraStar-Deluxe/USDX/releases/download/v1.3.2-beta/UltraStar.Deluxe_v1.3.2-beta_portable.exe
  2. Install it to a system folder (or a folder which your test user has no proper write access to) C:\Program Files\UltraStar Deluxe
  3. Run the game from a non-admin (User) account
  4. Game will crash and not start
    atest
    • ProgramData is system wide. "AppData" was the abstract term meaning any of alternative location than the installation folder.
basisbit commented 8 years ago

workaround implemented as described above by me in 059ba90 . A proper solution would be to use the shared AllUsers AppData for anything except the dll and exe files. gonna close the issue for now, but marked it for backlog for future versions (-> after final v1.3).

RattleSN4K3 commented 8 years ago

A proper solution would be to use the shared AllUsers AppData for anything except the dll and exe files.

Definitely. There are some things which can result into some undesired effects having the granting feature in place for instance the installer grants access to all files/folders included in the install location. This can result into undesired irreversible problems when accidentally installing USDX into a different folder (for instance a system folder without the sub folder of USDX). A rare case but it's a security flaw or at least something you woudln't want as the admin of a given computer (multi user, family etc.).

Additionally, the granting doesn't work for symlinked folders/files. A granted user can still not get write access to these files. Although, it will get permission to delete the symlink (but not the actual files).

And as mentioned, this granting is only implemented in the installer not the game (repo version or any other archive version).