{"id":40633,"date":"2004-02-13T07:00:00","date_gmt":"2004-02-13T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2004\/02\/13\/bad-version-number-checks\/"},"modified":"2004-02-13T07:00:00","modified_gmt":"2004-02-13T07:00:00","slug":"bad-version-number-checks","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20040213-00\/?p=40633","title":{"rendered":"Bad version number checks"},"content":{"rendered":"<p>Version numbers. Very important. And so many people check them wrong.<\/p>\n<p>\nThis is why Windows 95&#8217;s GetVersion function returned 3.95 instead of 4.0.\nA lot of code checked the version number like this:\n<\/p>\n<pre>\n  UINT Ver = GetVersion();\n  UINT MajorVersion = LOBYTE(uVer);\n  UINT MinorVersion = HIBYTE(uVer);\n  if (MajorVersion &lt; 3 || MinorVersion &lt; 10) {\n   Error(\"This program requires Windows 3.1\");\n  }\n<\/pre>\n<p>\nNow consider what happens when the version number is reported\nas 4.0.  The major version check passes, but the minor version\ncheck fails since 0 is less than 10.\n<\/p>\n<p>\nThis bug was so rife that we gave up shimming every app that\nhad the problem and just decided, &#8220;Fine. If anybody asks,\nsay that the Windows version is 3.95.&#8221;\n<\/p>\n<p>\nI suspect this is also\n<a HREF=\"\/oldnewthing\/archive\/2004\/01\/22\/61647.aspx#61840\">\nwhy DirectX always reports its version as 4.x<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Version numbers. Very important. And so many people check them wrong. This is why Windows 95&#8217;s GetVersion function returned 3.95 instead of 4.0. A lot of code checked the version number like this: UINT Ver = GetVersion(); UINT MajorVersion = LOBYTE(uVer); UINT MinorVersion = HIBYTE(uVer); if (MajorVersion &lt; 3 || MinorVersion &lt; 10) { Error(&#8220;This [&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-40633","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>Version numbers. Very important. And so many people check them wrong. This is why Windows 95&#8217;s GetVersion function returned 3.95 instead of 4.0. A lot of code checked the version number like this: UINT Ver = GetVersion(); UINT MajorVersion = LOBYTE(uVer); UINT MinorVersion = HIBYTE(uVer); if (MajorVersion &lt; 3 || MinorVersion &lt; 10) { Error(&#8220;This [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/40633","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=40633"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/40633\/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=40633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=40633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=40633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}