refactor(windows-rs): use "wide" fns uniformly

This commit builds on @EBNull's comment shedding light on the uses of
the -A and -W functions in the Win32 API, and standardizes the calling
of the -W functions across the project.

Since UTF-16 String handling is a bit lacking in the Rust standard
library, I have pulled in the widestring crate to use the
from_slice_truncate fn to automagically remove all of the trailing null
chars when handling values returned from the various Win32 -W fns.

Comment ref: https://github.com/LGUG2Z/komorebi/commit/657ac441ae3bc6c748908a6e88b9e1a37d411420#r135643553
This commit is contained in:
LGUG2Z
2023-12-23 16:39:53 -08:00
parent e221d96785
commit cf86b2cf98
6 changed files with 70 additions and 57 deletions
Generated
+7
View File
@@ -827,6 +827,7 @@ dependencies = [
"tracing-subscriber",
"uds_windows",
"which",
"widestring",
"windows",
"windows-implement",
"windows-interface",
@@ -2331,6 +2332,12 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "widestring"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8"
[[package]]
name = "winapi"
version = "0.2.8"