Fix embedded NULs in C wide strings returned from Windows API (#2264)
This commit is contained in:
parent
e7f88588bf
commit
ea09d1d10e
3 changed files with 14 additions and 10 deletions
|
|
@ -1,7 +1,5 @@
|
|||
use std::{
|
||||
ffi::OsString,
|
||||
mem::{self, size_of},
|
||||
os::windows::prelude::OsStringExt,
|
||||
ptr,
|
||||
};
|
||||
|
||||
|
|
@ -129,7 +127,7 @@ pub fn get_raw_input_device_name(handle: HANDLE) -> Option<String> {
|
|||
|
||||
unsafe { name.set_len(minimum_size as _) };
|
||||
|
||||
OsString::from_wide(&name).into_string().ok()
|
||||
util::decode_wide(&name).into_string().ok()
|
||||
}
|
||||
|
||||
pub fn register_raw_input_devices(devices: &[RAWINPUTDEVICE]) -> bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue