Varying location of default.bar

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Hacker, Stefan2, white, sheep

User avatar
DrShark
Power Member
Power Member
Posts: 1111
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262

Post by *DrShark » 2018-05-15, 17:23 UTC

Dalai wrote:No application should ever write to VirtualStore directory by itself! The VirtualStore directory is automatically used by Windows...
MVV wrote:VirtualStore is a special system folder that is used for redirecting write operations to protected locations for old programs that don't support elevation, and subsequent read operations use files from this folder first. TC does support elevation so its write operations are not redirected but failed.
OK, then the second part of this my post and further comments on it are a bit offtopic here, but at least it's clear now that it's OK to expect from TC (which supports elevation) to write the settings (including bar files) to same location on both not elevated and elevated launch, with AppData\Roaming\GHISLER\ as a best choice for this.
Android 4.3.1 no root, kernel 08.09.2016; Vista Home Premium SP2 rus 32 bit
TC #149847 Personal licence

Cuz we're all in this together, We're here to make it right

User avatar
Dalai
Power Member
Power Member
Posts: 6238
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai » 2018-05-15, 18:45 UTC

As long as it's still possible to use a single buttonbar file for all users, I don't mind if TC's behavior is changed. This detail is important, because you actually can remove users from the administrators group, so TC runs as different user when elevating it on such systems. This also applies to systems where UAC is disabled (like all of mine).

Grüße
Dalai
#101164 Personal licence
Athlon X4 880K, 16 GiB RAM, Gigabyte F2A88X-D3HP, Win7 x64

Plugins: Services2, Startups

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36418
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2018-05-16, 10:36 UTC

Sorry, I prefer not to change it. It may break too many installations.
Author of Total Commander
http://www.ghisler.com

User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW » 2018-05-17, 14:18 UTC

Bad news: all existing TC installations are already broken. Why?

1) UserA launches TC in elevated mode and edits button bar - changes are saved to c:\Program Files\Total Commander\default.bar
2) UserB launches TC in elevated mode and edits button bar - changes are saved to c:\Program Files\Total Commander\default.bar
3) UserA launches TC in elevated mode once again and it has other button bar settings than he saved.

As we can see, using one file for multiple users in a multi-user environment can lead to troubles...


Good news: This can be fixed easily, without breaking any existing installation. How?

TC should always (= even when launched in elevated mode) try to load button bar configuration from c:\Users\X\AppData\Roaming\GHISLER\*.bar.

* IF EXISTING in c:\Users\X\AppData\Roaming\GHISLER\*.bar - it should be used.

* IF NOT EXISTING:
- if existing in c:\Program Files\Total Commander\*.bar, should be copied to c:\Users\X\AppData\Roaming\GHISLER\*.bar and used from there.
- if not existing in c:\Program Files\Total Commander\*.bar, should be created and initialized with default settings in c:\Users\X\AppData\Roaming\GHISLER\*.bar.

Regards

User avatar
Dalai
Power Member
Power Member
Posts: 6238
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai » 2018-05-17, 14:48 UTC

2MarcinW
This would break (almost) all of my TC installations. I use a single default.bar for all users in %COMMANDER_PATH% (located in %ProgramFiles%\Total Commander), which is not writable for users (but for admins, of course). I expect TC to edit %COMMANDER_PATH%\default.bar when editing the button bar when TC is running as admin, in case I want to add another default button for all users. Your suggestion would change that and TC would edit %AppData%\Ghisler\default.bar instead. I would need to add a Buttonbar= setting in the wincmd.ini, hoping that TC's behavior with this setting present is not changed.

Regards
Dalai
#101164 Personal licence
Athlon X4 880K, 16 GiB RAM, Gigabyte F2A88X-D3HP, Win7 x64

Plugins: Services2, Startups

User avatar
DrShark
Power Member
Power Member
Posts: 1111
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262

Post by *DrShark » 2018-05-17, 15:02 UTC

MarcinW wrote:* IF NOT EXISTING:
- if existing in c:\Program Files\Total Commander\*.bar, should be copied to c:\Users\X\AppData\Roaming\GHISLER\*.bar and used from there.
It's not that simple: the *.bar files may have buttons with absolute paths to subbars in c:\Program Files\Total Commander\, so simple copying will break that buttons.

A possible solution is to set c:\Users\X\AppData\Roaming\GHISLER\ for *.bar by the installer only for clean installations (when user didn't choose the update and the installer didn't find own files on standard install), maybe the installer can even write that path to a ButtonBar key of wincmd.ini to make it compatible with older versions, so in case user will decide to downgrade, older TC will use that path to a button bar too, but it's possible that some compatibility issues will still exist even in that case.
Android 4.3.1 no root, kernel 08.09.2016; Vista Home Premium SP2 rus 32 bit
TC #149847 Personal licence

Cuz we're all in this together, We're here to make it right

User avatar
petermad
Power Member
Power Member
Posts: 8023
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Post by *petermad » 2018-05-17, 15:23 UTC

...should be created and initialized with default settings
There is no default settings inside totalcmd.exe / totalcmdx64.exe - default.bar as it comes with the installer holds the default settings.
License #524
Danish Total Commander Translator
TC 9.21a 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit and TC 2.91b6 on Android 6.0
Get Extended Total Commander Menus | PHSM-Calendar

User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW » 2018-05-17, 16:01 UTC

@Dalai: please don't confuse so-called administrator rights (when launching elevated TC) with Administrator account (when you log in with Administrator user name).

When launching elevated TC, you are still the same user (although with higher rights), so you still should have your configuration files placed in your user's directory - not in the global Total Commander directory.


But my idea would of course break your specific configuration. So maybe such a solution:

* IF EXISTING in c:\Users\X\AppData\Roaming\GHISLER\*.bar - it should be used.

* IF NOT EXISTING there, then c:\Program Files\Total Commander\*.bar should be used as long as it is only read; in case of writing, it should be copied to c:\Users\X\AppData\Roaming\GHISLER\*.bar, modified there, an used from there starting from this moment.

As long, as the user doesn't modify bars, it uses global settings. After modifying, it disconnects from global settings and starts using its custom settings.

Pros: button bars may be still administered globally - admin launches TC, modifies button bar (so it's copied from c:\Program Files\Total Commander\*.bar to c:\Users\Admin\AppData\Roaming\GHISLER\*.bar) and then copies modified files back to c:\Program Files\Total Commander\*.bar (please note that this must be done intentionally - it's not possible to overwrite someone's else configuration just by launching TC in elevated mode, as it is now).

Cons: When some user modified his button bar configuration, he will not benefit from global button bar configuration changes. But IMO it's still better than the current situation, when one user can modify other user's configuration, just by launching TC in elevated mode.

Regards

User avatar
Dalai
Power Member
Power Member
Posts: 6238
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai » 2018-05-17, 16:32 UTC

MarcinW wrote:@Dalai: please don't confuse so-called administrator rights (when launching elevated TC) with Administrator account (when you log in with Administrator user name).
I don't confuse them. UAC is disabled on all system installed by me, because I use strict user separation, especially in a company environment. So, when running TC (or any other application) as administrator, it is using a different user account. In this context, I don't use "Run As Administrator" but "Run As Different User" instead.
But IMO it's still better than the current situation, when one user can modify other user's configuration, just by launching TC in elevated mode.
Well, I'm wondering how many installations with more than one administrative account are out there where these users don't talk to each other, notifying each other of changes they made to the TC button bar... But, I guess my imagination is too limited ;).

One thing should be obvious though: There is no simple solution to the seemingly unlimited configuration variety out there. "One size fits all" doesn't work, although some people try time and time again - especially Microsoft :evil:...

Regards
Dalai
#101164 Personal licence
Athlon X4 880K, 16 GiB RAM, Gigabyte F2A88X-D3HP, Win7 x64

Plugins: Services2, Startups

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36418
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2018-05-18, 10:30 UTC

Sorry, as I wrote, I prefer not to change this. It would break too many installations.
Author of Total Commander
http://www.ghisler.com

Post Reply