Skip to content

Additional string types for CoTaskMemAlloc'ed strings & others #3810

@talagrand

Description

@talagrand

Suggestion

With recent improvements to windows-rs we've been able to get rid of most of our bespoke RAII helpers, but we still have 2 which could be of general interest to others:

  • An owned string type for interacting with strings from APIs that use CoTaskMemoAlloc'ed strings
  • An owned string type for UNICODE_STRINGs. This could be satisfied if there was a specialization of Owned for this struct, though of course an actual string struct would have benefits like conventional string methods.

The first especially is all over COM, and given that underlying C data type is just PWSTR it would be great to have representation in the type system. The ideal case is of course to have method signatures directly interact with string types matching the allocation strategy, but if this is not possible due to missing API metadata, just having a standardized helper that could immediately take string ownership would be a great first step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions