{"id":148,"date":"2009-11-16T21:44:20","date_gmt":"2009-11-16T08:44:20","guid":{"rendered":"http:\/\/www.paradicesoftware.com\/blog\/?p=148"},"modified":"2009-11-16T21:48:54","modified_gmt":"2009-11-16T08:48:54","slug":"scary-windows-development-stories","status":"publish","type":"post","link":"http:\/\/www.paradicesoftware.com\/blog\/2009\/11\/scary-windows-development-stories\/","title":{"rendered":"Scary Windows development stories"},"content":{"rendered":"<p>I&#8217;m currently reading a book about the evolution of Windows. One of the most interesting things I keep finding is how stupid some 3rd party application developers must have been&#8230;. for example, it seems to have been common practice that if you wanted your app to grab a particular Windows setting (let&#8217;s say the Fonts directory), instead of a quick MSDN search, which turns up both the <em>SHGetFolderPath<\/em> and <em>SHGetKnownFolderPath<\/em> functions (either of which is exactly what you want), these programmers fired up RegEdit and searched for the path of their own Fonts folder&#8230; the first key they found, they used as the parameter for a call to  <em>RegOpenKeyEx<\/em> and they read the value that way.<\/p>\n<p>To me, that is not only a frighteningly ignorant and dangerous way to develop software (you&#8217;re not going to discover caveats &#038; usage notes by browsing RegEdit!) but <strong>of course<\/strong> this is not the supported way to do it (how could any sane developer think otherwise?), and <strong>of course<\/strong> that app would have broken immediately on any new of Windows had MS not added a compatibility shim to watch for that program checking that buggy key, and substituting in a quick call to obtain the real value&#8230;<\/p>\n<p>This isn&#8217;t backyard programmers writing in VBA in Excel to accomplish some one-off business task, either.. it&#8217;s commercial software that did this, written by professional developers and sold to unsuspecting customers for big cash. Scary stuff.<\/p>\n<p>The only question worth pondering here is: was this &#8216;grab something promising out of the Registry&#8217; technique better or worse than just hard-coding &#8220;C:\\Windows\\Fonts\\&#8221; into the application? (I&#8217;m not 100% sure but it seems very likely there&#8217;s a shim out there for programs that did that, too.) <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m currently reading a book about the evolution of Windows. One of the most interesting things I keep finding is how stupid some 3rd party application developers must have been&#8230;. for example, it seems to have been common practice that if you wanted your app to grab a particular Windows setting (let&#8217;s say the Fonts<\/p>\n","protected":false},"author":2722,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,18],"tags":[77,17,11],"class_list":["post-148","post","type-post","status-publish","format-standard","hentry","category-code","category-good-coding-guidelines","tag-code","tag-taxes","tag-windows"],"_links":{"self":[{"href":"http:\/\/www.paradicesoftware.com\/blog\/wp-json\/wp\/v2\/posts\/148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.paradicesoftware.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.paradicesoftware.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.paradicesoftware.com\/blog\/wp-json\/wp\/v2\/users\/2722"}],"replies":[{"embeddable":true,"href":"http:\/\/www.paradicesoftware.com\/blog\/wp-json\/wp\/v2\/comments?post=148"}],"version-history":[{"count":6,"href":"http:\/\/www.paradicesoftware.com\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":154,"href":"http:\/\/www.paradicesoftware.com\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions\/154"}],"wp:attachment":[{"href":"http:\/\/www.paradicesoftware.com\/blog\/wp-json\/wp\/v2\/media?parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.paradicesoftware.com\/blog\/wp-json\/wp\/v2\/categories?post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.paradicesoftware.com\/blog\/wp-json\/wp\/v2\/tags?post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}