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: white, Hacker, petermad, Stefan2

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

Post by *DrShark »

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.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

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
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, I prefer not to change it. It may break too many installations.
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

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: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

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
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

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.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
petermad
Power Member
Power Member
Posts: 14741
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

...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 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

@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: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

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
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

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