Opening a new instance of TC with /O from an application with other rights

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

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

Re: Opening a new instance of TC with /O from an application with other rights

Post by *ghisler(Author) »

Sorry, if you don't tell me what I misunderstood, I have no idea what I did wrong.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Opening a new instance of TC with /O from an application with other rights

Post by *Fla$her »

ghisler(Author) wrote: 2022-08-24, 06:49 UTC /O does not override the problem that elevated programs cannot receive messages from programs running with normal user rights. This is a Microsoft security measure, and I do not want to bypass it.
Do you understand that in the first post there is not a word about sending messages?
I started talking about them as one of the solutions, because Hacker asked me about it. Accordingly, if this one is not suitable, then the other two remain:
Fla$her wrote: 2022-08-14, 07:53 UTC As a last resort, I prefer a window that gives the right to choose to launch a separate instance. Or even ignore the launch as such.

ghisler(Author) wrote: 2022-08-24, 10:34 UTCSo the switch is meant to pass parameters to an already running instance (if that exists). Otherwise it works just like without the switch.
But you don't explain why the second instance of the program opens when there is already one running with elevated rights.
There is a clear gradation between /O and /N.
Overquoting is evil! 👎
User avatar
white
Power Member
Power Member
Posts: 4595
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Opening a new instance of TC with /O from an application with other rights

Post by *white »

Fla$her wrote: 2022-08-24, 17:41 UTC But you don't explain why the second instance of the program opens when there is already one running with elevated rights.
There is a clear gradation between /O and /N.
Exactly. They are opposites. While /N is to force extra instances, /O is to force no extra instances are created.
Help - Command line parameters wrote:
/OIf Total Commander is already running, activate it and pass the path(s) in the command line to that instance (overrides the settings in the configuration dialog to have multiple windows)
/NOpens in any case a new Total Commander window (overrides the settings in the configuration dialog to allow only one copy of Total Commander at a time)
(Help text is outdated btw)

To have /O force an extra instance is like having a Close button to open a dialog, or a Cancel button to confirm your choices.
Last edited by white on 2022-08-24, 20:07 UTC, edited 1 time in total.
Reason: fixed typo
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Opening a new instance of TC with /O from an application with other rights

Post by *Horst.Epp »

I don't understand why some of you will not accept that there is a difference
using /O if TC instances should running with different privs.
It doesn't matter if the help text is detailed enough or even misleading.
This can be corrected but following the original request would still be a security violation.
For me Christian clearly explained this.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Opening a new instance of TC with /O from an application with other rights

Post by *Usher »

Fla$her wrote: 2022-08-24, 17:41 UTC Do you understand that in the first post there is not a word about sending messages?
Do you know that it's really possible? You can send search results from a listbox of a separate search (Alt+Shift+F7) to any TC instance you want.
viewtopic.php?p=417167&hilit=feed+listbox+instance#p417167
Try to do it from an elevated TC instance to a normal TC instance and vice versa.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Opening a new instance of TC with /O from an application with other rights

Post by *Usher »

white wrote: 2022-08-24, 20:04 UTC (Help text is outdated btw)
Confirmed. Words "configuration dialog" are still linked to "Configuration - Display" rather than to "Configuration - Operation".
Andrzej P. Wozniak
Polish subforum moderator
User avatar
white
Power Member
Power Member
Posts: 4595
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Opening a new instance of TC with /O from an application with other rights

Post by *white »

Usher wrote: 2022-08-24, 20:35 UTC
white wrote: 2022-08-24, 20:04 UTC (Help text is outdated btw)
Confirmed. Words "configuration dialog" are still linked to "Configuration - Display" rather than to "Configuration - Operation".
And it says "allow only one copy of Total Commander" while in TC version 7.55 the meaning of the option changed allowing 1 copy per user.
HISTORY.TXT wrote:31.01.10 Added: Wincmd.ini [Configuration] OnlyOnce now supports values >1 and <-1 to limit the number of copies to x (>0 means per user, <0 means per system)
31.01.10 Added: Wincmd.ini [Configuration] OnlyOnce=-1 allows one copy for TC for all users as in previous TC versions
31.01.10 Added: Wincmd.ini [Configuration] OnlyOnce=1 now allows one copy of TC per user (e.g. when started via RunAs), not one copy for all users as in older versions
In TC 7.50a with OnlyOnce=1, parameter /O does not create an extra instance when there is an elevated TC running.
In the next version TC 7.55 with OnlyOnce=-1 (which should be the same as OnlyOnce=1 in the previous version). parameter /O does create an extra instance when there is an elevated TC running.
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Opening a new instance of TC with /O from an application with other rights

Post by *Fla$her »

Horst.Epp wrote: 2022-08-24, 20:20 UTC This can be corrected but following the original request would still be a security violation.
Disabling the opening of the second instance, in your opinion, is a security violation? Serious?
Then why does it already have this "violation" with Onlyone=-1 without /O? Where is the logic?

Usher wrote: 2022-08-24, 20:24 UTCDo you know that it's really possible?
Good. You can specify /S= in addition to /N. Not the point.

2white
Thanks for the finds. And what conclusion can be drawn?
Overquoting is evil! 👎
User avatar
white
Power Member
Power Member
Posts: 4595
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Opening a new instance of TC with /O from an application with other rights

Post by *white »

Fla$her wrote: 2022-08-25, 07:19 UTC 2white
Thanks for the finds. And what conclusion can be drawn?
That prior to version 7.55 the behavior was as you and I expect. /O never forced a new instance when it wouldn't without the parameter. But the behavior changed in version 7.55 and it is unclear whether this was intentional or an unforeseen side effect.
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Opening a new instance of TC with /O from an application with other rights

Post by *Fla$her »

white wrote: 2022-08-25, 07:55 UTCand it is unclear whether this was intentional or an unforeseen side effect.
It would be better if this was a side effect that should be fixed with the next release. :)
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Opening a new instance of TC with /O from an application with other rights

Post by *ghisler(Author) »

I have made a little behaviour table to show which mode does what:

OnlyOnce=1:
No parameters:
1 admin, 1 no admin
1 no admin, 0 admin
Parameter /O:
1 admin, 1 no admin
1 no admin, 0 admin

OnlyOnce=-1:
No params:
1 admin, 0 no admin
1 no admin, 0 admin
Parameter /O:
1 admin, 1 no admin
1 no admin, 0 admin

So /O behaves like OnlyOnce=1. The only difference is this:
Parameter /O:
1 admin, 1 no admin

So when there is already a TC running with elevated rights, /O (and OnlyOnce=1) still allow the creation of a non-elevated TC. Why? The main purpose of /O is to pass new paths to an already running copy of TC. But since the already running TC is running with admin rights, it is protected by Windows from receiving messages from apps with less rights. But the user does want to open these new directories! So the logical consequence is to open a new copy of TC with these paths.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Opening a new instance of TC with /O from an application with other rights

Post by *Fla$her »

ghisler(Author) wrote: 2022-08-25, 08:32 UTCBut the user does want to open these new directories! So the logical consequence is to open a new copy of TC with these paths.
No. The first post describes the situation when the program does this when drive connecting, and not the user himself. And it is completely unprofitable and harmful for the user to run a second instance for the reasons described earlier. Accordingly, there is an important need to save one instance. Opening a directory at any cost is not a priority over preserving instance uniqueness.
Therefore, please make that the second instance is strictly not opened with the /O parameter. For example, by adding the parameter: /O:N
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Opening a new instance of TC with /O from an application with other rights

Post by *ghisler(Author) »

A new parameter would be the best solution for this case. I don't want to modify the /O parameter, which just overrides OnlyOnce (as if it was set to 1). Maybe I could use /O:numeric_value so the user can directly choose the OnlyOnce override value.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4595
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Opening a new instance of TC with /O from an application with other rights

Post by *white »

ghisler(Author) wrote: 2022-08-25, 08:32 UTC So the logical consequence is to open a new copy of TC with these paths.
But then it no longer does it's main purpose, but does the same as passing new paths with no /O parameter and should behave the same way. Otherwise it would act like the /N parameter in this situation and that's contrary to its purpose.
Fla$her wrote: 2022-08-25, 08:49 UTC Therefore, please make that the second instance is strictly not opened with the /O parameter. For example, by adding the parameter: /O:N
Or make it that /O doesn't force an extra instance in this situation except when the parameter /N is also used.
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Opening a new instance of TC with /O from an application with other rights

Post by *Fla$her »

ghisler(Author) wrote: 2022-08-25, 09:10 UTC A new parameter would be the best solution for this case. I don't want to modify the /O parameter, which just overrides OnlyOnce (as if it was set to 1).
ОК, you can add a new one. Or you can add an Onlyonce value that will not be overridden.
ghisler(Author) wrote: 2022-08-25, 09:10 UTCMaybe I could use /O:numeric_value so the user can directly choose the OnlyOnce override value.
Do you mean override factor itself? Yes/No (1/0) ?
Overquoting is evil! 👎
Post Reply