This forum uses cookies. Click X button to hide this message. What is stored? / Privacy
Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Subst'ed/removable drive icon reused for new drives
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Total Commander Forum Index -> TC9.2x bug reports (English) Printable version
View previous topic :: View next topic  
Author Message
DrShark
Power Member
Power Member


Joined: 03 Nov 2006
Posts: 1092
Location: Kyiv, 68/262

PostPosted: Thu May 10, 2018 9:19 am    Post subject: Subst'ed/removable drive icon reused for new drives Reply with quote

This has been tested on TC 9.20 beta 2 on Vista 32-bit, with TC option "Show drive icons from Explorer".

If you already have a drive with custom icon, like c:\ on Vista, it's possible to reproduce it just with subst command.

Description of expected icon behavior:
1. After TC restart, subst a root of c:\ drive as t:, for example go to c:\ in TC and use a button:
Code:
TOTALCMD#BAR#DATA
subst t:
%p.
%COMSPEC%
Subst current path to temp t: drive

1
-1

You'll see in a drive bar the t: drive made by subst command has an icon of c: drive.
Now remove subst'ed drive:
Code:
TOTALCMD#BAR#DATA
subst t: /D

%COMSPEC%
Remove temp t: substed drive

1
-1

2. Restart TC, do the same for a drive without icon instead of c:\, you'll see subst'ed drive won't have icon too.

To reproduce the bug:
1. Restart TC.
2. From TC, using a button shown above, subst a drive using a root of another drive as a target. For test, try a drive without a custom icon.
3. In current TC session, remove sub'sted drive.
4. In current TC session, use subst for a root of drive which has custom icon. It's expected (see above) that new drive will have the icon of drive for which subst used, but instead it won't have an icon (because TC shows an icon for drive made in step 2, which is removed now).
In step 4, instead of subst'ing a new drive, you can connect a usb drive with custom icon (which may even have another drive letter), but TC won't show an icon for it too. If subst'ed drive in step 2 had custom icon, it will be re-used for a new drive which appears in step 4.
This wrong icon is re-used probably in all places where TC uses drive icons: drive bar, drives list, breadcrumb, trees...
_________________
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
Back to top
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35473
Location: Switzerland

PostPosted: Fri May 11, 2018 2:35 am    Post subject: Reply with quote

I have checked this now in the debugger. Unfortunately it seems to be a bug in Windows itself: Total Commander requests the icon via SHGetFileInfoW(...SHGFI_SYSICONINDEX | SHGFI_SHELLICONSIZE | SHGFI_USEFILEATTRIBUTES,...) and does NOT cache it. I'm getting the same index for the subst'ed drive even when the target changes.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DrShark
Power Member
Power Member


Joined: 03 Nov 2006
Posts: 1092
Location: Kyiv, 68/262

PostPosted: Fri May 11, 2018 4:04 am    Post subject: Reply with quote

It seems bug happens if some drive has been disconnected/removed during TC session before connecting/creating with subst a new drive. And it also seems after Total Commander restart it shows correct icons for new drive that had wrong icon in previous session.
Can you confirm it? If yes, maybe it is possible to detect drive remove/disconnect event and then make Windows think that TC has been closed, so when new drive will be connected in that TC session, Windows will return a correct icon for it?
_________________
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
Back to top
View user's profile Send private message
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 763
Location: Poland

PostPosted: Fri May 11, 2018 5:19 am    Post subject: Reply with quote

ghisler(Author) wrote:
I'm getting the same index


But maybe icon contents change, and TC caches previous contents somehow? (by not updating some image list(s) properly?)
Back to top
View user's profile Send private message Send e-mail
DrShark
Power Member
Power Member


Joined: 03 Nov 2006
Posts: 1092
Location: Kyiv, 68/262

PostPosted: Fri May 11, 2018 1:47 pm    Post subject: Reply with quote

Just in case it matters: if in step 4 to connect a real usb drive with a custom icon, for a short time (a second or so) after drive letter on a drive bar appears, correct custom icon is shown for it, then it gets replaced with an icon used for a drive from step 2.
_________________
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
Back to top
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35473
Location: Switzerland

PostPosted: Wed May 16, 2018 10:38 am    Post subject: Reply with quote

No, unfortunately TC isn't caching the icon. Therefore there is unfortunately no solution.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DrShark
Power Member
Power Member


Joined: 03 Nov 2006
Posts: 1092
Location: Kyiv, 68/262

PostPosted: Thu May 17, 2018 1:45 am    Post subject: Reply with quote

As I wrote, if after we got wrong icon in step 4 we're restarting Total Commander, restart fixes the issue (expected icon is shown for substed or connected over usb drive after TC restart).
Maybe it's possible to request the drive icons using a separate utility, which TC will also restart each time user removes the drive, and kill its process once the utility gets the correct icons (so no Windows icon caching will be applied to TC)?
_________________
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
Back to top
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35473
Location: Switzerland

PostPosted: Thu May 17, 2018 3:53 am    Post subject: Reply with quote

I have just created a small C program to get the icon from t:, and it has the same problem.

If only I knew when to restart it - restarting it for each drive request would be very slow.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DrShark
Power Member
Power Member


Joined: 03 Nov 2006
Posts: 1092
Location: Kyiv, 68/262

PostPosted: Thu May 17, 2018 4:43 am    Post subject: Reply with quote

I guess it should start once when TC starts to get icons for the first time, and then it should be restarted each time some drive is removed/disconnected (it seems the all the icons are correct if new drives are only added).
_________________
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
Back to top
View user's profile Send private message
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 763
Location: Poland

PostPosted: Thu May 17, 2018 12:57 pm    Post subject: Reply with quote

Yes, if TC gets some drive plugging/unplugging notifications from the operating system, this would be a good moment to verify/rebuild the icons.
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35473
Location: Switzerland

PostPosted: Fri May 18, 2018 4:28 am    Post subject: Reply with quote

I prefer not to change that for now, it would require far too many changes. It only seems to affect SUBSTed drives. And it's a constructed problem, it doesn't really occur in real life: Who would create a SUBSTed drive to another drive root? That's not useful at all.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DrShark
Power Member
Power Member


Joined: 03 Nov 2006
Posts: 1092
Location: Kyiv, 68/262

PostPosted: Fri May 18, 2018 5:32 am    Post subject: Reply with quote

ghisler(Author) wrote:
It only seems to affect SUBSTed drives. And it's a constructed problem, it doesn't really occur in real life: Who would create a SUBSTed drive to another drive root? That's not useful at all.
No need to create subst'ed drive from root: subst any location, drive w/o custom icon will appear, then remove it, then connect real usb device (like usb hdd) with a custom icon: the drive of real usb device won't have a custom icon (subst'ed default drive icon re-used for it)!

Also, I think it may happen even without substing drives at all. Somewhere on my PC I have a screenshot fom Windows 7 where I connected usb FDD after connecting and removing usb flash drive, and Total Commander showed the usb flash drive icon for usb FDD drive instead of FDD icon.
_________________
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
Back to top
View user's profile Send private message
DrShark
Power Member
Power Member


Joined: 03 Nov 2006
Posts: 1092
Location: Kyiv, 68/262

PostPosted: Fri May 18, 2018 1:47 pm    Post subject: Reply with quote

In addition to previous post, I reproduced it now on real devices without substing anything.

1. Start Total Commander.
2. Connet USB flash drive, which doesn't have a custom icon. For me, that was S: drive.
3. Disconnect the flash drive using a dialog called by a button:
Code:
TOTALCMD#BAR#DATA
control hotplug.dll

hotplug.dll
RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll


-1
.
4. Connect USB HDD with a custom icon. In my case it was a drive with autorun.inf (with r+a+h attributes), its content:
Code:
[autorun]
ICON=AUTORUN\WDLOGO.ICO

Result: drive appeared (it had another letter - D:) with default icon instead of custom icon defined in autorun.inf.

However, second (additional) launched instance of Total Commander showed correct custom icon for USB HDD drive. Also, simple restart of initial TC instance allows to see the correct custom icon of USB HDD drive.
_________________
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
Back to top
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35473
Location: Switzerland

PostPosted: Mon May 21, 2018 2:21 am    Post subject: Reply with quote

Quote:
connect real usb device (like usb hdd) with a custom icon: the drive of real usb device won't have a custom icon

NOT confirmed on Windows 10! It seems like Microsoft fixed the bug there.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DrShark
Power Member
Power Member


Joined: 03 Nov 2006
Posts: 1092
Location: Kyiv, 68/262

PostPosted: Tue May 22, 2018 12:43 am    Post subject: Reply with quote

ghisler(Author) wrote:
NOT confirmed on Windows 10! It seems like Microsoft fixed the bug there.
I reproduced it on 64-bit Windows 10:
Microsoft Windows [Version 10.0.16299.431]
both in TC 9.20 beta 3 x32 and x64 trying steps from that post:
https://ghisler.ch/board/viewtopic.php?p=341490#341490
(to remove drive in step 3 instead of hotplug button I had to use notification area icon because Win10 didn't recognize usb flash and usb hdd as removable drives.)
As a drive for step 2, I used 8 gb usb flash drive without custom icon.
As a drive for step 4, I used 1 tb usb hdd with custom icon.
For both drives, same H: drive letter used on Win 10.
In 1 tb HDD, it's a custom icon from USB HDD manufacturer, so in case it will help to reproduce the issue, I attached it to email with subject TC drive icons bug: wd icon
_________________
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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> TC9.2x bug reports (English) All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Imprint/Impressum: This site is maintained by Ghisler Software GmbH
Privacy Policy | Datenschutzerklärung | Politique de Confidentialité

Using phpBB © phpBB Group