Network (UNC) Tabs and user authentication

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Dark-Star
Junior Member
Junior Member
Posts: 74
Joined: 2004-12-01, 14:15 UTC
Location: Reutlingen, GERMANY

Network (UNC) Tabs and user authentication

Post by *Dark-Star »

Hi,

I just noticed a small (but annoying) bug.

Suppose you have 3 tabs oben, Tab A, Tab B and Tab C (in that order).
Let's say Tab A and Tab C show some path on your local disk, and Tab B is connected to an UNC path to some device on your network.

Now let's also say that the network device requires a username and password on the first connection.

If you are now on Tab A, and press Ctrl-Tab to switch to tab B, then there will be a slight delay and then Windows pops up the "please enter your user name and password" dialog box. Now comes the buggy part: if you decide you want to tab through to the next tab, tab C, before the Windows dialog box pops up, then after entering your username/password, TC will change Tab C to the network path instead of (re-)connecting Tab B. So you now have both tabs B and C showing the network path.

-Darkstar
#40099 50-user license
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, I don't think that I can prevent that - the dialog comes from Windows, not TC itself. TC cannot know for which part this dialog is shown (TC only 'sees' that the focus is taken away).
Author of Total Commander
https://www.ghisler.com
Dark-Star
Junior Member
Junior Member
Posts: 74
Joined: 2004-12-01, 14:15 UTC
Location: Reutlingen, GERMANY

Post by *Dark-Star »

But it is different for example from waiting for a very slow drive to respond (in that case TC blocks completely).
So the waiting must happen somewhere in the background for net connections. And if it's waiting in the background, it should be possible to give this waiting thread some info on which tab it is working.

Or, as different solution, instead of changing the current tab unconditionally, simply check all other tabs to see if one of these matches the new UNC path exactly, and if so, update that one instead of the current tab...

-Darkstar
#40099 50-user license
User avatar
Hacker
Moderator
Moderator
Posts: 13064
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

I can confirm that similar things happened to me, though I have never tried to reproduce it. Basically, if you are switching tabs and one of them points to a dir that is slow to read (many many files, external drive in standby mode, etc.) and you keep trying to switch tabs (before the "Connect" dialog appears), sometimes TC changes the path of the newly switched-to tab to the path of the slow to read tab.
I assume this is not easy to troubleshoot, I just want to confirm that such a condition exists.

Roman
Last edited by Hacker on 2013-04-08, 09:50 UTC, edited 1 time in total.
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
umbra
Power Member
Power Member
Posts: 871
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

Issues, when content of one tab affects path in other tabs, are not rare at all (example1, example2). Some of them got fixed, others not. Maybe it's time to consider separating tabs with their respective panels to completely independent objects in their own threads to fix this kind of bugs, to prevent constant freezes caused by slow drives or wdx plugins and to enable features like tab-specific filters.
Windows 7 Pro x64, Windows 10 Pro x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2umbra
This does not help because Windows just displays the dialog by itself - it doesn't tell TC where it came from.
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 »

If Total commander used separate thread for each tab, there could be a possibility of detecting such an unexpectedly displayed "enter password" system dialog box (but only if operating system displays this dialog box in the context of the thread that tries to connect to the network). We could use EnumThreadWindows API call, and check for windows with "#32770" class name (this is a class name for all dialog boxes). There is also an useful GetWindowThreadProcessId API function.

However, as far as I can see using a debugger, all tabs use same thread.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Are you sure that the dialog is shown in the context of the calling thread, and not the main UI thread?
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 »

I wasn't able to reproduce this system dialog box, which asks for user name and password. I don't have any network device that requires such an authorization, or I don't know how to enable it, maybe someone could give me detailed instructions how to achieve this dialog box.

But let's make for the moment the following assumptions:
- TC creates separate thread for each tab (which is currently not true)
and
- one of the tabs causes Windows to display dialog box
and
- this dialog box is in the came thread that the tab (tab thread calls some network API function and this function simply displays dialog box before connecting).

Only for these 3 assumptions it could be possible to detect potential dialog box - by using EnumThreadWindows API, GetWindowThreadProcessId API or by hooking message queue of the thread and detecting WM_INITDIALOG message (hooking would be required, because modal dialogs have their own, internal message loop, which we can't control directly). Currently all tabs use the same thread, so it's impossible to distinguish them.
Post Reply