Explorer still limited by MAX_PATH

by Joshua Harley 23. August 2009 00:41

With the upcoming release of Windows 7 by Microsoft I am still surprised at a limitation of Explorer that has been around since explorer was first introduced with Windows 95. When Microsoft first introduced Windows 95 they included long filename support. This long filename support allowed Windows to store a filename of “up to 255 characters” while still maintaining compatibility with DOS and previous versions of Windows.

Remember filenames like LETTER~1.DOC and directories like PROGRA~1? Well, believe it or not they still exist by default in Windows 7! You can confirm this yourself by opening a command prompt and running the dir /x command. This will display files in the current directory with both their long filenames and DOS compatible filenames. Of course you can turn this filename generation off by setting the appropriate registry keys.

Back with Windows 95 the Windows API generally provided only ANSI functions. ANSI strings were either single-byte or a variable-width multi-byte arrays. When Windows NT came along with its new kernel, all of the internal strings were represented in Unicode (double-width) character arrays.

The string "HELLO" in ANSI:
Byte: 1 2 3 4 5 6
Data: H E L L O \0
The string "HELLO" in Unicode:
Byte: 1 2 3 4 5 6 7 8 9 10 11 12
Data: H \0 E \0 L \0 L \0 O \0 \0 \0

Along with the Unicode kernel, Windows NT also included updated APIs that used the new Unicode strings. So for every CreateFileA you now had a CreateFileW. To maintain backwards compatibility the original CreateFileA still had the limitation on the length of the path that Windows 95 did. Otherwise known by the macro of MAX_PATH which is defined as 260. Since CreateFileW was a new function, there was no backwards compatibility to maintain, so Microsoft provided a way to provide a path up to 32,676 characters. You can read more about the maximum path length on MSDN.

The drawback of still providing both APIs is that as applications pick and choose they can run into issues with the length of the path. Microsoft Word uses the CreateFileW function which allows them to create longer filenames than explorer can handle. I was hoping that in Windows 7 Explorer would finally be updated to use the Unicode CreateFile function… since Windows 95 was released over 14 years ago.

Unfortunately I ran into Explorer’s 260 character limitation just the other day. One of the deleted files resulted in a path of 273 characters long and the following dialog popped up:

The folder contains items whose names are too long for the Recycle Bin.

Comments

6/6/2010 3:09:20 AM #

Darrick Dreese

Hey keep posting articles like this. They are very informative.

Darrick Dreese United States

6/6/2010 7:51:32 PM #

Tom @ Web Design Surrey

I'm not 100% on this, but I do like the idea. :-)

Tom @ Web Design Surrey United States

6/10/2010 7:51:13 PM #

free movies online to watch

Hey there. This is a very nice blog. You actually made a good work! Congrats :)

free movies online to watch United States

6/11/2010 10:59:50 PM #

Premium Directory

Very Great Blogpost. Would you mind if I take a tiny snippets of the write-up and needless to say link it for your blogposts??

Premium Directory United States

6/18/2010 2:58:19 AM #

glass etching cream

Hi there! Very useful post! I am very happy that I was able to stumble upon your blog while searching Google. Koodles for this great post!

glass etching cream United States

6/21/2010 2:42:29 AM #

Del Darcus

I enjoy your website.This post was a time saver! Thanks.

Del Darcus United States

6/26/2010 11:41:31 AM #

peter penusi

nice way to present infrmation this, your blog is very easy for the user to read

peter penusi United States

6/30/2010 1:57:55 AM #

Renae Shillinger

Howdy man, hehe ...what has occurred??l your website is pretty unattractive in my mobile phone web browser! But I'm adoring the information so awesome work. Incidentally, you are able to get <a href="http://www.clubseo.net">free web site design</a> at ClubSEO.net. It's a really good technique to get your key web site more visible too! Take a look if you acquire a second. I did a couple of sites there and just pointed them all back to my blog and I get tons of new relevant subscribers now. Anyhow, thanks for the shizzle man. Have a perfect summer season and junk! :D

Renae Shillinger United States

6/30/2010 11:18:54 AM #

clothing

Your website is  getting more traffic thanks to sites like Myspace and other social sites. Thanks for the cool post check for updates.

clothing United States

7/1/2010 11:50:06 AM #

gollum

This is my second visit to your site!  I really enjoy your article and I believe I'll become a frequent visitor to your site! I enjoy your in depth posts about windows 7 and I enjoy the fact you are so knowledgeable about windows 7.  Thanks for your time :)

gollum Afghanistan

7/7/2010 3:35:37 PM #

Gerald Roesch

go figure :-|:)}

Gerald Roesch Lebanon

7/9/2010 8:20:43 AM #

Denae Marcellino

Hi, I was researching the net  and I discovered your web site. Carry on the superb job.

Denae Marcellino Armenia

7/18/2010 4:44:32 AM #

netbook deals

A Trifle off topic perhaps, but anyways - which template are you using? I really love the menu style.

netbook deals United States

7/20/2010 6:54:27 AM #

7 day diet

Fantastic blog!  I dont think Ive seen all the angles of this subject the way youve cleared them out.  Youre a true star, a rock star man.  Youve got so much to say and have a lot of knowledge about the subject that I think you should just teach a class about it...HaHa!

7 day diet United States

7/27/2010 5:31:57 AM #

christmas toys

Your web site is very much worthy of a bookmark. Thank you for the terrific and cool post!

christmas toys United States

7/28/2010 6:00:09 PM #

Merle Naimoli

Halo admin I enjoy with ur article . May i save this post for my examination ? thank you adminstrator of http://freakgsm.com

Merle Naimoli United States

7/29/2010 7:41:11 AM #

digital drums

Cheers for the info. The internet is so full of junk its difficult to find what youre looking for these days. Do you have an rss feed on this site?

digital drums United States

8/5/2010 1:49:22 PM #

acutain

I was perusing your site a while ago and for some unknown reason a couple of the pictures were not showing up. I guessed it was just the browser(I am use firefox by the way) but I also used my evo and even another operating system and I still had the same problem.The missing pictures made your website pretty much destroy itself so just giving the author the information.

acutain United States

8/16/2010 10:24:15 AM #

inspection nightmares

You raise many questions in my head. you wrote a good post, but it is also mind provoking, and I will have to think about it some more I will return soon. All in all... this is what I was looking for. Kudos!

inspection nightmares United States

8/19/2010 2:22:24 PM #

Social Networking Platform

Explorer can be quite limiting, it's a shame they don't fix this.

Social Networking Platform United States

9/1/2010 4:50:43 PM #

Los Angeles CPA

I stopped using Windows for reasons just like this. A little bit of a learning curve with my new Mac, but my problems are so fewer. I had a an old Pc crash on me for not being able to read a file name that was too long... what???  windows 7 is very nice looking though, ha ha :)

Los Angeles CPA United States

9/7/2010 8:56:46 AM #

overstock coupon code

Effortlessly, the website post is in fact the very best on this valuable theme. I agree with your decisions and will thirstily look forward to read your approaching updates. Just saying thanks will not just be sufficient, for your phenomenal clarity inside your writing. I will directly grab your feeds to stay informed of any updates. Fabulous operate and significantly success with your business enterprise! Have a nice day

overstock coupon code United States

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading