The MASM Forum

General => The Workshop => Windows API => Topic started by: jj2007 on May 13, 2024, 09:02:12 PM

Title: Deepest nesting level of folders
Post by: jj2007 on May 13, 2024, 09:02:12 PM
Theoretically, the nesting level of folders is limited only by the 32767 characters limit. Which is the deepest level you've ever seen in practice?
Title: Re: Deepest nesting level of folders
Post by: sinsi on May 13, 2024, 09:48:28 PM
Visual Studio and Windows SDKs can get 12 or so levels deep. Long filenames too.
Title: Re: Deepest nesting level of folders
Post by: jj2007 on May 13, 2024, 10:21:44 PM
Thanks, Sinsi, sounds good :thumbsup:

I am working on a new implementation of GetFiles and was wondering how much stack space I need for the recursion.
Title: Re: Deepest nesting level of folders
Post by: sinsi on May 13, 2024, 11:16:55 PM
To be absolutely sure, allocate some memory with HeapAlloc for each recursive call.
Not really any overhead and you can still address it with a register.
Title: Re: Deepest nesting level of folders
Post by: jj2007 on May 13, 2024, 11:39:11 PM
That was exactly what I wanted to avoid, as it is somewhat slower than StackBuffer() (https://www.jj2007.eu/MasmBasicQuickReference.htm#Mb1255).

Vaguely related: dir /b /s C:\Windows\WinSxS\Backup\*.dll >1.txt finds (inter alia) this path:

C:\Windows\WinSxS\Backup\wow64_microsoft-windows-uxtheme_31bf3856ad364e35_10.0.19041.3996_none_24b66de1f057bd20_uxtheme.dll_9f6cda06

Search for _uxtheme.dll_ in your C:\Windows\WinSxS\Backup\ folder. What's your opinion, does ....dll_9f6cda06 have the dll extension?

Title: Re: Deepest nesting level of folders
Post by: sinsi on May 13, 2024, 11:58:00 PM
Strictly speaking, no, it has a dll_9f6cda06 extension. The contents would show that it is a DLL file, though.
Windows Explorer shows it that way and the icon is a generic icon, not the Application Extension one.

Short name, long name, just to confuse the issue :biggrin:
QuoteAMF437~1.DLL
amd64_microsoft-windows-uxtheme_31bf3856ad364e35_10.0.22621.3447_none_85cdbc9d82238346_uxtheme.dll_9f6cda06
Title: Re: Deepest nesting level of folders
Post by: jj2007 on May 14, 2024, 01:28:04 AM
Quote from: sinsi on May 13, 2024, 11:58:00 PMStrictly speaking, no, it has a dll_9f6cda06 extension.

Yep, that's what I thought, too. Maybe searching for *.dll should not find the file, but searching for *.dll* should.

Similar: .inf_loc (there are plenty of them in WinSXS). One could argue that it's a "fixed" ending, while .dll_9f6cda06 is "variable" :cool:
Title: Re: Deepest nesting level of folders
Post by: sinsi on May 15, 2024, 03:12:44 PM
After some more tests the maximums I've found are deepest level is 26 and longest path is 504 (AdobeTemp for both)
Title: Re: Deepest nesting level of folders
Post by: jj2007 on May 15, 2024, 05:48:56 PM
Thanks, so using the stack for the recursion will be no problem :thumbsup: