MCPcopy Create free account
hub / github.com/StephanvanSchaik/windows-kernel-rs / create_unicode_string

Function create_unicode_string

windows-kernel-rs/src/string.rs:3–13  ·  view source on GitHub ↗
(s: &[u16])

Source from the content-addressed store, hash-verified

1use windows_kernel_sys::base::UNICODE_STRING;
2
3pub fn create_unicode_string(s: &[u16]) -> UNICODE_STRING {
4 let len = s.len();
5
6 let n = if len > 0 && s[len - 1] == 0 { len - 1 } else { len };
7
8 UNICODE_STRING {
9 Length: (n * 2) as u16,
10 MaximumLength: (len * 2) as u16,
11 Buffer: s.as_ptr() as _,
12 }
13}

Callers 4

create_deviceMethod · 0.85
openMethod · 0.85
newMethod · 0.85
dropMethod · 0.85

Calls 1

as_ptrMethod · 0.80

Tested by

no test coverage detected