{"id":27413,"date":"2007-04-02T10:00:00","date_gmt":"2007-04-02T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/04\/02\/why-do-operating-system-files-still-adhere-to-the-old-8-3-naming-convention\/"},"modified":"2007-04-02T10:00:00","modified_gmt":"2007-04-02T10:00:00","slug":"why-do-operating-system-files-still-adhere-to-the-old-8-3-naming-convention","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070402-00\/?p=27413","title":{"rendered":"Why do operating system files still adhere to the old 8.3 naming convention?"},"content":{"rendered":"<p>\nCommenter\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/04\/12\/574927.aspx#574976\">\nBrian Reiter<\/a>\nasks a duplicate of a\nquestion that was already submitted to the Suggestion Box:\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#416908\">\nDarren asks\nwhy operating system&dagger; files still (for the most part)\nadhere to the old 8.3 naming convention<\/a>.\n<\/p>\n<p>\nThere are a few reasons I can think of.\nI&#8217;m not saying that these are <i>the<\/i> reasons;\nI&#8217;m just brainstorming.\n<\/p>\n<p>\nFirst, of course, the name of a DLL cannot change once it has been\nchosen, because that would break programs which linked to that DLL\nby its old name.\nWindows&nbsp;95 did not require the system volume and user profile\nvolume to support long file names, although that was certainly the\ncase by default.\nCompanies which used\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/06\/30\/434209.aspx\">\nroaming profiles<\/a>\nor\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/02\/06\/525700.aspx\">\nredirected folders<\/a>\nmay have had a heavy investment in servers which did not support\nlong file names.\nTherefore, all system files on Windows&nbsp;95 had to conform to the\n8.3 naming convention.\n<\/p>\n<p>\nI believe that\nWindows&nbsp;NT permitted the system volume to be a short-file-names-only\nFAT partition as late as Windows&nbsp;2000.\nTherefore, any DLL that existed in the Windows&nbsp;2000 era\nhad to conform to the 8.3 naming convention.\n<\/p>\n<p>\nStarting in Windows&nbsp;XP, long file names became mandatory,\nand a few system files\nsuch as\n<code>shellstyle.dll<\/code>\nwaded tentatively into the long file name world.\n(The .NET Framework folks jumped in with both feet with their managed\nDLLs, but notice that their unmanaged DLLs like\n<code>mscoree.dll<\/code> still conform to 8.3.)\nBut the waters in this world can be treacherous for operating\nsystem components.\n<\/p>\n<p>\nFirst of all, you have to worry about the automatically-generated\nshort name.\nSuppose the operating system setup program is copying the\n<code>shellstyle.dll<\/code> file, but there is already a file\ncalled <code>shellstuff.dll<\/code>.\nThe short name for <code>shellstuff.dll<\/code> will probably be\n<code>SHELLS~1.DLL<\/code>,\nand therefore the short name for\n<code>shellstyle.dll<\/code> will likely be\n<code>SHELLS~2.DLL<\/code>.\nNow, this may not be a big deal, except that some programs\nlike to hard-code a file&#8217;s short name.\n(There are a lot of programs that assume that the Program Files\ndirectory is C:\\PROGRA~1, for example.)\n<\/p>\n<p>\nFurthermore, you can create confusion if the same DLL is loaded\nby both its short and long names, since the loader treats them as\ndistinct:\n<\/p>\n<pre>\n#include &lt;stdio.h&gt;\n#include &lt;windows.h&gt;\nint __cdecl main(int argc, char **argv)\n{\n printf(\"%p\\n\", LoadLibrary(\"SHELLS~1.DLL\"));\n printf(\"%p\\n\", LoadLibrary(\"SHELLSTYLE.DLL\"));\n return 0;\n}\n<\/pre>\n<p>\nIf you run this program, you will get something like this:\n<\/p>\n<pre>\n6F2C0000\n00340000\n<\/pre>\n<p>\nEven though the two paths refer to the same DLL,\nthe loader treats them as different, and you end up with two\ncopies of the same DLL loaded into memory.\nNow things get confusing, since you now have two sets of\nglobal variables, and if two components both use\n<code>SHELLSTYLE.DLL<\/code> but one used the short name and\nthe other the long name, things get exciting when those two\ncomponents try to talk about what they think is the same thing.\n<\/p>\n<p>\nIt&#8217;s like that time when I was a child and our family\ntook a trip to Disneyland.\nOur parents put my brother and me on the gondola ride,\nand upon arrival at the other end, we were to go to the\nAutopia ride which was right next door.\nThe plan was that our parents would meet us at the exit to\nAutopia.\nWhen my brother and I exited Autopia, we expected our parents to\nbe waiting there for us, but they were nowhere to be seen.\nSticking to the plan, we waited patiently for our parents to arrive.\nWe sat there for what seemed like two hours\n(but which was probably much less),\nuntil eventually\nwe decided that my brother would stay put and I would go looking around,\nat which point it didn&#8217;t take long for me to find my father,\nwho was walking around looking for us.\n<\/p>\n<p>\nWhat went wrong?\nWell, the problem was that the map of Disneyland showed Autopia,\nbut what the map didn&#8217;t say was that there were <strong>two<\/strong>\nAutopia rides (and therefore two Autopia exits) right next to each other.\nMy brother and I were waiting by one exit, and our parents\nwere waiting by the other.\nEach of us thought the other party was simply late.\n<\/p>\n<p>\nSimilarly, if a DLL goes by multiple names, you can end up with two\ncopies of it loaded into the process, with different components talking\nabout different copies, unaware that they are talking about different\nthings.\n<\/p>\n<p>\nAnd one final reason I can think of for sticking with 8.3 file names\nfor operating system DLLs is simply,\n&#8220;Well, that&#8217;s the way we&#8217;ve always done it.\nAll the problems with 8.3 names are well-understood and under control.\nIf we switched to long file names, we&#8217;d end up discovering a whole\nnew set of problems.\nWhy mess with something that works if it isn&#8217;t broken?&#8221;\n<\/p>\n<p>\nBetter the devil you know.\n<\/p>\n<p>\nExercise: Why is it okay for the .NET Framework to use long\nfile names for their managed DLLs?\n<\/p>\n<p>\n<b>Nitpicker&#8217;s Corner<\/b>\n<\/p>\n<p>\n&dagger;s\/operating system\/Windows operating system\/.\nApparently nothing is obvious from context any more.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Commenter Brian Reiter asks a duplicate of a question that was already submitted to the Suggestion Box: Darren asks why operating system&dagger; files still (for the most part) adhere to the old 8.3 naming convention. There are a few reasons I can think of. I&#8217;m not saying that these are the reasons; I&#8217;m just brainstorming. [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-27413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>Commenter Brian Reiter asks a duplicate of a question that was already submitted to the Suggestion Box: Darren asks why operating system&dagger; files still (for the most part) adhere to the old 8.3 naming convention. There are a few reasons I can think of. I&#8217;m not saying that these are the reasons; I&#8217;m just brainstorming. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/27413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=27413"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/27413\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=27413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=27413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=27413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}