[8.52ax86] TC shows 'CD-ROM' tooltip on 0th FTP drive button

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

2ghisler(Author)
Have you been able to reproduce this bug? If so, I'm curious why drive bar and drive list show different tooltips.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, I managed to reproduce and fix it! The error was in the function to get the volume label. Strangely, GetDriveType(ord(drv)-ord('A')) was returning drive_cdrom for drv='0' (parameter =-17), not an error...
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

ghisler(Author) wrote:Strangely, GetDriveType(ord(drv)-ord('A')) was returning drive_cdrom for drv='0' (parameter =-17), not an error...
Huh? How did you manage to call a function that expects an LPCTSTR parameter with an ordinal parameter?

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

Dalai wrote:
ghisler(Author) wrote:Strangely, GetDriveType(ord(drv)-ord('A')) was returning drive_cdrom for drv='0' (parameter =-17), not an error...
Huh? How did you manage to call a function that expects an LPCTSTR parameter with an ordinal parameter?

Regards
Dalai
Ghisler is referring to the PASCAL/Lazarus function, not to the WIN API of the same name :D
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

elgonzo wrote:Ghisler is referring to the PASCAL/Lazarus function, not to the WIN API of the same name :D
There's only one function in Delphi with that name (unit Windows) and it expects a string type as parameter, that's why I'm baffled - hence the question. You can see for yourself in Emba's DocWiki. Lazarus/Free Pascal doesn't matter here because TC 32 bit is compiled with Delphi.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

Dalai wrote:
elgonzo wrote:Ghisler is referring to the PASCAL/Lazarus function, not to the WIN API of the same name :D
There's only one function in Delphi with that name (unit Windows) and it expects a string type as parameter, that's why I'm baffled - hence the question. You can see for yourself in Emba's DocWiki. Lazarus/Free Pascal doesn't matter here because TC 32 bit is compiled with Delphi.

Regards
Dalai
In the interwebs, I found different code examples using GetDriveType. Some use PChar(...) as a parameter, others use Ord(...) like ghisler mentioned (like here or here). I guess this function has either different overloads, there are different implementations/units or the implementation has been changed at some point in time.

By the way, where on the wiki you linked can the documentation for GetDriveType be found? Generally, i was unsuccessful to find any online documentation about it or its unit aside from some code snippets scattered across different wikis and forum posts. Anyway, it's not really that important... :wink:
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

elgonzo wrote:I guess this function has either different overloads
Nope. As I said: it's only PChar (Delphi 5 through XE2) or LPCSTR (Delphi XE8).
[...] or the implementation has been changed at some point in time.
Yeah, that's most likely the case. I guess it was declared differently in Delphi 2. The question is: What does the API do with an ordinal parameter? Does it interpret/convert it correctly? Well, we'll probably never know since only MS has the source code.
By the way, where on the wiki you linked can the documentation for GetDriveType be found?

It can't be found in there. You can search for it using the search feature on the left, but you won't find it because it's an API function, not some Delphi function. Search for PChar, Format or some other function to verify the search function works ;).

-----

Anyway. It may be a good idea to redeclare the GetDriveType function so that it does what it's supposed to do.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Works fine n TC 9.0b1. :)
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

Confirm the fix, tested with TC9 beta3.
Post Reply