Skip to content

windows-sys doesn't distinguish between LPCWSTR and LPWSTR #1504

@maroider

Description

@maroider

Crate version: 0.32.0

This is similar to #1490, but perhaps a bit more specific.

windows-sys doesn't distinguish between mutable and immutable string pointers, so all functions get whatever LPWSTR is aliased to (used to be *mut u16, now it's *const u16). With type LPWSTR = *const u16, APIs like GetWindowTextW now take a *const u16 where they should take a *mut u16, which is a problem.

There's a similar issue with ImmSetCompositionWindow, where the function is documented on MSDN as taking an LPCOMPOSITIONFORM (*mut COMPOSITIONFORM), but windows-sys says it takes a *const COMPOSITIONFORM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions