{"id":40663,"date":"2004-02-11T07:00:00","date_gmt":"2004-02-11T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2004\/02\/11\/sure-we-do-that\/"},"modified":"2004-02-11T07:00:00","modified_gmt":"2004-02-11T07:00:00","slug":"sure-we-do-that","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20040211-00\/?p=40663","title":{"rendered":"Sure, we do that"},"content":{"rendered":"<p>The DirectX video driver interface for Windows&nbsp;95\nhad a method that each driver exposed called something\nlike &#8220;DoesDriverSupport(REFGUID guidCapability)&#8221; where we\nhanded it a capability GUID and it said whether or not\nthat feature was supported.<\/p>\n<p>\nThere were various capability GUIDs defined, things like\nGUID_CanStretchAlpha to ask the driver whether it was\ncapable of stretching a bitmap with an alpha channel.\n<\/p>\n<p>\nThere was one driver that returned TRUE when you called\nDoesDriverSupport(GUID_XYZ), but when DirectDraw\ntried to use that capability, it failed, and in a pretty\nspectacular manner.\n<\/p>\n<p>\nSo one of the DirectDraw developers called the vendor and\nasked them, &#8220;So does your card do XYZ?&#8221;\n<\/p>\n<p>\nTheir response: &#8220;What&#8217;s XYZ?&#8221;\n<\/p>\n<p>\nTurns out that their driver&#8217;s implementation of DoesDriverSupport\nwas something like this:\n<\/p>\n<pre>\nBOOL DoesDriverSupport(REFGUID guidCapability)\n{\n  return TRUE;\n}\n<\/pre>\n<p>\nIn other words, whenever DirectX asked, &#8220;Can you do this?&#8221;\nthey answered, &#8220;Sure, we do that,&#8221; without even checking what\nthe question was.\n<\/p>\n<p>\n(The driver must have been written by the sales department.)\n<\/p>\n<p>\nSo the DirectDraw folks changed the way they queried for\ndriver capabilities.  One of the developers went into his\nboss&#8217;s office, took a network card, extracted the\n<a HREF=\"http:\/\/www.webopedia.com\/TERM\/M\/MAC_address.html\">\nMAC address<\/a>, and then smashed the card with a hammer.\n<\/p>\n<p>\nYou see, this last step was important: The GUID generation\nalgorithm is based on a combination of time and space.\nWhen you ask CoCreateGuid to create a new GUID, it encodes\nthe time of your request in the first part of the GUID\nand information that uniquely identifies your machine\n(the network card&#8217;s MAC address, which is required\nto be unique by the standards that apply to network card).\n<\/p>\n<p>\nBy smashing the network card with a hammer, he prevented\nthat network card from ever being used to generate a GUID.\n<\/p>\n<p>Next, he added code to DirectDraw so that when it starts up,\nit manufactures a random GUID based on that network card\n(which &#8211; by its having been destroyed &#8211; can never be validly created)\nand passes it to DoesDriverSupport.\nIf the driver says, &#8220;Sure, we do that&#8221;, DirectDraw says,\n&#8220;Aha! Caught you! I will not believe anything you say from now on.&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The DirectX video driver interface for Windows&nbsp;95 had a method that each driver exposed called something like &#8220;DoesDriverSupport(REFGUID guidCapability)&#8221; where we handed it a capability GUID and it said whether or not that feature was supported. There were various capability GUIDs defined, things like GUID_CanStretchAlpha to ask the driver whether it was capable of stretching [&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-40663","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>The DirectX video driver interface for Windows&nbsp;95 had a method that each driver exposed called something like &#8220;DoesDriverSupport(REFGUID guidCapability)&#8221; where we handed it a capability GUID and it said whether or not that feature was supported. There were various capability GUIDs defined, things like GUID_CanStretchAlpha to ask the driver whether it was capable of stretching [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/40663","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=40663"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/40663\/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=40663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=40663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=40663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}