TC9.20B4: More than 1 TC can be launched when restricted

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

Post Reply
Sektor
Member
Member
Posts: 157
Joined: 2007-04-04, 10:11 UTC
Location: Russia

TC9.20B4: More than 1 TC can be launched when restricted

Post by *Sektor »

TC9.20B4: "Allow only 1 copy of Total Commander at a time" doesn't work.
License #299429
There is no knowledge that is not power
Sektor
Member
Member
Posts: 157
Joined: 2007-04-04, 10:11 UTC
Location: Russia

Post by *Sektor »

UPDATE

Here's the case when it doesn't work:
1) Start TC as administrator
2) Start TC as usual user

In all other combinations (user-admin, admin-admin, user-user) second copy is not launched.

TC x64
Last edited by Sektor on 2018-05-27, 13:55 UTC, edited 1 time in total.
License #299429
There is no knowledge that is not power
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

I can confirm that the admin-user combination is possible.

But also as admin-admin if the first TC is 32bit and the second is 64bit and vice-versa.
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
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

NOT confirmed. The only combination which works for me when "Allow only 1 copy of Total Commander at a time" is set is the following:
Running TC 32-bit from TC 64-bit.

I agree that this should be prevented. But I cannot confirm any other combinations where I can launch a second copy of TC.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I managed to fix the launch of TC 32-bit while TC 64-bit was already open.

However, I cannot prevent the launch of TC with normal user rights when TC with admin rights is already running, because apparently TC with normal rights cannot 'see' TC with admin rights, so it couldn't send the path to it. Therefore you will have to live with it, sorry.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2ghisler(Author)
You have to start the second instance from a link, NOT from TC, then you will get both Admin and non-admin TC running

Here you can see TC64 as admin, TC64 non-admin and TC32 as admin running at the same time: http://madsenworld.dk/tcmd/multi_tc.png

Started in that order and via .lnk file on desktop or taskbar. Both 64bit and 32bit TC has "Allow only 1 copy of Total Commander at a time" set.
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
Sektor
Member
Member
Posts: 157
Joined: 2007-04-04, 10:11 UTC
Location: Russia

Post by *Sektor »

@ghisler
Should I make a video with proof?
License #299429
There is no knowledge that is not power
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

If I make four desktop links as follows:
A TC 32bit
B TC 64 bit
C TC 32bit run as admin
D TC 64bit run as admin

Here is where more than one instance is still possible:

B+A
B+C
C+A
C+B
D+A
D+B
D+C

Tested under Window 7 with TC 9.20b4. TC 32bit and TC 64 bit are installed in separate directories, and uses separate wincmd.ini files both with settings:
UseIniInProgramDir=7
onlyonce=1
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
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2petermad
As I wrote above, I can handle the cases B+A and B+C. However, I cannot fix all the others, because the TC running with normal rights cannot communicate with the TC running with Admin rights.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The following should be fixed in Beta 5:
No launch of TC 32-bit while TC 64-bit was already open (both run as normal user).
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 »

@ghisler(Author): Normal TC can't find windows of the elevated TC due to User Interface Privilege Isolation (windows are user objects).

But what do you think about using some kernel object, like a named event? TC could call CreateEvent and check if GetLastError = ERROR_ALREADY_EXISTS to see if there is already some existing TC instance.

Important 1: event is automatically closed on process termination (and destroyed when an internal reference counter is 0), so there is no risk that killing first TC instance will block next TC instances.

Important 2: every logged-in user has his own namespace, so events of one logged-in user (on a server Windows machine) will not block other logged-in users.


This tiny test program seems to work with all elevated/non-elevated combinations:

Code: Select all

program Test;
uses
  Windows;
begin
  if CreateEvent(nil,False,False,'SomeEventName') = 0 then
    MessageBox(0,'some serious failure','',0)
  else
  if GetLastError = ERROR_ALREADY_EXISTS then
    MessageBox(0,'next instance','',0)
  else
    MessageBox(0,'first instance','',0);
end.
Regards
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

I can handle the cases B+A and B+C
Well D+C also seem to be fixed in TC 9.20b5 :-)
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
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, D+C can see each other.

I don't currently plan to use any other means of detection. Why? Even when normal TC could see admin TC, it wouldn't be allowed to send new directories to it. I could allow receiving of WM_COPYDATA, but it would be a huge security risk.
Author of Total Commander
https://www.ghisler.com
Post Reply