Long File Names and AccessEnum

Hi guys! (I can hardly believe any girls reading us)

Today I want to talk you about handling of long file names in windows. Those of you who have windows 10 or windows 2016 can safely ignore this article, these 2 windows do not have any troubles with long file names.

As you might know maximum file length in windows is 260 symbols. However in many cases users create rather longer names using network disks or whatever they do)

Recently I got a task to scan 20Tb of users data and find out where everyone or domain users groups have full permissions. I found a perfect free program that fit to my needs, it is AccessEnum from sysinternals. When I started to scan disks it appeared that some files or folders displayed as “???”. I checked them in windows and it appeared that their path length overcome 260 symbols. Peoples are lazy, so I did not want to write any custom scripts to get my job done and started to look for workarounds. At this time I found an article about Windows API. I’ve been working as IT engineer for 10+ years but never heard about this. If you are too bored with Windows API article I can tell you in short that Windows can handle path by 32767 characters it depends just how to ask it.

Here comes magic combination \\?\

For some reasons search engines do not give any results when you try to search for \\?\ combination, but it is  there.

So when you type \\?\C:\temp application will have no problems to handle long file names. For UNC path you can use \\?\UNC\ preffix.

When I tried to use \\?\ preffix for AccessEnum application it no longer had any troubles with long file names


Please consider that not all windows applications might undersdand \\?\ suffixes, but it always worth to give it a try!

#Long File Names # AccessEnum #Windows API #\\?\ #\\?\UNC\