{"id":31653,"date":"2006-04-05T10:00:13","date_gmt":"2006-04-05T10:00:13","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2006\/04\/05\/adding-flags-to-apis-to-work-around-driver-bugs-doesnt-scale\/"},"modified":"2006-04-05T10:00:13","modified_gmt":"2006-04-05T10:00:13","slug":"adding-flags-to-apis-to-work-around-driver-bugs-doesnt-scale","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20060405-13\/?p=31653","title":{"rendered":"Adding flags to APIs to work around driver bugs doesn&#039;t scale"},"content":{"rendered":"<p>\nSome people suggested,\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/03\/30\/564809.aspx\">\nas a solution to the network interoperability compatibility problem<\/a>,\nadding a flag to <code>IShellFolder::EnumObjects<\/code> to indicate\nwhether the caller wanted to use fast or slow enumeration.\n<\/p>\n<p>\nAdding a flag to work around a driver bug doesn&#8217;t actually solve anything\nin the long term.\n<\/p>\n<p>\nConsidering all the video driver bugs that Windows has had to\nwork around in the past, if the decision had been made to surface\nall those bugs and their workarounds to applications, then\nfunctions like <code>ExtTextOut<\/code> would have several dozen\nflags to control various optimizations that work on all drivers\nexcept one.\nA call to <code>ExtTextOut<\/code> would turn into something like this:\n<\/p>\n<pre>\nExtTextOut(hdc, x, y, ETO_OPAQUE |\n           ETO_DRIVER_REPORTS_NATIVE_FONTS_CORRECTLY |\n           ETO_DRIVER_WILL_NOT_DITHER_TEXT_DURING_BLT |\n           ETO_DRIVER_DOES_NOT_LIE_ABOUT_LOCAL_TRANSFORMS |\n           ETO_DRIVER_DOES_NOT_CRASH_WITH_STOCK_BRUSHES,\n           &amp;rcOpaque, lpsz, cch, NULL);\n<\/pre>\n<p>\nwhere each of those strange flags is there to indicate that\nyou want to obtain the performance benefits enabled by each\nof those flags because you know that you aren&#8217;t running on\na version of the video driver that has the particular bug each\nof those flags was created to protect against.\n<\/p>\n<p>\nAnd then (still talking hypothetically)\nwith Windows&nbsp;Vista, you find that your program runs\nslower than on Windows&nbsp;XP: Suppose a bug is found in a\nvideo driver where strings longer than 1024 characters come out\ngarbled.\nWindows Vista therefore contained code to break all strings up\ninto 1024-character chunks, but as an optimization you could\npass the\n<code>ETO_PASS_LONG_STRINGS_TO_DRIVER<\/code>\nflag to tell GDI not to use this workaround.\nYour Windows&nbsp;XP program doesn&#8217;t use this flag,\nso it now runs slower on Windows&nbsp;Vista.\nYou&#8217;ll have to ship an update to your program just to get back\nto where you were.\n<\/p>\n<p>\nIt&#8217;s not limited to flags either.\nBy this philosophy of &#8220;Don&#8217;t try to cover up for driver bugs\nand just make applications deal with them&#8221;, you would\nhave had the following strange paragraph in the <code>FindNextFile<\/code>\ndocumentation:\n<\/p>\n<blockquote CLASS=\"m\"><p>\nIf\nthe <code>FindNextFile<\/code> function returns <code>FALSE<\/code>\nand sets the error code to\n<code>ERROR_NO_MORE_FILES<\/code>,\nthen there were no more matching files.\nSome very old Lan Manager servers (circa 1994) report this error condition\nprematurely.\nIf you are enumerating files from an old Lan Manager server\nand the <code>FindNextFile<\/code> function indicates that there are\nno more files, call the function a second time to confirm that there\nreally are no more files.\n<\/p><\/blockquote>\n<p>\nPerhaps it&#8217;s just me,\nbut I don&#8217;t believe that\nworkarounds for driver issues should become contractual.\nI would think that\none of the goals of an operating system would be to smooth out\nthese bumps and present a uniform programming model to applications.\nApplications have enough trouble dealing with their own bugs;\nyou don&#8217;t want them to have to deal with driver bugs, too.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some people suggested, as a solution to the network interoperability compatibility problem, adding a flag to IShellFolder::EnumObjects to indicate whether the caller wanted to use fast or slow enumeration. Adding a flag to work around a driver bug doesn&#8217;t actually solve anything in the long term. Considering all the video driver bugs that Windows has [&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":[26],"class_list":["post-31653","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Some people suggested, as a solution to the network interoperability compatibility problem, adding a flag to IShellFolder::EnumObjects to indicate whether the caller wanted to use fast or slow enumeration. Adding a flag to work around a driver bug doesn&#8217;t actually solve anything in the long term. Considering all the video driver bugs that Windows has [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31653","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=31653"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31653\/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=31653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=31653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=31653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}