Quantcast
Channel: May 2023 - The Old New Thing
Viewing all articles
Browse latest Browse all 10

Don’t name your header file security.h either

$
0
0

A customer found that the GetUserNameExW function suddenly disappeared.

error C2065: 'NameSamCompatible': undeclared identifier
error C3861: 'GetUserNameExW': identifier not found

What happened?

These symbols are defined in the header file secext.h 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 security.h from the SDK.

Some more exploration revealed that another part of the project added a header file with the name security.h. This collides with the header file of the same name in the Windows SDK, so when the code did a

#include <security.h> // GetUserNameExW

expecting to get the header file from the Windows SDK, it instead picked up the project local version.

We learned some time ago that you shouldn’t name your DLL “security.dll”. And now we learned that the header file name security.h should also be avoided.

(In retrospect, the feature team should have chosen a less common name for their header file and DLL.)

The post Don’t name your header file <CODE>security.h</CODE> either appeared first on The Old New Thing.


Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>