Is it OK to pass NULL as the first argument to WindowsDuplicateString? The documentation isn't clear here but calling WindowsCreateString(NULL, 0, &s) is allowed and my tests showed that it sets s to NULL so NULL seems to be a valid HSTRING. Other functions like WindowsGetStringLen also allow passing a NULL HSTRING.
so
NULLseems to be a validHSTRING.
This is not something that needs to be guessed at, as Microsoft has documented it:
Semantically, an HSTRING containing the value NULL represents the empty string, which consists of zero content characters and a terminating NULL character. Creating a string via WindowsCreateString with zero characters will produce the handle value NULL.
Since NULL is documented to be a valid HSTRING, one may assume that it is valid for WindowsDuplicateString in the absence of documentation to the contrary (unless you believe the documentation is incomplete, in which case all bets are off).