Skip to content

The ITfCandidateListUIElement::GetPageIndex should accept Option<&mut [u32]> instead of &mut [u32] #2184

@Tnze

Description

@Tnze

Summary

The API windows::Win32::UI::TextServices::ITfCandidateListUIElement pub unsafe fn GetPageIndex(&self, pindex: &mut [u32], pupagecnt: *mut u32) -> windows_core::Result<()> currently accept pIndex: &mut [u32].

But according to https://learn.microsoft.com/en-us/windows/win32/api/msctf/nf-msctf-itfcandidatelistuielement-getpageindex, the pIndex can be NULL, which is impossible unless we change the generated Rust code to accept a Option<&mut [u32]>.

Crate manifest

[dependencies]
windows = { version = "0.62.2", features = ["Win32_System_Com", "Win32_UI_TextServices"] }
windows-core = "0.62.2"

Crate code

let mut page_count = MaybeUninit::new(0);
// The empty slice doesn't work, the API returns E_INVALIDARG. It must be NULL to let it work.
candidate_list.GetPageIndex(&mut [], page_count.as_mut_ptr()).unwrap();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions