Directory listings with more than 65k files are messed up

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

Moderators: white, Hacker, petermad, Stefan2

Post Reply
dvdmaster
Junior Member
Junior Member
Posts: 3
Joined: 2005-03-07, 09:06 UTC

Directory listings with more than 65k files are messed up

Post by *dvdmaster »

When I enter a directory with more than approx. 65k files, than the following happens: if I scroll down using the scrollbar on the side, files 1-65k are listed properly. If I scroll further down than it begins to list from 1 again. So all files between 65k and the end are not listed.

This seems to be the same in 7.56a.

Please provide a fix for this, as it forces me to go back to Explorer for the first time in 15 years! ;)

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

Post by *Dalai »

I can confirm this in a limited way. I created 70k files using the following script:

Code: Select all

@echo off

if "%~1"=="" (
    echo Please specify directory to create files in!
    goto :EOF
)

pushd "%~1"

for /L %%i IN (1,1,70000) DO (
    if %%i LSS 10 call :DO 0000%%i
    if %%i LSS 100 if %%i GEQ 10 call :DO 000%%i
    if %%i LSS 1000 if %%i GEQ 100 call :DO 00%%i
    if %%i LSS 10000 if %%i GEQ 1000 call :DO 0%%i
    if %%i LSS 100000 if %%i GEQ 10000 call :DO %%i
)
popd
goto :EOF

:DO
echo Creating %1
copy NUL %1 >NUL
goto :EOF

and I can scroll to every file in this directory using the scroll bars just fine on WinXP. However, on Win7 the bug exists as described by dvdmaster no matter which TC version is used (tried 7.56a and 8.0 Beta 15 x86 and x64). So this could be a limitation of Win7 GUI elements used by TC.

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
dvdmaster
Junior Member
Junior Member
Posts: 3
Joined: 2005-03-07, 09:06 UTC

Post by *dvdmaster »

Dalai wrote:I can confirm this in a limited way. I created 70k files using the following script:

and I can scroll to every file in this directory using the scroll bars just fine on WinXP. However, on Win7 the bug exists as described by dvdmaster no matter which TC version is used (tried 7.56a and 8.0 Beta 15 x86 and x64). So this could be a limitation of Win7 GUI elements used by TC.
I was using Win7 64-bit. Forgot to mention it in the original post...
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

Confirm for both 32- and 64-bit versions, but only in Full View (or any multi-column one), and only when scrolling by dragging the scrollbar. If I scroll using the mouse wheel or the keyboard, files are listed correctly.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This is a known bug of the Windows listbox control.

The problem is that the "position" field of the WM_VSCROLL message is only 16 bit short. The scroll position isn't handled by Delphi, but by Windows itself, so it's clearly a Windows bug which is still in Windows 7.

Subclassing the listbox and handling the message directly seems to fix the problem. Here is the code I'm going to use in the next beta:

Code: Select all

  if (message.msg=wm_vscroll) and (items.count>32766) and
    ((message.wparamlo=sb_thumbposition) or
     (message.wparamlo=sb_thumbtrack)) then begin
    scrollinfo.cbsize:=sizeof(tscrollinfo);
    scrollinfo.fmask:=SIF_TRACKPOS or SIF_POS;
    GetScrollInfo(handle,SB_VERT,scrollinfo);
    if message.wparamlo=sb_thumbtrack then
      newposition:=scrollinfo.nTrackPos
    else
      newposition:=scrollinfo.nPos;
    oldposition:=SendMessage(handle,lb_gettopindex,0,0);
    if newposition<>oldposition then
      SendMessage(handle,lb_settopindex,newposition,0);
    exit;
  end;
As you can see, the position sent via WM_VSCROLL is ignored - instead, GetScrollInfo is used, as described here:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb787577%28v=vs.85%29.aspx
Note that the WM_VSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_VSCROLL (and WM_HSCROLL) for scroll position data have a practical maximum position value of 65,535.
I wonder why Microsoft didn't implement their own suggestion in the listbox control...
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9400
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

ghisler(Author) wrote:[...] so it's clearly a Windows bug which is still in Windows 7.
But why does it work on WinXP and even Win2k (checked just now) but not on Win7? MS (re)introduced a bug?

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: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It may be related to themes/AeroGlass. I noticed that the AeroGlass controls don't behave the same as the "normal" controls.
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9400
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

I don't use Aero Glass (no 3D acceleration in VMware 5.5 available) und even tested it with Windows Classic Theme on Win7 (and Luna Theme on WinXP): nothing changes, the problem persists on Win7, but I can't reproduce it on XP. So it's kind of weird...

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
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

Confirm fixed in 8.0β16.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

History.txt wrote:12.01.12 Fixed: Directory lists with more than 65535 items could not be scrolled by dragging the scrollbar (32/64)
I can confirm the fix with 8.0ß16 x86/x64, Windows 7 x64 aero glass enabled.

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

Post by *Dalai »

I can confirm the fix, too.

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: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks!
Author of Total Commander
https://www.ghisler.com
Post Reply