A header file was added to the Windows API in Windows 8 which appears to be filled with pretty basic string functions that are all already available in the C runtime. There doesn't appear to be any reason why these functions would be added to the Windows API.
I only found out about them because they're used in explorer.exe
Why use these functions instead of the classic cstring ones?
The winstring.h header provides string handling functions for HSTRING
values, a string type introduced with the Windows Runtime. It is the successor to the BSTR
type used in COM.
Either one is distinctly different from a C-style string in that they explicitly store the length. A corollary of this is that either one can contain embedded NUL characters, making it impossible to reliably get the string length by calling wcslen
on them, for example.
In addition, neither HSTRING
nor BSTR
have a dependency on any given language runtime (such as the CRT). Use of either type will thus not interfere with the language runtime used by clients. Obviously, this necessitates providing string handling functions outside a language runtime, hence we have winstring.h (and oleauto.h).