On Mon Sep 29 11:01:07 2025 +0000, Rémi Bernon wrote:
What about using WindowsCreateStringReference here too?
We could, but I don't know if it would be helpful (for `canonical_name` as well).[`IPropertyValueStatics::CreateString` calls `WindowsDuplicateString`](), so the fast-pass string would anyway get copied to the heap.
OTOH, `WindowsCreateStringReference` is infallible, and the `WindowsDeleteString` call wouldn't be required (though we'll need to add a `HSTRING_HEADER` declaration):
```c case DEVPROP_TYPE_STRING: { HSTRING_HEADER hdr;
WindowsCreateStringReference( prop->Buffer, wcslen( prop->Buffer ), &str, &hdr ); hr = IPropertyValueStatics_CreateString( propval_statics, str, &val ); } ```