use vmi::utils::shellcode::{ParameterWriter, Parameters};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct KernelFileParameters {
nt_path: String,
}
impl KernelFileParameters {
pub fn new(path: impl AsRef<str>) -> Self {
let path = path.as_ref();
let nt_path = if path.starts_with('\\') {
path.to_string()
}
else {
format!(r"\??\{path}")
};
Self { nt_path }
}
pub fn nt_path(&self) -> &str {
&self.nt_path
}
}
impl Parameters for KernelFileParameters {
const ALIGNMENT: usize = align_of::<u16>();
fn encode(&self, writer: &mut ParameterWriter) {
writer.write_string_utf16(&self.nt_path);
}
}