MCPcopy Index your code
hub / github.com/b1tg/rust-windows-shellcode / str_to_u16_ptr

Function str_to_u16_ptr

shellcode/src/utils.rs:28–41  ·  view source on GitHub ↗

TODO: use alloc

(s: &str, buf: &mut [u16])

Source from the content-addressed store, hash-verified

26
27// TODO: use alloc
28pub fn str_to_u16_ptr(s: &str, buf: &mut [u16]) {
29 let s_len = s.len();
30 let s_bytes = s.as_bytes();
31
32 // for i in 0..255 {
33
34 // }
35 // let buf = vec![0u16;s_len+1];
36 for i in 0..s_len {
37 buf[i] = s_bytes[i] as _;
38 }
39 buf[s_len] = 0;
40 // buf.as_ptr()
41}
42
43use num_traits::Num;
44

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected