verity_memory/macros/
wide_string.rs1#[macro_export]
2macro_rules! w {
3 ($text:literal $(, $args:expr)*) => {{
4 let formatted = format!($text $(, $args)*);
5 let os_str = std::ffi::OsStr::new(&formatted);
6 let wide_string: Vec<u16> = std::os::windows::ffi::OsStrExt::encode_wide(os_str)
7 .chain(Some(0))
8 .collect();
9 wide_string.as_ptr()
10 }};
11
12 ($text:expr) => {{
13 let formatted = $text.to_string();
14 let os_str = std::ffi::OsStr::new(&formatted);
15 let wide_string: Vec<u16> = std::os::windows::ffi::OsStrExt::encode_wide(os_str)
16 .chain(Some(0))
17 .collect();
18 wide_string.as_ptr()
19 }};
20}