Strings RFC
This is an RFC for how we'll handle the many types of Strings in Rust and Windows and how they interact with each other.
This is a complicated question, so I imagine we'll probably not get it right, but I do believe this is an improvement over the status quo not only in terms of useability but also safety.
I would also add that there are some more rough edges with functions that take even more variations on strings.
There's UNICODE_STRING which is roughly equivalent to the Rust types &[u16], &mut [u16] or Vec<u16> depending on the function being used and the value of MaximumLength. This can support interior nulls.
Also there are functions such as CompareStringOrdinal that can take a null terminated LPCWCH string but also optionally take a length so the strings need not be null terminated (and may therefore include nulls).
And some functions such as SetFileInformationByHandle that take structures which require both a null terminated string and the length of the string.
While these should not be too difficult to support, I think it's worth noting there are a number of variations on the basic ptr + length string.
Right, which is why I'm reluctant to add some new synthetic string type like CWString when we already have so many to contend with. If anything, something like CWString belongs in the standard library alongside CString while the windows crate should focus on those that are specific to Windows, like HSTRING and BSTR, as it does.
To @ChrisDenton's point, it is also not the goal of the window crate to smooth over every last detail of string handling in the Windows API. There will always be APIs that are harder to call directly and possibly deserve some specialized crate to provide a more idiomatic experience if the API is that important. Many are not. 😏
This PR's pretty old. Can we move it along or just close it for now?