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 Previous  1, 2
 
Post new topic   Reply to topic    Total Commander Forum Index -> TC Behaviour which will not be changed Printable version
View previous topic :: View next topic  
Author Message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35712
Location: Switzerland

PostPosted: Tue May 22, 2018 8:36 am    Post subject: Reply with quote

Not confirmed, I tried with your icon.
_________________
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
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 836
Location: Poland

PostPosted: Fri May 25, 2018 12:51 pm    Post subject: Reply with quote

I have much more simple problem which - I suppose - may be connected with the problem described here.

I created a pendrive containing Icon1.ico and Autorun.inf with the following contents:
Code:
[autorun]
icon=Icon1.ico


Tested with Windows 7 64-bit and TC 9.20 Beta 4 64-bit:

1) Open TC
2) Open also "Computer" to see Explorer icons
3) Insert pendrive
4) Explorer shows a new drive icon, which blinks for a moment and then finally displays Icon1.ico
5) TC shows a standard drive icon
6) Restart TC - now it shows Icon1.ico

Regards
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35712
Location: Switzerland

PostPosted: Mon May 28, 2018 8:28 am    Post subject: Reply with quote

Unfortunately I couldn't reproduce that on Windows 10. I tried with a USB stick and a USB harddisk, both with their own custom icons.

I will move this to "Will not be changed" for now.
_________________
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
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 836
Location: Poland

PostPosted: Mon May 28, 2018 2:37 pm    Post subject: Reply with quote

I found the reason.

Before going into details, one question: when are drive icons updated? In a WM_DEVICECHANGE handler?

Regards
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35712
Location: Switzerland

PostPosted: Tue May 29, 2018 8:56 am    Post subject: Reply with quote

Yes, when TC receives WM_DEVICECHANGE with wparam=DBT_DEVICEARRIVAL or DBT_DEVICEREMOVECOMPLETE options.

lparam then points to a DEV_BROADCAST_VOLUME structure. TC reacts when dbcv_devicetype=DBT_DEVTYP_VOLUME.

TC updates the icon immediately, and again with a 2 second delay.
_________________
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
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 836
Location: Poland

PostPosted: Wed May 30, 2018 12:03 pm    Post subject: Reply with quote

Ok, thanks.

What is the reason of trying again after 2 seconds?
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35712
Location: Switzerland

PostPosted: Thu May 31, 2018 2:58 am    Post subject: Reply with quote

When TC gets the icon immediately within WM_DEVICECHANGE, I ofent get just the default icon. However, some removable decides have autorun.inf defining a different icon. Apparenly Windows notices that only a bit after sending WM_DEVICECHANGE.
_________________
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: 1111
Location: Kyiv, 68/262

PostPosted: Thu Jun 07, 2018 7:42 am    Post subject: Reply with quote

As Christian Ghisler wrote in email, requesting icons using separate .exe program can't be used as a solution because it will cause a slowdown of drive icons appearance, especially on systems with real-time antivirus scanners, so we need different solution.

So it seems that sometimes Windows returns correct icon on 1st Total Commander request, and sometimes on 2nd request (2 seconds after 1st one) after WM_DEVICECHANGE event, and in some cases (mentioned in this topic) it may return correct drive icon on 1st request, but wrong icon second request? And since TC is using an icon it gets from second request, it uses wrong icon? Or Windows may return wrong icons for both requests? Maybe at least for a case with correct icon on first request and wrong one on second request, TC may somehow detect which icon is correct one?
_________________
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: 35712
Location: Switzerland

PostPosted: Fri Jun 08, 2018 4:10 am    Post subject: Reply with quote

TC uses icons from both first and second request. For example, when a USB stick has its own icon, TC will show standard icon received from first request, and it will change to the specific stick icon after the second request.
_________________
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: 1111
Location: Kyiv, 68/262

PostPosted: Sat Jun 09, 2018 3:11 am    Post subject: Reply with quote

ghisler(Author) wrote:
TC uses icons from both first and second request. For example, when a USB stick has its own icon, TC will show standard icon received from first request, and it will change to the specific stick icon after the second request.
Yes, but I meant the case where TC shows correct icon after first request, but wrong icon after second request. Can TC somehow detect it and then show only an icon from first request?
_________________
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: 35712
Location: Switzerland

PostPosted: Mon Jun 11, 2018 7:20 am    Post subject: Reply with quote

No, TC just shows what Windows returns. It has no chance to know whether a returned icon is right or wrong.
_________________
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
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 836
Location: Poland

PostPosted: Mon Jun 11, 2018 10:01 am    Post subject: Reply with quote

According to my tests, for a pendrive with custom icon defined in Autorun.inf, the following messages are received:

- WM_DEVICECHANGE with wParam = DBT_DEVICEARRIVAL is reveived - a standard drive icon is available in the image list,
- then one or more WM_DEVICECHANGE with wParam = DBT_DEVNODES_CHANGED is/are received - a custom (defined in Autorun.inf) drive icon is available in the image list.

This means, that TC should also handle WM_DEVICECHANGE messages with wParam = DBT_DEVNODES_CHANGED - and since DBT_DEVNODES_CHANGED passes no additional info, all removable drive icons should be refreshed on DBT_DEVNODES_CHANGED.

Regards
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35712
Location: Switzerland

PostPosted: Tue Jun 12, 2018 8:10 am    Post subject: Reply with quote

But does the icon really change to the correct one? Currently I'm simply re-reading the icons 2 seconds later, and it works fine here.

Could you test with my test tool whether it loads the correct icon when you click on the window?

All you need to do is change the drive letter of the drive to T:
https://totalcommander.ch/win/testiconproblems.zip

Or get the source code here:
https://totalcommander.ch/win/testiconproblems_src.zip
_________________
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
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 836
Location: Poland

PostPosted: Mon Jun 18, 2018 9:41 am    Post subject: Reply with quote

I performed tests with the tool and it works properly - but only because I'm not, as a human, fast enough to reproduce the problem. But I can easily reproduce the problem with my own, simple test tool. I will describe cause and all the possible solutions in the next post here.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> TC Behaviour which will not be changed All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 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