{"id":108239,"date":"2023-05-24T07:00:00","date_gmt":"2023-05-24T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=108239"},"modified":"2023-05-24T06:49:32","modified_gmt":"2023-05-24T13:49:32","slug":"20230524-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20230524-00\/?p=108239","title":{"rendered":"Don&#8217;t name your header file <CODE>security.h<\/CODE> either"},"content":{"rendered":"<p>A customer found that the <code>GetUserNameExW<\/code> function suddenly disappeared.<\/p>\n<pre style=\"white-space: pre-wrap;\">error C2065: 'NameSamCompatible': undeclared identifier\r\nerror C3861: 'GetUserNameExW': identifier not found\r\n<\/pre>\n<p>What happened?<\/p>\n<p>These symbols are defined in the header file <code>secext.h<\/code> in the Windows SDK, and that file was still present on the system and not corrupted. That file is usually not included directly, but rather gets pulled in indirectly when an application includes the header file <code>security.h<\/code> from the SDK.<\/p>\n<p>Some more exploration revealed that another part of the project added a header file with the name <code>security.h<\/code>. This collides with the header file of the same name in the Windows SDK, so when the code did a<\/p>\n<pre>#include &lt;security.h&gt; \/\/ GetUserNameExW\r\n<\/pre>\n<p>expecting to get the header file from the Windows SDK, it instead picked up the project local version.<\/p>\n<p>We learned some time ago that <a href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20040702-00\/?p=38583\"> you shouldn&#8217;t name your DLL &#8220;security.dll&#8221;<\/a>. And now we learned that the header file name <code>security.h<\/code> should also be avoided.<\/p>\n<p>(In retrospect, the feature team should have chosen a less common name for their header file and DLL.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You may be overriding an SDK header by mistake.<\/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":[25],"class_list":["post-108239","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>You may be overriding an SDK header by mistake.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/108239","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=108239"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/108239\/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=108239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=108239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=108239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}