wmi_string_from_utf8s(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ wmi_string_from_utf8s(9) ✨

okay bestie, welcome to the Kernel API Manual β€” today's main character is wmi_string_from_utf8s, and honestly? she's giving "glow-up translator" energy πŸ’…


πŸŽ€ NAME πŸŽ€

wmi_string_from_utf8s β€” literally converts a UTF8 string into a WMI string. no cap, that's the whole gig πŸ¦‹


🌸 SYNOPSIS 🌸

ssize_t wmi_string_from_utf8s (struct wmi_string *str , size_t max_chars
, const u8 *src , size_t src_length );

like, look at her signature. so clean. so iconic. ✨


πŸ’– ARGUMENTS πŸ’–

  • str β€” the WMI string representation, aka where the magic lands 🫢
  • max_chars β€” the maximum number of UTF16 code points you're allowed to store inside the WMI string. that's her limit, respect it 🚧
  • src β€” the UTF8 string you're converting (the source, the muse, the blueprint) πŸ¦‹
  • src_length β€” length of the source string, and listen: without any trailing NUL-characters. so don't be counting those, bestie πŸ™ˆ

🌈 DESCRIPTION 🌈

so here's the vibe check πŸ‘‘: this function converts a UTF8 string into a WMI string.

the conversion stops when the WMI string is full β€” no overflow drama, she just knows when to stop πŸ’€

and when this function returns successfully? the resulting WMI string will always be NUL-terminated, and its length field will be set to an appropriate value. always. periodt. πŸ’…


πŸ”₯ RETURN πŸ”₯

she hands you back the number of UTF16 code points inside the WMI string πŸŽ€

or, if things go sideways, a negative errno code. 😭 that's the fail state, and yes, it's negative, look out for it.


🧚 SEE ALSO 🧚

  • Kernel file ./drivers/platform/wmi/string.c
  • wmi_string_to_utf8s(9) β€” the reverse queen, go say hi πŸ‘‘

okay but seriously bestie, if max_chars is small the string gets cut off β€” that's not a bug, that's just her stopping when she's full πŸ“

mwah, that's the whole page πŸ’œ this lil' slice of kernel docs lives in ./drivers/platform/wmi, dated October 2026 β€” and it's wmi_string_from_utf8s(9) all the way down, iykyk ⭐🌸

πŸ“¦ where this page comes from